]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: issue new caps when sending reply to client 14743/head
authorYan, Zheng <zyan@redhat.com>
Sat, 22 Apr 2017 04:27:12 +0000 (12:27 +0800)
committerYan, Zheng <zyan@redhat.com>
Mon, 24 Apr 2017 02:58:38 +0000 (10:58 +0800)
After Locker::issue_new_caps() adds new Capability data struct,
do not issue caps immediately. Let CInode::encode_inodestate()
do the job instead. This can avoid various races that early reply
is not allowed, caps that haven't been sent to client gets revoked.

Fixes: http://tracker.ceph.com/issues/19635
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/Locker.cc
src/mds/Server.cc

index 58c8795b7a849435aed98a3770eed497de78ccf2..05c605d7362e8395a46d9e18b6d8825dd1134fb8 100644 (file)
@@ -1968,10 +1968,12 @@ bool Locker::issue_caps(CInode *in, Capability *only_cap)
             << " wanted " << ccap_string(wanted)
             << dendl;
 
-    // skip if suppress, and not revocation
-    if (cap->is_suppress() && !(pending & ~allowed)) {
-      dout(20) << "  suppressed and !revoke, skipping client." << it->first << dendl;
-      continue;
+    if (!(pending & ~allowed)) {
+      // skip if suppress or new, and not revocation
+      if (cap->is_new() || cap->is_suppress()) {
+       dout(20) << "  !revoke and new|suppressed, skipping client." << it->first << dendl;
+       continue;
+      }
     }
 
     // notify clients about deleted inode, to make sure they release caps ASAP.
index d62720b46096ad6f3559f006c1c02a42d946d546..73f33a438a11870bb1c79d3e85097d03dc384e51 100644 (file)
@@ -4780,9 +4780,6 @@ void Server::handle_client_mknod(MDRequestRef& mdr)
       newi->filelock.set_state(LOCK_EXCL);
       newi->authlock.set_state(LOCK_EXCL);
       newi->xattrlock.set_state(LOCK_EXCL);
-      cap->issue_norevoke(CEPH_CAP_AUTH_EXCL|CEPH_CAP_AUTH_SHARED|
-                         CEPH_CAP_XATTR_EXCL|CEPH_CAP_XATTR_SHARED|
-                         CEPH_CAP_ANY_FILE_WR);
     }
   }
 
@@ -4879,8 +4876,6 @@ void Server::handle_client_mkdir(MDRequestRef& mdr)
     newi->filelock.set_state(LOCK_EXCL);
     newi->authlock.set_state(LOCK_EXCL);
     newi->xattrlock.set_state(LOCK_EXCL);
-    cap->issue_norevoke(CEPH_CAP_AUTH_EXCL|CEPH_CAP_AUTH_SHARED|
-                       CEPH_CAP_XATTR_EXCL|CEPH_CAP_XATTR_SHARED);
   }
 
   // make sure this inode gets into the journal