]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: properly drop wrlock when finishing snapflush
authorYan, Zheng <zyan@redhat.com>
Wed, 2 Aug 2017 07:07:31 +0000 (15:07 +0800)
committerYan, Zheng <zyan@redhat.com>
Wed, 16 Aug 2017 08:40:23 +0000 (16:40 +0800)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/Locker.cc

index b82beb4e2158b024230bdf93296ffad72abdb96c..a75110e59664d877eb0fd0f1538ab3d26cb8b2b4 100644 (file)
@@ -1830,18 +1830,21 @@ void Locker::file_update_finish(CInode *in, MutationRef& mut, bool share_max, bo
     bool gather = false;
     compact_map<int,set<client_t> >::iterator p = in->client_snap_caps.begin();
     while (p != in->client_snap_caps.end()) {
-      SimpleLock *lock = in->get_lock(p->first);
-      assert(lock);
-      dout(10) << " completing client_snap_caps for " << ccap_string(p->first)
-              << " lock " << *lock << " on " << *in << dendl;
-      lock->put_wrlock();
-
-      p->second.erase(client);
-      if (p->second.empty()) {
-       gather = true;
-       in->client_snap_caps.erase(p++);
-      } else
-       ++p;
+      auto q = p->second.find(client);
+      if (q != p->second.end()) {
+       SimpleLock *lock = in->get_lock(p->first);
+       assert(lock);
+       dout(10) << " completing client_snap_caps for " << ccap_string(p->first)
+                << " lock " << *lock << " on " << *in << dendl;
+       lock->put_wrlock();
+
+       p->second.erase(q);
+       if (p->second.empty()) {
+         gather = true;
+         in->client_snap_caps.erase(p++);
+       } else
+         ++p;
+      }
     }
     if (gather) {
       if (in->client_snap_caps.empty())