Commit 8a2ac3a8 authored by Yan, Zheng's avatar Yan, Zheng Committed by Ilya Dryomov

ceph: don't request excl caps when mount is readonly

Signed-off-by: default avatar"Yan, Zheng" <zyan@redhat.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent 3c1392d4
...@@ -1855,14 +1855,17 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags, ...@@ -1855,14 +1855,17 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
retain |= CEPH_CAP_ANY; /* be greedy */ retain |= CEPH_CAP_ANY; /* be greedy */
} else if (S_ISDIR(inode->i_mode) && } else if (S_ISDIR(inode->i_mode) &&
(issued & CEPH_CAP_FILE_SHARED) && (issued & CEPH_CAP_FILE_SHARED) &&
__ceph_dir_is_complete(ci)) { __ceph_dir_is_complete(ci)) {
/* /*
* If a directory is complete, we want to keep * If a directory is complete, we want to keep
* the exclusive cap. So that MDS does not end up * the exclusive cap. So that MDS does not end up
* revoking the shared cap on every create/unlink * revoking the shared cap on every create/unlink
* operation. * 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; retain |= want;
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment