diff options
| author | Qu Wenruo <wqu@suse.com> | 2026-06-16 17:42:35 +0930 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-06-16 14:48:35 -0600 |
| commit | b68d4979c88e31488970373f67ac79b4f6267008 (patch) | |
| tree | d19de35125a16d6c2cba06ad899f574df55b7a36 /include/linux/stackprotector.h | |
| parent | fad156c2af227f42ca796cbb20ddc354a6dd9932 (diff) | |
block: revert the iov_iter after a short copy in bio_iov_iter_bounce_write()
For the incoming IOMAP_DIO_BOUNCE flag usage inside btrfs, it's pretty
easy to hit short copy inside bio_iov_iter_bounce_write().
This is because btrfs has disabled page fault to avoid certain deadlock
during direct writes, and instead btrfs manually fault in the pages then
retry.
And inside bio_iov_iter_bounce_write(), if we hit a short write, we
didn't revert the iov_iter, which can cause problems like unexpected
garbage for the next retry.
Revert the iov_iter after a short copy.
One thing to note is that, the folio is allocated then immediately
queued into the bio, so the proper revert size should be
(bi_size - this_len + copied).
Fixes: 8dd5e7c75d7b ("block: add helpers to bounce buffer an iov_iter into bios")
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/c400989f227343b134110773d5acaaacf7024574.1781597506.git.wqu@suse.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/stackprotector.h')
0 files changed, 0 insertions, 0 deletions
