Unionfs: Provide more helpful info on branch leaks during unmount
authorErez Zadok <ezk@cs.sunysb.edu>
Mon, 19 Mar 2007 07:01:49 +0000 (03:01 -0400)
committerErez_Zadok <ezk@cs.sunysb.edu>
Mon, 23 Jul 2007 00:50:23 +0000 (20:50 -0400)
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
[jsipek: no need to take a read lock on the superblock private data]
Signed-off-by: Josef 'Jeff' Sipek <jsipek@cs.sunysb.edu>
fs/unionfs/super.c

index 571b589cd8ff3fea8af29caa13d5e3b3be9c9368..037c47d8ac79e10c9dca835e01c6e5f27523d85f 100644 (file)
@@ -97,6 +97,7 @@ static void unionfs_put_super(struct super_block *sb)
 {
        int bindex, bstart, bend;
        struct unionfs_sb_info *spd;
+       int leaks = 0;
 
        spd = UNIONFS_SB(sb);
        if (!spd)
@@ -107,7 +108,12 @@ static void unionfs_put_super(struct super_block *sb)
 
        /* Make sure we have no leaks of branchget/branchput. */
        for (bindex = bstart; bindex <= bend; bindex++)
-               BUG_ON(branch_count(sb, bindex) != 0);
+               if (branch_count(sb, bindex) != 0) {
+                       printk("unionfs: branch %d has %d references left!\n",
+                              bindex, branch_count(sb,bindex));
+                       leaks = 1;
+               }
+       BUG_ON(leaks != 0);
 
        kfree(spd->data);
        kfree(spd);