bcachefs: Fix compat path for old inode formats
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 3 Dec 2022 20:44:54 +0000 (15:44 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:49 +0000 (17:09 -0400)
Old inode formats don't have all the fields of the current inode format:
when unpacking inodes in the current format we can thus skip zeroing out
the destination buffer, but that doesn't work on for the old formats.

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

index 141cf21e29511f1c75a9bef3a6d3d0273f958b25..6e7ba2e6fe338dc6aede0ef2a0e35bcc4255b0ea 100644 (file)
@@ -213,6 +213,8 @@ static int bch2_inode_unpack_v2(struct bch_inode_unpacked *unpacked,
 int bch2_inode_unpack(struct bkey_s_c k,
                      struct bch_inode_unpacked *unpacked)
 {
+       memset(unpacked, 0, sizeof(*unpacked));
+
        switch (k.k->type) {
        case KEY_TYPE_inode: {
                struct bkey_s_c_inode inode = bkey_s_c_to_inode(k);