Unionfs: use path_put in mount code
authorErez Zadok <ezk@cs.sunysb.edu>
Fri, 7 Nov 2008 21:49:48 +0000 (16:49 -0500)
committerErez Zadok <ezk@cs.sunysb.edu>
Wed, 30 Mar 2011 23:21:47 +0000 (19:21 -0400)
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/main.c

index fea670b873c099a5a012415dd44bf14702286f87..8b5714a97d5a45ff3738fa89b5233ba57ed59633 100644 (file)
@@ -415,11 +415,7 @@ static int parse_dirs_option(struct super_block *sb, struct unionfs_dentry_info
 out:
        if (err) {
                for (i = 0; i < branches; i++)
-                       if (lower_root_info->lower_paths[i].dentry) {
-                               dput(lower_root_info->lower_paths[i].dentry);
-                               /* initialize: can't use unionfs_mntput here */
-                               mntput(lower_root_info->lower_paths[i].mnt);
-                       }
+                       path_put(&lower_root_info->lower_paths[i]);
 
                kfree(lower_root_info->lower_paths);
                kfree(UNIONFS_SB(sb)->data);
@@ -510,17 +506,8 @@ out_error:
        if (lower_root_info && lower_root_info->lower_paths) {
                for (bindex = lower_root_info->bstart;
                     bindex >= 0 && bindex <= lower_root_info->bend;
-                    bindex++) {
-                       struct dentry *d;
-                       struct vfsmount *m;
-
-                       d = lower_root_info->lower_paths[bindex].dentry;
-                       m = lower_root_info->lower_paths[bindex].mnt;
-
-                       dput(d);
-                       /* initializing: can't use unionfs_mntput here */
-                       mntput(m);
-               }
+                    bindex++)
+                       path_put(&lower_root_info->lower_paths[bindex]);
        }
 
        kfree(lower_root_info->lower_paths);
@@ -679,16 +666,10 @@ out_dput:
                for (bindex = lower_root_info->bstart;
                     bindex <= lower_root_info->bend; bindex++) {
                        struct dentry *d;
-                       struct vfsmount *m;
-
                        d = lower_root_info->lower_paths[bindex].dentry;
-                       m = lower_root_info->lower_paths[bindex].mnt;
-
-                       dput(d);
-                       /* initializing: can't use unionfs_mntput here */
-                       mntput(m);
                        /* drop refs we took earlier */
                        atomic_dec(&d->d_sb->s_active);
+                       path_put(&lower_root_info->lower_paths[bindex]);
                }
                kfree(lower_root_info->lower_paths);
                kfree(lower_root_info);