summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-09-30 11:09:26 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:13 -0400
commitea0531f84eec65a1204a13167965bc151e0f072c (patch)
tree2125ef289735ed2c5bca39bfed101a42a09fd33c /fs
parent0476fa948e6fac0b7fa04b5bb0ed30631cbf50ea (diff)
downloadlinux-stable-ea0531f84eec65a1204a13167965bc151e0f072c.tar.gz
linux-stable-ea0531f84eec65a1204a13167965bc151e0f072c.tar.bz2
linux-stable-ea0531f84eec65a1204a13167965bc151e0f072c.zip
bcachefs: Fix check_inode_update_hardlinks()
We were incorrectly using bch2_inode_write(), which gets the snapshot ID from the iterator, with a BTREE_ITER_ALL_SNAPSHOTS iterator - fortunately caught by an assertion in the update path. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/fsck.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c
index 16a1eae9b374..3622fb4d18e2 100644
--- a/fs/bcachefs/fsck.c
+++ b/fs/bcachefs/fsck.c
@@ -2094,11 +2094,7 @@ static int check_nlinks_update_hardlinks(struct bch_fs *c,
bch2_inode_nlink_get(&u), link->count)) {
bch2_inode_nlink_set(&u, link->count);
- ret = __bch2_trans_do(&trans, NULL, NULL,
- BTREE_INSERT_NOFAIL|
- BTREE_INSERT_LAZY_RW,
- bch2_btree_iter_traverse(&iter) ?:
- bch2_inode_write(&trans, &iter, &u));
+ ret = write_inode(&trans, &u, k.k->p.snapshot);
if (ret)
bch_err(c, "error in fsck: error %i updating inode", ret);
}