diff options
author | Mike Snitzer <snitzer@redhat.com> | 2020-12-04 17:21:03 -0500 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2020-12-04 17:27:42 -0500 |
commit | 65f33b35722952fa076811d5686bfd8a611a80fa (patch) | |
tree | 0ea0faecf593a44ee9f9bac012dfab2a52d85b2e /include | |
parent | bde3808bc8c2741ad3d804f84720409aee0c2972 (diff) |
block: fix incorrect branching in blk_max_size_offset()
If non-zero 'chunk_sectors' is passed in to blk_max_size_offset() that
override will be incorrectly ignored.
Old blk_max_size_offset() branching, prior to commit 3ee16db390b4,
must be used only if passed 'chunk_sectors' override is zero.
Fixes: 3ee16db390b4 ("dm: fix IO splitting")
Cc: stable@vger.kernel.org # 5.9
Reported-by: John Dorminy <jdorminy@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/blkdev.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 24ae504cf77d..033eb5f73b65 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1076,10 +1076,12 @@ static inline unsigned int blk_max_size_offset(struct request_queue *q, sector_t offset, unsigned int chunk_sectors) { - if (!chunk_sectors && q->limits.chunk_sectors) - chunk_sectors = q->limits.chunk_sectors; - else - return q->limits.max_sectors; + if (!chunk_sectors) { + if (q->limits.chunk_sectors) + chunk_sectors = q->limits.chunk_sectors; + else + return q->limits.max_sectors; + } if (likely(is_power_of_2(chunk_sectors))) chunk_sectors -= offset & (chunk_sectors - 1); |