diff options
author | hujianyang <hujianyang@huawei.com> | 2014-06-03 02:49:11 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2014-06-03 04:16:51 -0400 |
commit | 380347e9ca76828ee9bac63cfc338ca99cdee4f3 (patch) | |
tree | 8e9a89a8e393338524ec0ddf2e856b437b91c17e /fs | |
parent | 90bea5a3f0bf680b87b90516f3c231997f4b8f3b (diff) |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ubifs/tnc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c index 9083bc7ed4ae..8a40cf9c02d7 100644 --- a/fs/ubifs/tnc.c +++ b/fs/ubifs/tnc.c | |||
@@ -2859,10 +2859,11 @@ void ubifs_tnc_close(struct ubifs_info *c) | |||
2859 | { | 2859 | { |
2860 | tnc_destroy_cnext(c); | 2860 | tnc_destroy_cnext(c); |
2861 | if (c->zroot.znode) { | 2861 | if (c->zroot.znode) { |
2862 | long n; | 2862 | long n, freed; |
2863 | 2863 | ||
2864 | ubifs_destroy_tnc_subtree(c->zroot.znode); | ||
2865 | n = atomic_long_read(&c->clean_zn_cnt); | 2864 | n = atomic_long_read(&c->clean_zn_cnt); |
2865 | freed = ubifs_destroy_tnc_subtree(c->zroot.znode); | ||
2866 | ubifs_assert(freed == n); | ||
2866 | atomic_long_sub(n, &ubifs_clean_zn_cnt); | 2867 | atomic_long_sub(n, &ubifs_clean_zn_cnt); |
2867 | } | 2868 | } |
2868 | kfree(c->gap_lebs); | 2869 | kfree(c->gap_lebs); |