]> 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)
committerYan, Zheng <zyan@redhat.com>
Thu, 29 Nov 2018 07:43:37 +0000 (15:43 +0800)
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
src/mds/Locker.cc

index 8ea4043db2c45c3741a045bae86dea4c04fcaca2..d1599b51e63396e107ab484bc723c12430c6ee51 100644 (file)
@@ -2211,7 +2211,7 @@ void Locker::request_inode_file_caps(CInode *in)
 {
   ceph_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()) {
@@ -2889,9 +2889,9 @@ void Locker::handle_client_caps(const MClientCaps::const_ref &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());
       }