Skip to content

Commit 380347e

Browse files
hujianyangdedekind
authored andcommitted
UBIFS: Add an assertion for clean_zn_cnt
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>
1 parent 90bea5a commit 380347e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎fs/ubifs/tnc.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2859,10 +2859,11 @@ void ubifs_tnc_close(struct ubifs_info *c)
28592859
{
28602860
tnc_destroy_cnext(c);
28612861
if (c->zroot.znode) {
2862-
long n;
2862+
long n, freed;
28632863

2864-
ubifs_destroy_tnc_subtree(c->zroot.znode);
28652864
n = atomic_long_read(&c->clean_zn_cnt);
2865+
freed = ubifs_destroy_tnc_subtree(c->zroot.znode);
2866+
ubifs_assert(freed == n);
28662867
atomic_long_sub(n, &ubifs_clean_zn_cnt);
28672868
}
28682869
kfree(c->gap_lebs);

0 commit comments

Comments
 (0)