[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6691cb0d-d368-7115-87f2-ae5950699b7d@kernel.dk>
Date: Tue, 8 Jun 2021 15:07:15 -0600
From: Jens Axboe <axboe@...nel.dk>
To: longli@...uxonhyperv.com, linux-block@...r.kernel.org
Cc: Long Li <longli@...rosoft.com>,
Johannes Thumshirn <johannes.thumshirn@....com>,
Pavel Begunkov <asml.silence@...il.com>,
Ming Lei <ming.lei@...hat.com>, Tejun Heo <tj@...nel.org>,
"Matthew Wilcox (Oracle)" <willy@...radead.org>,
Jeffle Xu <jefflexu@...ux.alibaba.com>,
linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [Patch v3] block: return the correct bvec when checking for gaps
On 6/7/21 1:34 PM, longli@...uxonhyperv.com wrote:
> From: Long Li <longli@...rosoft.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
Powered by blists - more mailing lists