Skip to contentSkip to conversation

UBIFS: Add an assertion for clean_zn_cnt

PATCH Applied hujianyang 2 participants 2 messages Jun 3, 2014

Subsystems (2)
lore
Share & tools
lore

hujianyang

author
#0 lore raw

PATCH 1/1 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.

---
 fs/ubifs/tnc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/ubifs/tnc.c +3 -2
index 9083bc7..61914f0 100644
@@ -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);
+		freed = ubifs_destroy_tnc_subtree(c->zroot.znode);
 		n = atomic_long_read(&c->clean_zn_cnt);
+		ubifs_assert(freed == n);
 		atomic_long_sub(n, &ubifs_clean_zn_cnt);
 	}
 	kfree(c->gap_lebs);
Signature · 1 line
1.8.1.4
#1 lore raw
Quoted 4 lines · hujianyang

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.

Pushed to linux-ubifs.git, thanks!

Signature · 2 lines
Best Regards,
Artem Bityutskiy