On 12/27/19 4:05 PM, 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 for ever. > > Also the current truncating on last segment is dangerous by updating the > last bvec, given bvec table becomes not immutable any more, and fs bio > users may not retrieve the truncated 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 Applied, thanks. -- Jens Axboe