summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorYan, Zheng <zyan@redhat.com>2018-12-05 11:29:35 +0800
committerIlya Dryomov <idryomov@gmail.com>2018-12-26 16:08:36 +0100
commit8a2ac3a8e9c04018e2bbff9d6ff038507e443e75 (patch)
tree7fb95a07ab2c376b3e2bd553112482454633d5f8 /fs
parent3c1392d4c49962a31874af14ae9ff289cb2b3851 (diff)
downloadlinux-8a2ac3a8e9c04018e2bbff9d6ff038507e443e75.tar.gz
linux-8a2ac3a8e9c04018e2bbff9d6ff038507e443e75.tar.bz2
linux-8a2ac3a8e9c04018e2bbff9d6ff038507e443e75.zip
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')
-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:
retain |= CEPH_CAP_ANY; /* be greedy */
} else if (S_ISDIR(inode->i_mode) &&
(issued & CEPH_CAP_FILE_SHARED) &&
- __ceph_dir_is_complete(ci)) {
+ __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;
+ if (IS_RDONLY(inode))
+ want = CEPH_CAP_ANY_SHARED;
+ else
+ want = CEPH_CAP_ANY_SHARED | CEPH_CAP_FILE_EXCL;
retain |= want;
} else {