]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
UBIFS: Add an assertion for clean_zn_cnt
authorhujianyang <hujianyang@huawei.com>
Tue, 3 Jun 2014 06:49:11 +0000 (14:49 +0800)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Tue, 3 Jun 2014 08:16:51 +0000 (11:16 +0300)
This patch adds a new ubifs_assert() in ubifs_tnc_close() to check
if there are any leaks of per-filesystem @clean_zn_cnt. This new
assert inspects whether the return value of ubifs_destroy_tnc_subtree()
is equal to @clean_zn_cnt or not while umount.

Artem: a minor amendment

Signed-off-by: hujianyang <hujianyang@huawei.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
fs/ubifs/tnc.c

index 9083bc7ed4ae49f5d9550c20c1943400860114ab..8a40cf9c02d7057408a41b4215431a96f5171f04 100644 (file)
@@ -2859,10 +2859,11 @@ void ubifs_tnc_close(struct ubifs_info *c)
 {
        tnc_destroy_cnext(c);
        if (c->zroot.znode) {
-               long n;
+               long n, freed;
 
-               ubifs_destroy_tnc_subtree(c->zroot.znode);
                n = atomic_long_read(&c->clean_zn_cnt);
+               freed = ubifs_destroy_tnc_subtree(c->zroot.znode);
+               ubifs_assert(freed == n);
                atomic_long_sub(n, &ubifs_clean_zn_cnt);
        }
        kfree(c->gap_lebs);