]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
f2fs: fix to adapt small inline xattr space in __find_inline_xattr()
authorChao Yu <yuchao0@huawei.com>
Tue, 5 Mar 2019 11:32:26 +0000 (19:32 +0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commitb5fa037b1f06f30d1fcf343fc02ca169c3122311
treeabc90feec2c7aa7f5a7c5b70ac84ead4f68503b9
parentd17b5e733eaa0820ae9f04e71b3c5ef329187c9d
f2fs: fix to adapt small inline xattr space in __find_inline_xattr()

BugLink: https://bugs.launchpad.net/bugs/1838116
[ Upstream commit 2c28aba8b2e2a51749fa66e01b68e1cd5b53e022 ]

With below testcase, we will fail to find existed xattr entry:

1. mkfs.f2fs -O extra_attr -O flexible_inline_xattr /dev/zram0
2. mount -t f2fs -o inline_xattr_size=1 /dev/zram0 /mnt/f2fs/
3. touch /mnt/f2fs/file
4. setfattr -n "user.name" -v 0 /mnt/f2fs/file
5. getfattr -n "user.name" /mnt/f2fs/file

/mnt/f2fs/file: user.name: No such attribute

The reason is for inode which has very small inline xattr size,
__find_inline_xattr() will fail to traverse any entry due to first
entry may not be loaded from xattr node yet, later, we may skip to
check entire xattr datas in __find_xattr(), result in such wrong
condition.

This patch adds condition to check such case to avoid this issue.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/f2fs/xattr.c