]> git.apps.os.sepia.ceph.com Git - ceph-client.git/commit
ceph: wait the first reply of inflight async unlink
authorXiubo Li <xiubli@redhat.com>
Tue, 10 May 2022 01:47:01 +0000 (09:47 +0800)
committerJeff Layton <jlayton@kernel.org>
Tue, 31 May 2022 14:44:35 +0000 (10:44 -0400)
commitd83cff47828a199b7d91c74a10f7f70dce8718f3
tree89d63923b1359c42d78d3cef1888cf782ea93c56
parentae2b4588de11db5d9186f4e4ae581fd4630560f5
ceph: wait the first reply of inflight async unlink

In async unlink case the kclient won't wait for the first reply
from MDS and just drop all the links and unhash the dentry and then
succeeds immediately.

For any new create/link/rename,etc requests followed by using the
same file names we must wait for the first reply of the inflight
unlink request, or the MDS possibly will fail these following
requests with -EEXIST if the inflight async unlink request was
delayed for some reasons.

And the worst case is that for the none async openc request it will
successfully open the file if the CDentry hasn't been unlinked yet,
but later the previous delayed async unlink request will remove the
CDenty. That means the just created file is possiblly deleted later
by accident.

We need to wait for the inflight async unlink requests to finish
when creating new files/directories by using the same file names.

[ xiubli: fixed the build warning reported by kernel test rotot]

URL: https://tracker.ceph.com/issues/55332
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Xiubo Li <xiubli@redhat.com>
fs/ceph/dir.c
fs/ceph/file.c
fs/ceph/mds_client.c
fs/ceph/mds_client.h
fs/ceph/super.c
fs/ceph/super.h