diff options
author | Yan, Zheng <zyan@redhat.com> | 2017-11-23 12:47:15 +0300 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2018-01-29 20:36:04 +0300 |
commit | 222b7f90ba3825728fd27e9105aeee7af9576819 (patch) | |
tree | 8cbfe764c0bfd8bbdbcf399d75c4c24aac9d4b89 /fs/ceph/caps.c | |
parent | e573427a440fd67d3f522357d7ac901d59281948 (diff) | |
download | linux-222b7f90ba3825728fd27e9105aeee7af9576819.tar.xz |
ceph: voluntarily drop Ax cap for requests that create new inode
MDS need to rdlock directory inode's authlock when handling these
requests. Voluntarily dropping CEPH_CAP_AUTH_EXCL avoids a cap revoke
message.
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.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index a14b2c974c9e..029cab713731 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -3939,11 +3939,20 @@ int ceph_encode_inode_release(void **p, struct inode *inode, cap = __get_cap_for_mds(ci, mds); if (cap && __cap_is_valid(cap)) { - if (force || - ((cap->issued & drop) && - (cap->issued & unless) == 0)) { - if ((cap->issued & drop) && - (cap->issued & unless) == 0) { + unless &= cap->issued; + if (unless) { + if (unless & CEPH_CAP_AUTH_EXCL) + drop &= ~CEPH_CAP_AUTH_SHARED; + if (unless & CEPH_CAP_LINK_EXCL) + drop &= ~CEPH_CAP_LINK_SHARED; + if (unless & CEPH_CAP_XATTR_EXCL) + drop &= ~CEPH_CAP_XATTR_SHARED; + if (unless & CEPH_CAP_FILE_EXCL) + drop &= ~CEPH_CAP_FILE_SHARED; + } + + if (force || (cap->issued & drop)) { + if (cap->issued & drop) { int wanted = __ceph_caps_wanted(ci); if ((ci->i_ceph_flags & CEPH_I_NODELAY) == 0) wanted |= cap->mds_wanted; @@ -3975,7 +3984,7 @@ int ceph_encode_inode_release(void **p, struct inode *inode, *p += sizeof(*rel); ret = 1; } else { - dout("encode_inode_release %p cap %p %s\n", + dout("encode_inode_release %p cap %p %s (noop)\n", inode, cap, ceph_cap_string(cap->issued)); } } |