Unionfs odf: Fix odf unmount OOPs on export
authorRachita Kothiyal <rachita@dewey.fsl.cs.sunysb.edu>
Wed, 19 Mar 2008 20:44:26 +0000 (16:44 -0400)
committerRachita Kothiyal <rachita@dewey.fsl.cs.sunysb.edu>
Wed, 19 Mar 2008 20:44:26 +0000 (16:44 -0400)
Fix a leaked reference count on odf_root when trying to connect
disconnected dentries in __get_parent

Signed-off-by: Rachita Kothiyal <rachita@fsl.cs.sunysb.edu>
fs/unionfs/export.c

index fd82a33c9c33fbc77a010bd4e577161a34b07ec6..9466a10c0df7a4e121822b7d69a69b4155d7b5f8 100644 (file)
@@ -51,8 +51,7 @@ static struct dentry *__get_parent(struct super_block *sb,
                __odf_dstack_push(&stack, d);
                if (!is_anon(d)) {
                        d = d->d_parent;
-                       if (d != odf_root)
-                               dget(d);
+                       dget(d);
                } else {
                        /*
                         * if the odf dentry is disconnected we get its
@@ -67,6 +66,12 @@ static struct dentry *__get_parent(struct super_block *sb,
                        }
                        d = d_parent;
                }
+               /*
+                * We dont push odf root on stack, but the code above has
+                * already incremented its reference count.  Drop it here.
+                */
+               if (d == odf_root)
+                       dput(d);
        } while (d != odf_root);
 
        /*