From: Jens Axboe <axboe@kernel.dk>
To: longli@linuxonhyperv.com, linux-block@vger.kernel.org
Cc: Long Li <longli@microsoft.com>,
Johannes Thumshirn <johannes.thumshirn@wdc.com>,
Pavel Begunkov <asml.silence@gmail.com>,
Ming Lei <ming.lei@redhat.com>, Tejun Heo <tj@kernel.org>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Jeffle Xu <jefflexu@linux.alibaba.com>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [Patch v3] block: return the correct bvec when checking for gaps
Date: Tue, 8 Jun 2021 15:07:15 -0600 [thread overview]
Message-ID: <6691cb0d-d368-7115-87f2-ae5950699b7d@kernel.dk> (raw)
In-Reply-To: <1623094445-22332-1-git-send-email-longli@linuxonhyperv.com>
On 6/7/21 1:34 PM, longli@linuxonhyperv.com wrote:
> From: Long Li <longli@microsoft.com>
>
> After commit 07173c3ec276 ("block: enable multipage bvecs"), a bvec can
> have multiple pages. But bio_will_gap() still assumes one page bvec while
> checking for merging. If the pages in the bvec go across the
> seg_boundary_mask, this check for merging can potentially succeed if only
> the 1st page is tested, and can fail if all the pages are tested.
>
> Later, when SCSI builds the SG list the same check for merging is done in
> __blk_segment_map_sg_merge() with all the pages in the bvec tested. This
> time the check may fail if the pages in bvec go across the
> seg_boundary_mask (but tested okay in bio_will_gap() earlier, so those
> BIOs were merged). If this check fails, we end up with a broken SG list
> for drivers assuming the SG list not having offsets in intermediate pages.
> This results in incorrect pages written to the disk.
>
> Fix this by returning the multi-page bvec when testing gaps for merging.
Applied, thanks.
--
Jens Axboe
prev parent reply other threads:[~2021-06-08 21:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-07 19:34 [Patch v3] block: return the correct bvec when checking for gaps longli
2021-06-08 17:07 ` Christoph Hellwig
2021-06-08 21:07 ` Jens Axboe [this message]
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=6691cb0d-d368-7115-87f2-ae5950699b7d@kernel.dk \
--to=axboe@kernel.dk \
--cc=asml.silence@gmail.com \
--cc=jefflexu@linux.alibaba.com \
--cc=johannes.thumshirn@wdc.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longli@linuxonhyperv.com \
--cc=longli@microsoft.com \
--cc=ming.lei@redhat.com \
--cc=stable@vger.kernel.org \
--cc=tj@kernel.org \
--cc=willy@infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).