From de8bc250b9b9495739ebf23f5fb6778c20e03577 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Tue, 14 Jun 2016 10:24:28 +0800 Subject: [PATCH] mds/SessionMap: explicitly require importing_count to be postive 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 --- src/mds/SessionMap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mds/SessionMap.h b/src/mds/SessionMap.h index dee8ffbf3cc91..3ab7be65c8334 100644 --- a/src/mds/SessionMap.h +++ b/src/mds/SessionMap.h @@ -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; } -- 2.39.5