From: Mike Snitzer <snitzer@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: axboe@kernel.dk, Nick Desaulniers <ndesaulniers@google.com>,
linux-block@vger.kernel.org, dm-devel@redhat.com,
Mikulas Patocka <mpatocka@redhat.com>,
vgoyal@redhat.com, Sergei Shtepa <sergei.shtepa@veeam.com>,
Thomas Gleixner <tglx@linutronix.de>,
Alasdair G Kergon <agk@redhat.com>
Subject: [dm-devel] [PATCH] block: fix incorrect branching in blk_max_size_offset() [was: Re: [git pull] device mapper fixes for 5.10-rc7]
Date: Fri, 4 Dec 2020 17:37:42 -0500 [thread overview]
Message-ID: <20201204223742.GA82260@lobo> (raw)
In-Reply-To: <160711773655.16738.13830016046956700847.pr-tracker-bot@kernel.org>
On Fri, Dec 04 2020 at 4:35P -0500,
pr-tracker-bot@kernel.org <pr-tracker-bot@kernel.org> 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 <snitzer@redhat.com>
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: stable@vger.kernel.org # 5.9
Reported-by: John Dorminy <jdorminy@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
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
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
WARNING: multiple messages have this Message-ID (diff)
From: Mike Snitzer <snitzer@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: dm-devel@redhat.com, linux-block@vger.kernel.org,
Alasdair G Kergon <agk@redhat.com>,
Mikulas Patocka <mpatocka@redhat.com>,
Nick Desaulniers <ndesaulniers@google.com>,
Sergei Shtepa <sergei.shtepa@veeam.com>,
Thomas Gleixner <tglx@linutronix.de>,
axboe@kernel.dk, vgoyal@redhat.com
Subject: [PATCH] block: fix incorrect branching in blk_max_size_offset() [was: Re: [git pull] device mapper fixes for 5.10-rc7]
Date: Fri, 4 Dec 2020 17:37:42 -0500 [thread overview]
Message-ID: <20201204223742.GA82260@lobo> (raw)
In-Reply-To: <160711773655.16738.13830016046956700847.pr-tracker-bot@kernel.org>
On Fri, Dec 04 2020 at 4:35P -0500,
pr-tracker-bot@kernel.org <pr-tracker-bot@kernel.org> 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 <snitzer@redhat.com>
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: stable@vger.kernel.org # 5.9
Reported-by: John Dorminy <jdorminy@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
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
next prev parent reply other threads:[~2020-12-04 22:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-04 21:05 [dm-devel] [git pull] device mapper fixes for 5.10-rc7 Mike Snitzer
2020-12-04 21:05 ` Mike Snitzer
2020-12-04 21:35 ` [dm-devel] " pr-tracker-bot
2020-12-04 21:35 ` pr-tracker-bot
2020-12-04 22:37 ` Mike Snitzer [this message]
2020-12-04 22:37 ` [PATCH] block: fix incorrect branching in blk_max_size_offset() [was: Re: [git pull] device mapper fixes for 5.10-rc7] Mike Snitzer
2020-12-04 23:12 ` [dm-devel] [git pull] device mapper induced block fix for 5.10-rc7 Mike Snitzer
2020-12-04 23:12 ` Mike Snitzer
2020-12-05 19:21 ` [dm-devel] " pr-tracker-bot
2020-12-05 19:21 ` pr-tracker-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201204223742.GA82260@lobo \
--to=snitzer@redhat.com \
--cc=agk@redhat.com \
--cc=axboe@kernel.dk \
--cc=dm-devel@redhat.com \
--cc=linux-block@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=ndesaulniers@google.com \
--cc=sergei.shtepa@veeam.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=vgoyal@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.