From a069f014797fdef8757f3adebc1c16416271a599 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Sun, 20 Oct 2024 18:00:13 -0400 Subject: [PATCH] bcachefs: Set bch_inode_unpacked.bi_snapshot in old inode path MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This fixes a fsck bug on a very old filesystem (pre mainline merge). Fixes: 72350ee0ea22 ("bcachefs: Kill snapshot arg to fsck_write_inode()") Reported-by: Marcin Mirosław Signed-off-by: Kent Overstreet --- fs/bcachefs/inode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/bcachefs/inode.c b/fs/bcachefs/inode.c index b9fde1566df1..6b7143e6abca 100644 --- a/fs/bcachefs/inode.c +++ b/fs/bcachefs/inode.c @@ -283,6 +283,8 @@ static noinline int bch2_inode_unpack_slowpath(struct bkey_s_c k, { memset(unpacked, 0, sizeof(*unpacked)); + unpacked->bi_snapshot = k.k->p.snapshot; + switch (k.k->type) { case KEY_TYPE_inode: { struct bkey_s_c_inode inode = bkey_s_c_to_inode(k); -- 2.34.1