projects
/
linux-2.6-microblaze.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
335d318
)
bcachefs: Fix data corruption on -ENOSPC in buffered write path
author
Kent Overstreet
<kent.overstreet@linux.dev>
Thu, 17 Oct 2024 05:10:49 +0000
(
01:10
-0400)
committer
Kent Overstreet
<kent.overstreet@linux.dev>
Fri, 18 Oct 2024 04:49:48 +0000
(
00:49
-0400)
Found by generic/299: When we have to truncate a write due to -ENOSPC,
we may have to read in the folio we're writing to if we're now no longer
doing a complete write to a !uptodate folio.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/fs-io-buffered.c
patch
|
blob
|
history
diff --git
a/fs/bcachefs/fs-io-buffered.c
b/fs/bcachefs/fs-io-buffered.c
index
48a1ab9
..
9597280
100644
(file)
--- a/
fs/bcachefs/fs-io-buffered.c
+++ b/
fs/bcachefs/fs-io-buffered.c
@@
-856,6
+856,12
@@
static int __bch2_buffered_write(struct bch_inode_info *inode,
folios_trunc(&fs, fi);
end = min(end, folio_end_pos(darray_last(fs)));
} else {
+ if (!folio_test_uptodate(f)) {
+ ret = bch2_read_single_folio(f, mapping);
+ if (ret)
+ goto out;
+ }
+
folios_trunc(&fs, fi + 1);
end = f_pos + f_reserved;
}