summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-11-09 17:20:06 -0500
committerKent Overstreet <kent.overstreet@gmail.com>2022-03-12 20:13:31 -0500
commitb9a4ac484d8647ab25b97f256ee9f7bd6fb1e2b9 (patch)
tree6722045389e17e91e4d91d0b099ea8df84e848f5
parentaabf4783a537608e9d05cb4ddd7e5a3db7f1b38a (diff)
bcachefs: Inode updates should generally be BTREE_INSERT_NOFAIL
This fixes a bug where i_size may become inconsistent between the VFS cache and the btree, when the filesystem is nearly full. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r--fs/bcachefs/reflink.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/bcachefs/reflink.c b/fs/bcachefs/reflink.c
index d003f4088dfc..22230f82b8b9 100644
--- a/fs/bcachefs/reflink.c
+++ b/fs/bcachefs/reflink.c
@@ -347,7 +347,8 @@ s64 bch2_remap_range(struct bch_fs *c,
inode_u.bi_size < new_i_size) {
inode_u.bi_size = new_i_size;
ret2 = bch2_inode_write(&trans, &inode_iter, &inode_u) ?:
- bch2_trans_commit(&trans, NULL, NULL, 0);
+ bch2_trans_commit(&trans, NULL, NULL,
+ BTREE_INSERT_NOFAIL);
}
bch2_trans_iter_exit(&trans, &inode_iter);