]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: ignore MClientCaps::FLAG_NO_CAPSNAP
authorYan, Zheng <zyan@redhat.com>
Fri, 5 Jan 2018 01:25:43 +0000 (09:25 +0800)
committerYan, Zheng <zyan@redhat.com>
Wed, 10 Jan 2018 02:24:44 +0000 (10:24 +0800)
checking the flags is racy because client may create cap snap after
sending cap message

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/client/Client.cc
src/mds/Locker.cc
src/messages/MClientCaps.h

index 4c296f76aba0bad328550c52dfa668683883a441..d0e2b9b37f438d13009a83f7652fc1375ad2a526 100644 (file)
@@ -3296,9 +3296,7 @@ void Client::send_cap(Inode *in, MetaSession *session, Cap *cap,
   m->change_attr = in->change_attr;
   if (sync)
     m->flags |= MClientCaps::FLAG_SYNC;
-  if (in->cap_snaps.empty())
-    m->flags |= MClientCaps::FLAG_NO_CAPSNAP;
-  else
+  if (!in->cap_snaps.empty())
     m->flags |= MClientCaps::FLAG_PENDING_CAPSNAP;
     
   if (flush & CEPH_CAP_FILE_WR) {
index 018c6333d1bf42f64f41f7c3aaaa0a63caa3d125..df65779239fc989e33bf7597ead3f322e02d9252 100644 (file)
@@ -2883,9 +2883,8 @@ void Locker::handle_client_caps(MClientCaps *m)
     //  released all WR/EXCL caps (the FLUSHSNAP always comes before the cap
     //  update/release).
     if (!head_in->client_need_snapflush.empty()) {
-      if ((m->flags & MClientCaps::FLAG_NO_CAPSNAP) ||
-         (!(cap->issued() & CEPH_CAP_ANY_FILE_WR) &&
-          !(m->flags & MClientCaps::FLAG_PENDING_CAPSNAP))) {
+      if (!(cap->issued() & CEPH_CAP_ANY_FILE_WR) &&
+         !(m->flags & MClientCaps::FLAG_PENDING_CAPSNAP)) {
        head_in->auth_pin(this); // prevent subtree frozen
        need_unpin = true;
        _do_null_snapflush(head_in, client);
@@ -2893,7 +2892,7 @@ void Locker::handle_client_caps(MClientCaps *m)
        dout(10) << " revocation in progress, not making any conclusions about null snapflushes" << dendl;
       }
     }
-    if (cap->need_snapflush() && (m->flags & MClientCaps::FLAG_NO_CAPSNAP))
+    if (cap->need_snapflush() && !(m->flags & MClientCaps::FLAG_PENDING_CAPSNAP))
       cap->clear_needsnapflush();
     
     if (m->get_dirty() && in->is_auth()) {
index acc6242ccf78f298c2d26846aa543222ff0114a1..f57797e641ec6330d091b4363740dd45017184f7 100644 (file)
@@ -24,7 +24,7 @@ class MClientCaps : public Message {
 
  public:
   static const unsigned FLAG_SYNC              = (1<<0);
-  static const unsigned FLAG_NO_CAPSNAP                = (1<<1);
+  static const unsigned FLAG_NO_CAPSNAP                = (1<<1); // unused
   static const unsigned FLAG_PENDING_CAPSNAP   = (1<<2);
 
   struct ceph_mds_caps_head head;