]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: assert cap refs don't go negative
authorSage Weil <sage@inktank.com>
Fri, 9 Nov 2012 14:06:42 +0000 (06:06 -0800)
committerSage Weil <sage@inktank.com>
Fri, 9 Nov 2012 15:38:42 +0000 (07:38 -0800)
This is the root cause of #3470.

Signed-off-by: Sage Weil <sage@inktank.com>
src/client/Inode.cc

index fc2b03f00d089741e99a1131695f06e0ebdbfb40..c436fe4be14bc2256167bb5f4dedd7a0d555b57c 100644 (file)
@@ -115,6 +115,10 @@ bool Inode::put_cap_ref(int cap)
   while (cap) {
     if (cap & 1) {
       int c = 1 << n;
+      if (cap_refs[c] <= 0) {
+       lderr(cct) << "put_cap_ref " << ccap_string(c) << " went negative on " << *this << dendl;
+       assert(cap_refs[c] > 0);
+      }
       if (--cap_refs[c] == 0)
        last = true;      
       //cout << "inode " << *this << " put " << cap_string(c) << " " << (cap_refs[c]+1) << " -> " << cap_refs[c] << std::endl;