]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: issue new caps when sending reply to client 16191/head
authorYan, Zheng <zyan@redhat.com>
Sat, 22 Apr 2017 04:27:12 +0000 (12:27 +0800)
committerNathan Cutler <ncutler@suse.com>
Thu, 6 Jul 2017 20:20:31 +0000 (22:20 +0200)
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>
(cherry picked from commit 799703a4acb49db0b6cc99a23e4326767e694c3a)

src/mds/Locker.cc
src/mds/Server.cc

index accf99843b5a78689b16167b73b8823173d71451..fe4980a67995d48babbcd06f4ff4ca99cb9f2ae6 100644 (file)
@@ -1916,10 +1916,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 007ee12802ee0c6e3ba49c44542eb105e933f0a5..1f903be93f394fc2fed510c2491ea961e18f4bdc 100644 (file)
@@ -4724,9 +4724,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);
     }
   }
 
@@ -4823,8 +4820,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