bcachefs: Fix missing field initialization
authorKent Overstreet <kent.overstreet@gmail.com>
Sat, 13 Nov 2021 22:57:52 +0000 (17:57 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:17 +0000 (17:09 -0400)
When unpacking v1 inodes, we were failing to initialize the journal_seq
field, leading to a BUG_ON() when fsync tries to flush a garbage journal
sequence number.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/inode.c

index a24bbc5228c1bf4926947fefb3e4daaac24c2d19..fb5ed3a07ad75673488f91bd0343b934e4c239c0 100644 (file)
@@ -220,6 +220,7 @@ int bch2_inode_unpack(struct bkey_s_c k,
                struct bkey_s_c_inode inode = bkey_s_c_to_inode(k);
 
                unpacked->bi_inum       = inode.k->p.offset;
+               unpacked->bi_journal_seq= 0;
                unpacked->bi_hash_seed  = inode.v->bi_hash_seed;
                unpacked->bi_flags      = le32_to_cpu(inode.v->bi_flags);
                unpacked->bi_mode       = le16_to_cpu(inode.v->bi_mode);