]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit - block/blk-merge.c
block: fix segment calculation for passthrough IO
authorMing Lei <ming.lei@redhat.com>
Sun, 3 Mar 2019 13:17:48 +0000 (21:17 +0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 6 Mar 2019 16:42:54 +0000 (09:42 -0700)
commit05b700ba6003fd98c41314f390df36e2b893e167
treeea1ae0f1e8ab9a6f4a4085e47842910043793377
parente61750c84701310f5a99e1c2e59d77aad5f1da78
block: fix segment calculation for passthrough IO

blk_recount_segments() can be called in bio_add_pc_page() for
calculating how many segments this bio will has after one page is added
to this bio. If the resulted segment number is beyond the queue limit,
the added page will be removed.

The try-and-fix policy requires blk_recount_segments(__blk_recalc_rq_segments)
to not consider the segment number limit. Unfortunately bvec_split_segs()
does check this limit, and causes small segment number returned to
bio_add_pc_page(), then page still may be added to the bio even though
segment number limit becomes broken.

Fixes this issue by not considering segment number limit when calcualting
bio's segment number.

Fixes: dcebd755926b ("block: use bio_for_each_bvec() to compute multi-page bvec count")
Cc: Christoph Hellwig <hch@lst.de>
Cc: Omar Sandoval <osandov@fb.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-merge.c