brd: iterate the bio by byte position, not bi_sector - #1273
Open
blktests-ci-kpd[bot] wants to merge 1 commit into
Open
blktests-ci-kpd[bot] wants to merge 1 commit into
blktests-ci-kpd[bot] wants to merge 1 commit into
Conversation
Author
|
Upstream branch: 28924df |
blktests-ci-kpd
Bot
force-pushed
the
linus-master_base
branch
from
September 9, 2026 07:40
4ddd216 to
00cc4ca
Compare
Author
|
Upstream branch: 893e117 |
blktests-ci-kpd
Bot
force-pushed
the
series/1160667=>linus-master
branch
from
September 9, 2026 08:02
d79c0f5 to
361c46a
Compare
blktests-ci-kpd
Bot
force-pushed
the
linus-master_base
branch
from
September 10, 2026 15:29
00cc4ca to
7efd8cd
Compare
Author
|
Upstream branch: 50d05c7 |
blktests-ci-kpd
Bot
force-pushed
the
series/1160667=>linus-master
branch
from
September 10, 2026 15:44
361c46a to
e4c8492
Compare
blktests-ci-kpd
Bot
force-pushed
the
linus-master_base
branch
from
September 12, 2026 02:26
7efd8cd to
a0aeca9
Compare
Author
|
Upstream branch: 5225b8e |
blktests-ci-kpd
Bot
force-pushed
the
series/1160667=>linus-master
branch
from
September 12, 2026 02:39
e4c8492 to
87350c6
Compare
blktests-ci-kpd
Bot
force-pushed
the
linus-master_base
branch
from
September 13, 2026 08:50
a0aeca9 to
772381e
Compare
Author
|
Upstream branch: 2f0c1cf |
blktests-ci-kpd
Bot
force-pushed
the
series/1160667=>linus-master
branch
from
September 13, 2026 10:07
87350c6 to
c5e4aca
Compare
blktests-ci-kpd
Bot
force-pushed
the
linus-master_base
branch
from
September 13, 2026 22:56
772381e to
0224dee
Compare
Author
|
Upstream branch: 2f0c1cf |
blktests-ci-kpd
Bot
force-pushed
the
series/1160667=>linus-master
branch
from
September 13, 2026 23:09
c5e4aca to
f32de33
Compare
blktests-ci-kpd
Bot
force-pushed
the
linus-master_base
branch
from
September 15, 2026 09:28
0224dee to
f14340f
Compare
brd_rw_bvec() takes the device position from bio->bi_iter.bi_sector, which bio_advance_iter_single() advances by bytes >> SECTOR_SHIFT. For a bvec whose length is not a multiple of the sector size the sector cursor silently loses the sub-sector residue while the data cursor (bi_bvec_done/bi_size) consumes the full length -- from that segment on, data is written at a device offset short of where it belongs, and every subsequent byte lands shifted with no error reported anywhere. Such bvec geometry is legal at the submitter: ITER_BVEC direct I/O passes the caller's bio_vec array through as-is (bio_iov_bvec_set()), so e.g. NFSD's NFSD_IO_DIRECT write path hands XFS/iomap a payload whose first fragment starts mid-page (the RPC header precedes it in the receive buffer) and whose fragment lengths are not sector multiples. A 1 MiB write arriving as bv0=(160,16224) + 63x(0,16384) + (0,160) reproduces on brd as: first 15872 = ALIGN_DOWN(16224, 512) bytes correct, everything after shifted forward by 352 = 16224 - 15872 bytes -- while the write completes successfully. Any NFSD_IO_DIRECT (or other kernel bvec direct I/O) write to a brd-backed filesystem is exposed; request-based drivers are unaffected because nothing in the request path does per-bvec sector arithmetic. Track the device position as a byte offset owned by the submit loop and advanced by the number of bytes each segment actually processed, instead of re-deriving it from the skewed bi_sector. Verified with a synthetic-bio reproducer over brd directly and through nvme-loop: mid-page-offset geometries and the page-aligned control now all read back byte-identical, and 20 fresh NFS connections x 16 MiB of O_DIRECT writes over an XFS-on-nvme-loop-on-brd export complete with zero data mismatches (previously most connections corrupted). Fixes: 3185444 ("brd: split I/O at page boundaries") Assisted-by: Claude:claude-fable-5 Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Author
|
Upstream branch: 5878583 |
blktests-ci-kpd
Bot
force-pushed
the
series/1160667=>linus-master
branch
from
September 15, 2026 09:44
f32de33 to
c3c6254
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request for series with
subject: brd: iterate the bio by byte position, not bi_sector
version: 1
url: https://patchwork.kernel.org/series/1160668/