summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorLi Zefan2012-07-10 08:58:58 +0200
committerChris Mason2012-07-23 22:28:05 +0200
commit293f7e07405a63975cee4e95a2cfa0c17b34b3aa (patch)
tree33ce221bd3be09a834f7bfeee1a8d38e399510cd /fs/btrfs/inode.c
parentBtrfs: kill free_space pointer from inode structure (diff)
downloadkernel-qcow2-linux-293f7e07405a63975cee4e95a2cfa0c17b34b3aa.tar.gz
kernel-qcow2-linux-293f7e07405a63975cee4e95a2cfa0c17b34b3aa.tar.xz
kernel-qcow2-linux-293f7e07405a63975cee4e95a2cfa0c17b34b3aa.zip
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>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index ee45ebf42192..144f4642b2a9 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4693,6 +4693,8 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
inode_item = btrfs_item_ptr(path->nodes[0], path->slots[0],
struct btrfs_inode_item);
+ memset_extent_buffer(path->nodes[0], 0, (unsigned long)inode_item,
+ sizeof(*inode_item));
fill_inode_item(trans, path->nodes[0], inode_item, inode);
ref = btrfs_item_ptr(path->nodes[0], path->slots[0] + 1,