Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Btrfs: zero unused bytes in inode item

The otime field is not zeroed, so users will see random otime in an old
filesystem with a new kernel which has otime support in the future.

The reserved bytes are also not zeroed, and we'll have compatibility
issue if we make use of those bytes.

Signed-off-by: Li Zefan <lizefan@huawei.com>

authored by

Li Zefan and committed by
Chris Mason
293f7e07 b4d7c3c9

+3
+1
fs/btrfs/delayed-inode.c
··· 62 62 INIT_LIST_HEAD(&delayed_node->n_list); 63 63 INIT_LIST_HEAD(&delayed_node->p_list); 64 64 delayed_node->bytes_reserved = 0; 65 + memset(&delayed_node->inode_item, 0, sizeof(delayed_node->inode_item)); 65 66 } 66 67 67 68 static inline int btrfs_is_continuous_delayed_item(
+2
fs/btrfs/inode.c
··· 4693 4693 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 4694 4694 inode_item = btrfs_item_ptr(path->nodes[0], path->slots[0], 4695 4695 struct btrfs_inode_item); 4696 + memset_extent_buffer(path->nodes[0], 0, (unsigned long)inode_item, 4697 + sizeof(*inode_item)); 4696 4698 fill_inode_item(trans, path->nodes[0], inode_item, inode); 4697 4699 4698 4700 ref = btrfs_item_ptr(path->nodes[0], path->slots[0] + 1,