f2fs: set I_LINKABLE early to avoid wrong access by vfs
authorJaegeuk Kim <jaegeuk@kernel.org>
Sat, 7 Dec 2019 00:59:58 +0000 (16:59 -0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 15 Jan 2020 21:43:48 +0000 (13:43 -0800)
commit5b1dbb082f196278f82b6a15a13848efacb9ff11
tree54007e6b2c4e8fc95122516e0c8254a505c7dab1
parent542989b6749b69e9de59a9d41a9ee9af7dbb1986
f2fs: set I_LINKABLE early to avoid wrong access by vfs

This patch moves setting I_LINKABLE early in rename2(whiteout) to avoid the
below warning.

[ 3189.163385] WARNING: CPU: 3 PID: 59523 at fs/inode.c:358 inc_nlink+0x32/0x40
[ 3189.246979] Call Trace:
[ 3189.248707]  f2fs_init_inode_metadata+0x2d6/0x440 [f2fs]
[ 3189.251399]  f2fs_add_inline_entry+0x162/0x8c0 [f2fs]
[ 3189.254010]  f2fs_add_dentry+0x69/0xe0 [f2fs]
[ 3189.256353]  f2fs_do_add_link+0xc5/0x100 [f2fs]
[ 3189.258774]  f2fs_rename2+0xabf/0x1010 [f2fs]
[ 3189.261079]  vfs_rename+0x3f8/0xaa0
[ 3189.263056]  ? tomoyo_path_rename+0x44/0x60
[ 3189.265283]  ? do_renameat2+0x49b/0x550
[ 3189.267324]  do_renameat2+0x49b/0x550
[ 3189.269316]  __x64_sys_renameat2+0x20/0x30
[ 3189.271441]  do_syscall_64+0x5a/0x230
[ 3189.273410]  entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 3189.275848] RIP: 0033:0x7f270b4d9a49

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/namei.c