]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: don't exclude disallowed caps when recording wanted caps
authorYan, Zheng <zyan@redhat.com>
Thu, 29 Nov 2018 03:00:59 +0000 (11:00 +0800)
committerJos Collin <jcollin@redhat.com>
Sat, 22 Dec 2018 04:09:47 +0000 (09:39 +0530)
Excluding caps (that replica inode disallows) make client and mds
have different view of wanted caps. It causes problem in some corner
cases of subtree migration.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Fixes: http://tracker.ceph.com/issues/37464
(cherry picked from commit 5a39f1d5c609fe86a9c12aaeaf925139fb56b5b1)

src/mds/Locker.cc

index ae95f0257439c43c717f43ca12052821c4400440..4c75f405730ae3e9797dc2526ad48b71f397df6b 100644 (file)
@@ -2240,7 +2240,7 @@ void Locker::request_inode_file_caps(CInode *in)
 {
   assert(!in->is_auth());
 
-  int wanted = in->get_caps_wanted() & ~CEPH_CAP_PIN;
+  int wanted = in->get_caps_wanted() & in->get_caps_allowed_ever() & ~CEPH_CAP_PIN;
   if (wanted != in->replica_caps_wanted) {
     // wait for single auth
     if (in->is_ambiguous_auth()) {
@@ -2932,9 +2932,9 @@ void Locker::handle_client_caps(MClientCaps *m)
 
     // filter wanted based on what we could ever give out (given auth/replica status)
     bool need_flush = m->flags & MClientCaps::FLAG_SYNC;
-    int new_wanted = m->get_wanted() & head_in->get_caps_allowed_ever();
+    int new_wanted = m->get_wanted();
     if (new_wanted != cap->wanted()) {
-      if (!need_flush && (new_wanted & ~cap->pending())) {
+      if (!need_flush && in->is_auth() && (new_wanted & ~cap->pending())) {
        // exapnding caps.  make sure we aren't waiting for a log flush
        need_flush = _need_flush_mdlog(head_in, new_wanted & ~cap->pending());
       }