]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/SessionMap: explicitly require importing_count to be postive
authorxie xingguo <xie.xingguo@zte.com.cn>
Tue, 14 Jun 2016 02:24:28 +0000 (10:24 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 14 Jun 2016 02:31:20 +0000 (10:31 +0800)
The importing_count is of type int, thus it can go underflow and
assert(importing_count) can still return false positive while it
should not supposed to do so.

Also this can make the assert itself more sensitive, e.g., can
catch underflow errors.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/mds/SessionMap.h

index dee8ffbf3cc91132b9466260a0436486affccfbd..3ab7be65c8334865330ba529c74f013b5f74cdd4 100644 (file)
@@ -186,7 +186,7 @@ public:
     ++importing_count;
   }
   void dec_importing() {
-    assert(importing_count);
+    assert(importing_count > 0);
     --importing_count;
   }
   bool is_importing() { return importing_count > 0; }