]> git.itanic.dy.fi Git - linux-stable/commit
f2fs: fix to use inline space only if inline_xattr is enable
authorChao Yu <yuchao0@huawei.com>
Thu, 11 Apr 2019 03:48:10 +0000 (11:48 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 15 Jun 2019 09:54:04 +0000 (11:54 +0200)
commit101e48feb661fa2dfd829b83bf3eb71b45fabe30
tree47ae059b35ee5e72f18dfbc30960ee0644349b8a
parent45624f0e8142470724227292603f9a8fd72cc1d6
f2fs: fix to use inline space only if inline_xattr is enable

[ Upstream commit 622927f3b8809206f6da54a6a7ed4df1a7770fce ]

With below mkfs and mount option:

MKFS_OPTIONS  -- -O extra_attr -O project_quota -O inode_checksum -O flexible_inline_xattr -O inode_crtime -f
MOUNT_OPTIONS -- -o noinline_xattr

We may miss xattr data with below testcase:
- mkdir dir
- setfattr -n "user.name" -v 0 dir
- for ((i = 0; i < 190; i++)) do touch dir/$i; done
- umount
- mount
- getfattr -n "user.name" dir

user.name: No such attribute

The root cause is that we persist xattr data into reserved inline xattr
space, even if inline_xattr is not enable in inline directory inode, after
inline dentry conversion, reserved space no longer exists, so that xattr
data missed.

Let's use inline xattr space only if inline_xattr flag is set on inode
to fix this iusse.

Fixes: 6afc662e68b5 ("f2fs: support flexible inline xattr size")
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/f2fs.h