summaryrefslogtreecommitdiffstats
path: root/fs/ceph/caps.c
diff options
context:
space:
mode:
authorYan, Zheng <zyan@redhat.com>2018-12-04 22:29:35 -0500
committerIlya Dryomov <idryomov@gmail.com>2018-12-26 10:08:36 -0500
commit8a2ac3a8e9c04018e2bbff9d6ff038507e443e75 (patch)
tree7fb95a07ab2c376b3e2bd553112482454633d5f8 /fs/ceph/caps.c
parent3c1392d4c49962a31874af14ae9ff289cb2b3851 (diff)
ceph: don't request excl caps when mount is readonly
Signed-off-by: "Yan, Zheng" <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r--fs/ceph/caps.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index a58666a3f8dd..e7af6479c9bc 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -1855,14 +1855,17 @@ retry_locked:
1855 retain |= CEPH_CAP_ANY; /* be greedy */ 1855 retain |= CEPH_CAP_ANY; /* be greedy */
1856 } else if (S_ISDIR(inode->i_mode) && 1856 } else if (S_ISDIR(inode->i_mode) &&
1857 (issued & CEPH_CAP_FILE_SHARED) && 1857 (issued & CEPH_CAP_FILE_SHARED) &&
1858 __ceph_dir_is_complete(ci)) { 1858 __ceph_dir_is_complete(ci)) {
1859 /* 1859 /*
1860 * If a directory is complete, we want to keep 1860 * If a directory is complete, we want to keep
1861 * the exclusive cap. So that MDS does not end up 1861 * the exclusive cap. So that MDS does not end up
1862 * revoking the shared cap on every create/unlink 1862 * revoking the shared cap on every create/unlink
1863 * operation. 1863 * operation.
1864 */ 1864 */
1865 want = CEPH_CAP_ANY_SHARED | CEPH_CAP_FILE_EXCL; 1865 if (IS_RDONLY(inode))
1866 want = CEPH_CAP_ANY_SHARED;
1867 else
1868 want = CEPH_CAP_ANY_SHARED | CEPH_CAP_FILE_EXCL;
1866 retain |= want; 1869 retain |= want;
1867 } else { 1870 } else {
1868 1871