summaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorYan, Zheng <zyan@redhat.com>2015-03-26 19:06:00 +0800
committerIlya Dryomov <idryomov@gmail.com>2015-04-20 18:55:40 +0300
commit32ec4397756d072873ee778cbf41b9f6a335b953 (patch)
tree62676c063034560d0967b64676a2d6e63ea3fbe2 /fs/ceph
parent9571eb4f9617e89b3f979a3856b1296eba277bb1 (diff)
downloadop-kernel-dev-32ec4397756d072873ee778cbf41b9f6a335b953.zip
op-kernel-dev-32ec4397756d072873ee778cbf41b9f6a335b953.tar.gz
ceph: hold on to exclusive caps on complete directories
If a directory is complete, we want to keep the exclusive cap. So that MDS does not end up revoking the shared cap on every create/unlink operation. Signed-off-by: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/caps.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 37a4235..11631c4 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -1561,7 +1561,19 @@ retry_locked:
if (!mdsc->stopping && inode->i_nlink > 0) {
if (want) {
retain |= CEPH_CAP_ANY; /* be greedy */
+ } else if (S_ISDIR(inode->i_mode) &&
+ (issued & CEPH_CAP_FILE_SHARED) &&
+ __ceph_dir_is_complete(ci)) {
+ /*
+ * If a directory is complete, we want to keep
+ * the exclusive cap. So that MDS does not end up
+ * revoking the shared cap on every create/unlink
+ * operation.
+ */
+ want = CEPH_CAP_ANY_SHARED | CEPH_CAP_FILE_EXCL;
+ retain |= want;
} else {
+
retain |= CEPH_CAP_ANY_SHARED;
/*
* keep RD only if we didn't have the file open RW,
OpenPOWER on IntegriCloud