]> git.baikalelectronics.ru Git - kernel.git/commit
ceph: fail the open_by_handle_at() if the dentry is being unlinked
authorXiubo Li <xiubli@redhat.com>
Tue, 30 Aug 2022 14:49:36 +0000 (22:49 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Tue, 4 Oct 2022 17:18:08 +0000 (19:18 +0200)
commit5fd3efebf6949c452b74c5659294149f816d3102
treea5135004ff90211720296441ef8fbce179c0d7b1
parent7ce7984e9fdc0b46406b07a8747637b6b118dc3f
ceph: fail the open_by_handle_at() if the dentry is being unlinked

When unlinking a file the kclient will send a unlink request to MDS
by holding the dentry reference, and then the MDS will return 2 replies,
which are unsafe reply and a deferred safe reply.

After the unsafe reply received the kernel will return and succeed
the unlink request to user space apps.

Only when the safe reply received the dentry's reference will be
released. Or the dentry will only be unhashed from dcache. But when
the open_by_handle_at() begins to open the unlinked files it will
succeed.

The inode->i_count couldn't be used to check whether the inode is
opened or not.

Link: https://tracker.ceph.com/issues/56524
Signed-off-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Luís Henriques <lhenriques@suse.de>
Tested-by: Luís Henriques <lhenriques@suse.de>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/export.c