Thread (2 messages) 2 messages, 2 authors, 2019-12-27

Re: [PATCH] block: add bio_truncate to fix guard_bio_eod

From: Jens Axboe <axboe@kernel.dk>
Date: 2019-12-27 15:54:34
Also in: linux-fsdevel

On 12/27/19 1:36 AM, Ming Lei wrote:
Some filesystem, such as vfat, may send bio which crosses device boundary,
and the worse thing is that the IO request starting within device boundaries
can contain more than one segment past EOD.

Commit dce30ca9e3b6 ("fs: fix guard_bio_eod to check for real EOD errors")
tries to fix this issue by returning -EIO for this situation. However,
this way lets fs user code lose chance to handle -EIO, then sync_inodes_sb()
may hang forever.

Also the current truncating on last segment is dangerous by updating the
last bvec, given the bvec table becomes not immutable, and fs bio users
may lose to retrieve pages via bio_for_each_segment_all() in its .end_io
callback.

Fixes this issue by supporting multi-segment truncating. And the
approach is simpler:

- just update bio size since block layer can make correct bvec with
the updated bio size. Then bvec table becomes really immutable.

- zero all truncated segments for read bio
This looks good to me, but we don't need the export of the symbol.

-- 
Jens Axboe
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help