On Fri, Dec 04 2020 at  4:35P -0500,
[email protected] <[email protected]> wrote:

> The pull request you sent on Fri, 4 Dec 2020 16:05:21 -0500:
> 
> > git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git 
> > tags/for-5.10/dm-fixes
> 
> has been merged into torvalds/linux.git:
> https://git.kernel.org/torvalds/c/b3298500b23f0b53a8d81e0d5ad98a29db71f4f0
> 
> Thank you!

Hi Linus,

This is _really_ embarrassing; but I screwed up the branching at the top
of blk_max_size_offset(), here is the fix:

From: Mike Snitzer <[email protected]>
Date: Fri, 4 Dec 2020 17:21:03 -0500
Subject: [PATCH] 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: [email protected] # 5.9
Reported-by: John Dorminy <[email protected]>
Signed-off-by: Mike Snitzer <[email protected]>
---
 include/linux/blkdev.h | 10 ++++++----
 1 file 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);
-- 
2.15.0

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel

Reply via email to