mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-09 06:33:34 +00:00
bcachefs: Fix swallowing of data in buffered write path
In __bch2_buffered_write, if we fail to write to an entire !uptodate folio, we have to back out the write, bail out and retry. But we were missing an iov_iter_revert() call, so the data written to the folio was lost and the rest of the write shifted to the wrong offset. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
8c9b0f7bdc
commit
62898dd12b
@ -909,6 +909,7 @@ static int __bch2_buffered_write(struct bch_inode_info *inode,
|
||||
if (!folio_test_uptodate(f) &&
|
||||
f_copied != folio_size(f) &&
|
||||
pos + copied + f_copied < inode->v.i_size) {
|
||||
iov_iter_revert(iter, f_copied);
|
||||
folio_zero_range(f, 0, folio_size(f));
|
||||
folios_trunc(&folios, fi);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user