]> git.apps.os.sepia.ceph.com Git - ceph-client.git/commit
ceph: perform asynchronous unlink if we have sufficient caps
authorJeff Layton <jlayton@kernel.org>
Tue, 2 Apr 2019 19:35:56 +0000 (15:35 -0400)
committerIlya Dryomov <idryomov@gmail.com>
Fri, 10 Jan 2020 10:11:07 +0000 (11:11 +0100)
commita99708fc1df3eebf67a3f38d3265c672dcbbd662
tree2a038ce0ee8095cf6c14b4f412333effc3f51f86
parent89bfcc7aabc5c925981e558936d501a7c9706d4a
ceph: perform asynchronous unlink if we have sufficient caps

The MDS is getting a new lock-caching facility that will allow it
to cache the necessary locks to allow asynchronous directory operations.
Since the CEPH_CAP_FILE_* caps are currently unused on directories,
we can repurpose those bits for this purpose.

When performing an unlink, if we have Fx on the parent directory,
and CEPH_CAP_DIR_UNLINK (aka Fr), and we know that the dentry being
removed is the primary link, then then we can fire off an unlink
request immediately and don't need to wait on reply before returning.

In that situation, just fix up the dcache and link count and return
immediately after issuing the call to the MDS. This does mean that we
need to hold an extra reference to the inode being unlinked, and extra
references to the caps to avoid races. Those references are put and
error handling is done in the r_callback routine.

If the operation ends up failing, then set a writeback error on the
directory inode that can be fetched later by an fsync on the dir.

Since this feature is very new, also add a new module parameter to
enable and disable it (default is disabled).

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
fs/ceph/caps.c
fs/ceph/dir.c
fs/ceph/inode.c
fs/ceph/super.c
fs/ceph/super.h
include/linux/ceph/ceph_fs.h