From: Yan, Zheng Date: Thu, 26 Mar 2015 11:06:00 +0000 (+0800) Subject: ceph: hold on to exclusive caps on complete directories X-Git-Tag: firefly_0821_release~176^2~1882^2~8 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=32ec4397756d072873ee778cbf41b9f6a335b953;p=firefly-linux-kernel-4.4.55.git 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 --- diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 37a42353b983..11631c4c7d14 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,