Introduce path_put() * Add path_put() functions for releasing a reference to the dentry and vfsmount of a struct path in the right order * Switch from path_release(nd) to path_put(&nd->path) * Rename dput_path() to path_put_conditional() [akpm@linux-foundation.org: fix cifs] Signed-off-by: Jan Blunck <jblunck@suse.de> Signed-off-by: Andreas Gruenbacher <agruen@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Cc: <linux-fsdevel@vger.kernel.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Steven French <sfrench@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index f2bef5e..8c71daf 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c
@@ -260,7 +260,7 @@ retval = user_path_walk(path, &nd); if (!retval) { retval = do_osf_statfs(nd.path.dentry, buffer, bufsiz); - path_release(&nd); + path_put(&nd.path); } return retval; }
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c index 49d6292..672fba8 100644 --- a/arch/mips/kernel/sysirix.c +++ b/arch/mips/kernel/sysirix.c
@@ -711,7 +711,7 @@ } dput_and_out: - path_release(&nd); + path_put(&nd.path); out: return error; } @@ -1385,7 +1385,7 @@ error |= __put_user(0, &buf->f_fstr[i]); dput_and_out: - path_release(&nd); + path_put(&nd.path); out: return error; } @@ -1636,7 +1636,7 @@ error |= __put_user(0, &buf->f_fstr[i]); dput_and_out: - path_release(&nd); + path_put(&nd.path); out: return error; }
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c index d7395af..0c5b9da 100644 --- a/arch/parisc/hpux/sys_hpux.c +++ b/arch/parisc/hpux/sys_hpux.c
@@ -222,7 +222,7 @@ error = vfs_statfs_hpux(nd.path.dentry, &tmp); if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) error = -EFAULT; - path_release(&nd); + path_put(&nd.path); } return error; }
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c b/arch/powerpc/platforms/cell/spufs/syscalls.c index 4304044..49c8776 100644 --- a/arch/powerpc/platforms/cell/spufs/syscalls.c +++ b/arch/powerpc/platforms/cell/spufs/syscalls.c
@@ -73,7 +73,7 @@ LOOKUP_OPEN|LOOKUP_CREATE, &nd); if (!ret) { ret = spufs_create(&nd, flags, mode, neighbor); - path_release(&nd); + path_put(&nd.path); } putname(tmp); }
diff --git a/arch/sparc64/solaris/fs.c b/arch/sparc64/solaris/fs.c index 516932e..7d035f0 100644 --- a/arch/sparc64/solaris/fs.c +++ b/arch/sparc64/solaris/fs.c
@@ -436,7 +436,7 @@ if (!error) { struct inode *inode = nd.path.dentry->d_inode; error = report_statvfs(nd.path.mnt, inode, buf); - path_release(&nd); + path_put(&nd.path); } return error; } @@ -466,7 +466,7 @@ if (!error) { struct inode *inode = nd.path.dentry->d_inode; error = report_statvfs64(nd.path.mnt, inode, buf); - path_release(&nd); + path_put(&nd.path); } unlock_kernel(); return error;
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index b611a3c..e75b143 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c
@@ -375,7 +375,7 @@ *dev = inode->i_rdev; out: - path_release(&nd); + path_put(&nd.path); return r; }
diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c index e376f45..28cc678 100644 --- a/drivers/mtd/mtdsuper.c +++ b/drivers/mtd/mtdsuper.c
@@ -203,7 +203,7 @@ goto not_an_MTD_device; mtdnr = iminor(nd.path.dentry->d_inode); - path_release(&nd); + path_put(&nd.path); return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super, mnt); @@ -214,7 +214,7 @@ "MTD: Attempt to mount non-MTD device \"%s\"\n", dev_name); out: - path_release(&nd); + path_put(&nd.path); return ret; }
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c index 4136dfb..e13cea2 100644 --- a/fs/afs/mntpt.c +++ b/fs/afs/mntpt.c
@@ -227,7 +227,7 @@ newmnt = afs_mntpt_do_automount(nd->path.dentry); if (IS_ERR(newmnt)) { - path_release(nd); + path_put(&nd->path); return (void *)newmnt; }
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index a119c86..a54a946 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c
@@ -383,7 +383,7 @@ return NULL; out_error: - path_release(nd); + path_put(&nd->path); return ERR_PTR(status); }
diff --git a/fs/block_dev.c b/fs/block_dev.c index 5f4721f..67fe72c 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c
@@ -1409,7 +1409,7 @@ if (!bdev) goto fail; out: - path_release(&nd); + path_put(&nd.path); return bdev; fail: bdev = ERR_PTR(error);
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c index bcd53c2..6ad4475 100644 --- a/fs/cifs/cifs_dfs_ref.c +++ b/fs/cifs/cifs_dfs_ref.c
@@ -368,7 +368,7 @@ cFYI(1, ("leaving %s" , __FUNCTION__)); return ERR_PTR(rc); out_err: - path_release(nd); + path_put(&nd->path); goto out; }
diff --git a/fs/coda/pioctl.c b/fs/coda/pioctl.c index 3b6a1b7..c21a1f5 100644 --- a/fs/coda/pioctl.c +++ b/fs/coda/pioctl.c
@@ -80,7 +80,7 @@ /* return if it is not a Coda inode */ if ( target_inode->i_sb != inode->i_sb ) { - path_release(&nd); + path_put(&nd.path); return -EINVAL; } @@ -89,7 +89,7 @@ error = venus_pioctl(inode->i_sb, &(cnp->c_fid), cmd, &data); - path_release(&nd); + path_put(&nd.path); return error; }
diff --git a/fs/compat.c b/fs/compat.c index a8d6237..43ca016 100644 --- a/fs/compat.c +++ b/fs/compat.c
@@ -244,7 +244,7 @@ error = vfs_statfs(nd.path.dentry, &tmp); if (!error) error = put_compat_statfs(buf, &tmp); - path_release(&nd); + path_put(&nd.path); } return error; } @@ -312,7 +312,7 @@ error = vfs_statfs(nd.path.dentry, &tmp); if (!error) error = put_compat_statfs64(buf, &tmp); - path_release(&nd); + path_put(&nd.path); } return error; }
diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c index cda3ea0..78929ea 100644 --- a/fs/configfs/symlink.c +++ b/fs/configfs/symlink.c
@@ -103,7 +103,7 @@ *target = configfs_get_config_item(nd->path.dentry); if (!*target) { ret = -ENOENT; - path_release(nd); + path_put(&nd->path); } } else ret = -EPERM; @@ -141,7 +141,7 @@ ret = create_link(parent_item, target_item, dentry); config_item_put(target_item); - path_release(&nd); + path_put(&nd.path); out_put: config_item_put(parent_item);
diff --git a/fs/dquot.c b/fs/dquot.c index 289f48d..9c7feb6 100644 --- a/fs/dquot.c +++ b/fs/dquot.c
@@ -1643,7 +1643,7 @@ error = vfs_quota_on_inode(nd.path.dentry->d_inode, type, format_id); out_path: - path_release(&nd); + path_put(&nd.path); return error; }
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index a70555a6..d25ac95 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c
@@ -526,7 +526,7 @@ rc = 0; goto out; out_free: - path_release(&nd); + path_put(&nd.path); out: return rc; }
diff --git a/fs/exec.c b/fs/exec.c index 7a12d2d..a44b142 100644 --- a/fs/exec.c +++ b/fs/exec.c
@@ -148,7 +148,7 @@ return error; exit: release_open_intent(&nd); - path_release(&nd); + path_put(&nd.path); goto out; } @@ -672,7 +672,7 @@ } } release_open_intent(&nd); - path_release(&nd); + path_put(&nd.path); } goto out; }
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 0b5057e..18769cc 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c
@@ -2759,7 +2759,7 @@ return err; /* Quotafile not on the same filesystem? */ if (nd.path.mnt->mnt_sb != sb) { - path_release(&nd); + path_put(&nd.path); return -EXDEV; } /* Quotafile not of fs root? */ @@ -2767,7 +2767,7 @@ printk(KERN_WARNING "EXT3-fs: Quota file not on filesystem root. " "Journalled quota will not work.\n"); - path_release(&nd); + path_put(&nd.path); return vfs_quota_on(sb, type, format_id, path); }
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 3711799..13383ba 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c
@@ -3159,7 +3159,7 @@ return err; /* Quotafile not on the same filesystem? */ if (nd.path.mnt->mnt_sb != sb) { - path_release(&nd); + path_put(&nd.path); return -EXDEV; } /* Quotafile not of fs root? */ @@ -3167,7 +3167,7 @@ printk(KERN_WARNING "EXT4-fs: Quota file not on filesystem root. " "Journalled quota will not work.\n"); - path_release(&nd); + path_put(&nd.path); return vfs_quota_on(sb, type, format_id, path); }
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index f4ced7f..4bee6aa 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c
@@ -900,7 +900,7 @@ "mount point %s\n", dev_name); free_nd: - path_release(&nd); + path_put(&nd.path); out: return sb; }
diff --git a/fs/inotify_user.c b/fs/inotify_user.c index e9c5865..7b94a1e 100644 --- a/fs/inotify_user.c +++ b/fs/inotify_user.c
@@ -367,7 +367,7 @@ /* you can only watch an inode if you have read permissions on it */ error = vfs_permission(nd, MAY_READ); if (error) - path_release(nd); + path_put(&nd->path); return error; } @@ -676,7 +676,7 @@ ret = create_watch(dev, inode, mask); mutex_unlock(&dev->up_mutex); - path_release(&nd); + path_put(&nd.path); fput_and_out: fput_light(filp, fput_needed); return ret;
diff --git a/fs/namei.c b/fs/namei.c index c9b05a7..b0df7ea 100644 --- a/fs/namei.c +++ b/fs/namei.c
@@ -362,11 +362,18 @@ return 0; } -void path_release(struct nameidata *nd) +/** + * path_put - put a reference to a path + * @path: path to put the reference to + * + * Given a path decrement the reference count to the dentry and the vfsmount. + */ +void path_put(struct path *path) { - dput(nd->path.dentry); - mntput(nd->path.mnt); + dput(path->dentry); + mntput(path->mnt); } +EXPORT_SYMBOL(path_put); /** * release_open_intent - free up open intent resources @@ -551,7 +558,7 @@ goto fail; if (*link == '/') { - path_release(nd); + path_put(&nd->path); if (!walk_init_root(link, nd)) /* weird __emul_prefix() stuff did it */ goto out; @@ -567,18 +574,18 @@ */ name = __getname(); if (unlikely(!name)) { - path_release(nd); + path_put(&nd->path); return -ENOMEM; } strcpy(name, nd->last.name); nd->last.name = name; return 0; fail: - path_release(nd); + path_put(&nd->path); return PTR_ERR(link); } -static inline void dput_path(struct path *path, struct nameidata *nd) +static void path_put_conditional(struct path *path, struct nameidata *nd) { dput(path->dentry); if (path->mnt != nd->path.mnt) @@ -651,8 +658,8 @@ nd->depth--; return err; loop: - dput_path(path, nd); - path_release(nd); + path_put_conditional(path, nd); + path_put(&nd->path); return err; } @@ -993,10 +1000,10 @@ return_base: return 0; out_dput: - dput_path(&next, nd); + path_put_conditional(&next, nd); break; } - path_release(nd); + path_put(&nd->path); return_err: return err; } @@ -1070,7 +1077,7 @@ mntput(old_mnt); return 1; } - path_release(nd); + path_put(&nd->path); } nd->path.dentry = old_dentry; nd->path.mnt = old_mnt; @@ -1230,7 +1237,7 @@ if (IS_ERR(nd->intent.open.file)) { if (err == 0) { err = PTR_ERR(nd->intent.open.file); - path_release(nd); + path_put(&nd->path); } } else if (err != 0) release_open_intent(nd); @@ -1806,11 +1813,11 @@ return 0; exit_dput: - dput_path(&path, nd); + path_put_conditional(&path, nd); exit: if (!IS_ERR(nd->intent.open.file)) release_open_intent(nd); - path_release(nd); + path_put(&nd->path); return error; do_link: @@ -1979,7 +1986,7 @@ dput(dentry); } mutex_unlock(&nd.path.dentry->d_inode->i_mutex); - path_release(&nd); + path_put(&nd.path); out: putname(tmp); @@ -2039,7 +2046,7 @@ dput(dentry); out_unlock: mutex_unlock(&nd.path.dentry->d_inode->i_mutex); - path_release(&nd); + path_put(&nd.path); out: putname(tmp); out_err: @@ -2147,7 +2154,7 @@ exit2: mutex_unlock(&nd.path.dentry->d_inode->i_mutex); exit1: - path_release(&nd); + path_put(&nd.path); exit: putname(name); return error; @@ -2231,7 +2238,7 @@ if (inode) iput(inode); /* truncate the inode here */ exit1: - path_release(&nd); + path_put(&nd.path); exit: putname(name); return error; @@ -2308,7 +2315,7 @@ dput(dentry); out_unlock: mutex_unlock(&nd.path.dentry->d_inode->i_mutex); - path_release(&nd); + path_put(&nd.path); out: putname(to); out_putname: @@ -2404,9 +2411,9 @@ out_unlock: mutex_unlock(&nd.path.dentry->d_inode->i_mutex); out_release: - path_release(&nd); + path_put(&nd.path); out: - path_release(&old_nd); + path_put(&old_nd.path); exit: putname(to); @@ -2634,9 +2641,9 @@ exit3: unlock_rename(new_dir, old_dir); exit2: - path_release(&newnd); + path_put(&newnd.path); exit1: - path_release(&oldnd); + path_put(&oldnd.path); exit: return error; } @@ -2810,7 +2817,6 @@ EXPORT_SYMBOL(page_symlink_inode_operations); EXPORT_SYMBOL(path_lookup); EXPORT_SYMBOL(vfs_path_lookup); -EXPORT_SYMBOL(path_release); EXPORT_SYMBOL(permission); EXPORT_SYMBOL(vfs_permission); EXPORT_SYMBOL(file_permission);
diff --git a/fs/namespace.c b/fs/namespace.c index 5d9fd4c..c77eedd 100644 --- a/fs/namespace.c +++ b/fs/namespace.c
@@ -1007,7 +1007,7 @@ out: up_write(&namespace_sem); - path_release(&old_nd); + path_put(&old_nd.path); return err; } @@ -1126,8 +1126,8 @@ out: up_write(&namespace_sem); if (!err) - path_release(&parent_nd); - path_release(&old_nd); + path_put(&parent_nd.path); + path_put(&old_nd.path); return err; } @@ -1512,7 +1512,7 @@ retval = do_new_mount(&nd, type_page, flags, mnt_flags, dev_name, data_page); dput_out: - path_release(&nd); + path_put(&nd.path); return retval; } @@ -1768,7 +1768,7 @@ error = security_sb_pivotroot(&old_nd, &new_nd); if (error) { - path_release(&old_nd); + path_put(&old_nd.path); goto out1; } @@ -1831,15 +1831,15 @@ chroot_fs_refs(&user_nd, &new_nd); security_sb_post_pivotroot(&user_nd, &new_nd); error = 0; - path_release(&root_parent); - path_release(&parent_nd); + path_put(&root_parent.path); + path_put(&parent_nd.path); out2: mutex_unlock(&old_nd.path.dentry->d_inode->i_mutex); up_write(&namespace_sem); - path_release(&user_nd); - path_release(&old_nd); + path_put(&user_nd.path); + path_put(&old_nd.path); out1: - path_release(&new_nd); + path_put(&new_nd.path); out0: unlock_kernel(); return error;
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index 3b6d83dc..607f6eb 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c
@@ -148,7 +148,7 @@ dprintk("<-- nfs_follow_mountpoint() = %d\n", err); return ERR_PTR(err); out_err: - path_release(nd); + path_put(&nd->path); goto out; out_follow: while (d_mountpoint(nd->path.dentry) &&
diff --git a/fs/nfsctl.c b/fs/nfsctl.c index 49ef0b4..aed8145 100644 --- a/fs/nfsctl.c +++ b/fs/nfsctl.c
@@ -43,7 +43,7 @@ if (!error) return dentry_open(nd.path.dentry, nd.path.mnt, flags); - path_release(&nd); + path_put(&nd.path); return ERR_PTR(error); }
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index 2ac0e30..717413f 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c
@@ -177,7 +177,7 @@ cache_put(&ek->h, &svc_expkey_cache); else err = -ENOMEM; - path_release(&nd); + path_put(&nd.path); } cache_flush(); out: @@ -630,7 +630,7 @@ kfree(exp.ex_uuid); kfree(exp.ex_path); if (nd.path.dentry) - path_release(&nd); + path_put(&nd.path); out_no_path: if (dom) auth_domain_put(dom); @@ -1098,7 +1098,7 @@ cache_put(&fsid_key->h, &svc_expkey_cache); if (clp) auth_domain_put(clp); - path_release(&nd); + path_put(&nd.path); out_unlock: exp_writeunlock(); out: @@ -1150,7 +1150,7 @@ err = -EINVAL; exp = exp_get_by_name(dom, nd.path.mnt, nd.path.dentry, NULL); - path_release(&nd); + path_put(&nd.path); if (IS_ERR(exp)) goto out_domain; @@ -1209,7 +1209,7 @@ fh_put(&fh); exp_put(exp); out: - path_release(&nd); + path_put(&nd.path); return err; }
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index a7a8fdf..1ff9062 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c
@@ -415,5 +415,5 @@ if (!rec_dir_init) return; rec_dir_init = 0; - path_release(&rec_dir); + path_put(&rec_dir.path); }
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index be2b9ec..bcb97d8 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c
@@ -3265,7 +3265,7 @@ nfs4_set_recdir(recdir); status = 0; } - path_release(&nd); + path_put(&nd.path); return status; }
diff --git a/fs/open.c b/fs/open.c index 279aacf..ca8ac4b 100644 --- a/fs/open.c +++ b/fs/open.c
@@ -130,7 +130,7 @@ error = vfs_statfs_native(nd.path.dentry, &tmp); if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) error = -EFAULT; - path_release(&nd); + path_put(&nd.path); } return error; } @@ -149,7 +149,7 @@ error = vfs_statfs64(nd.path.dentry, &tmp); if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) error = -EFAULT; - path_release(&nd); + path_put(&nd.path); } return error; } @@ -277,7 +277,7 @@ put_write_and_out: put_write_access(inode); dput_and_out: - path_release(&nd); + path_put(&nd.path); out: return error; } @@ -462,7 +462,7 @@ res = -EROFS; out_path_release: - path_release(&nd); + path_put(&nd.path); out: current->fsuid = old_fsuid; current->fsgid = old_fsgid; @@ -493,7 +493,7 @@ set_fs_pwd(current->fs, nd.path.mnt, nd.path.dentry); dput_and_out: - path_release(&nd); + path_put(&nd.path); out: return error; } @@ -549,7 +549,7 @@ set_fs_altroot(); error = 0; dput_and_out: - path_release(&nd); + path_put(&nd.path); out: return error; } @@ -621,7 +621,7 @@ mutex_unlock(&inode->i_mutex); dput_and_out: - path_release(&nd); + path_put(&nd.path); out: return error; } @@ -676,7 +676,7 @@ if (error) goto out; error = chown_common(nd.path.dentry, user, group); - path_release(&nd); + path_put(&nd.path); out: return error; } @@ -696,7 +696,7 @@ if (error) goto out; error = chown_common(nd.path.dentry, user, group); - path_release(&nd); + path_put(&nd.path); out: return error; } @@ -710,7 +710,7 @@ if (error) goto out; error = chown_common(nd.path.dentry, user, group); - path_release(&nd); + path_put(&nd.path); out: return error; } @@ -894,7 +894,7 @@ filp = __dentry_open(nd->path.dentry, nd->path.mnt, flags, filp, NULL); else - path_release(nd); + path_put(&nd->path); return filp; }
diff --git a/fs/proc/base.c b/fs/proc/base.c index 0ef5223..c742be4 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c
@@ -1164,7 +1164,7 @@ int error = -EACCES; /* We don't need a base pointer in the /proc filesystem */ - path_release(nd); + path_put(&nd->path); /* Are we allowed to snoop on the tasks file descriptors? */ if (!proc_fd_access_allowed(inode))
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 2d1d6ac..6841452 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c
@@ -2027,20 +2027,20 @@ return err; /* Quotafile not on the same filesystem? */ if (nd.path.mnt->mnt_sb != sb) { - path_release(&nd); + path_put(&nd.path); return -EXDEV; } /* We must not pack tails for quota files on reiserfs for quota IO to work */ if (!REISERFS_I(nd.path.dentry->d_inode)->i_flags & i_nopack_mask) { reiserfs_warning(sb, "reiserfs: Quota file must have tail packing disabled."); - path_release(&nd); + path_put(&nd.path); return -EINVAL; } /* Not journalling quota? No more tests needed... */ if (!REISERFS_SB(sb)->s_qf_names[USRQUOTA] && !REISERFS_SB(sb)->s_qf_names[GRPQUOTA]) { - path_release(&nd); + path_put(&nd.path); return vfs_quota_on(sb, type, format_id, path); } /* Quotafile not of fs root? */ @@ -2048,7 +2048,7 @@ reiserfs_warning(sb, "reiserfs: Quota file not on filesystem root. " "Journalled quota will not work."); - path_release(&nd); + path_put(&nd.path); return vfs_quota_on(sb, type, format_id, path); }
diff --git a/fs/stat.c b/fs/stat.c index 82680f2..9cf41f7 100644 --- a/fs/stat.c +++ b/fs/stat.c
@@ -63,7 +63,7 @@ error = __user_walk_fd(dfd, name, LOOKUP_FOLLOW, &nd); if (!error) { error = vfs_getattr(nd.path.mnt, nd.path.dentry, stat); - path_release(&nd); + path_put(&nd.path); } return error; } @@ -83,7 +83,7 @@ error = __user_walk_fd(dfd, name, 0, &nd); if (!error) { error = vfs_getattr(nd.path.mnt, nd.path.dentry, stat); - path_release(&nd); + path_put(&nd.path); } return error; } @@ -313,7 +313,7 @@ buf, bufsiz); } } - path_release(&nd); + path_put(&nd.path); } return error; }
diff --git a/fs/utimes.c b/fs/utimes.c index 679b082..b18da9c 100644 --- a/fs/utimes.c +++ b/fs/utimes.c
@@ -138,7 +138,7 @@ if (f) fput(f); else - path_release(&nd); + path_put(&nd.path); out: return error; }
diff --git a/fs/xattr.c b/fs/xattr.c index be0ee75..3acab16 100644 --- a/fs/xattr.c +++ b/fs/xattr.c
@@ -263,7 +263,7 @@ if (error) return error; error = setxattr(nd.path.dentry, name, value, size, flags); - path_release(&nd); + path_put(&nd.path); return error; } @@ -278,7 +278,7 @@ if (error) return error; error = setxattr(nd.path.dentry, name, value, size, flags); - path_release(&nd); + path_put(&nd.path); return error; } @@ -348,7 +348,7 @@ if (error) return error; error = getxattr(nd.path.dentry, name, value, size); - path_release(&nd); + path_put(&nd.path); return error; } @@ -363,7 +363,7 @@ if (error) return error; error = getxattr(nd.path.dentry, name, value, size); - path_release(&nd); + path_put(&nd.path); return error; } @@ -422,7 +422,7 @@ if (error) return error; error = listxattr(nd.path.dentry, list, size); - path_release(&nd); + path_put(&nd.path); return error; } @@ -436,7 +436,7 @@ if (error) return error; error = listxattr(nd.path.dentry, list, size); - path_release(&nd); + path_put(&nd.path); return error; } @@ -483,7 +483,7 @@ if (error) return error; error = removexattr(nd.path.dentry, name); - path_release(&nd); + path_put(&nd.path); return error; } @@ -497,7 +497,7 @@ if (error) return error; error = removexattr(nd.path.dentry, name); - path_release(&nd); + path_put(&nd.path); return error; }
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c index f052a10..a9952e4 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -94,7 +94,7 @@ ASSERT(nd.path.dentry); ASSERT(nd.path.dentry->d_inode); inode = igrab(nd.path.dentry->d_inode); - path_release(&nd); + path_put(&nd.path); break; }
diff --git a/include/linux/namei.h b/include/linux/namei.h index 52fa2f7..24d88e9 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h
@@ -66,7 +66,6 @@ extern int path_lookup(const char *, unsigned, struct nameidata *); extern int vfs_path_lookup(struct dentry *, struct vfsmount *, const char *, unsigned int, struct nameidata *); -extern void path_release(struct nameidata *); extern int __user_path_lookup_open(const char __user *, unsigned lookup_flags, struct nameidata *nd, int open_flags); extern int path_lookup_open(int dfd, const char *name, unsigned lookup_flags, struct nameidata *, int open_flags);
diff --git a/include/linux/path.h b/include/linux/path.h index cbebdc5..4d976f9 100644 --- a/include/linux/path.h +++ b/include/linux/path.h
@@ -9,4 +9,6 @@ struct dentry *dentry; }; +extern void path_put(struct path *); + #endif /* _LINUX_PATH_H */
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c index b898814..9ef5e0a 100644 --- a/kernel/audit_tree.c +++ b/kernel/audit_tree.c
@@ -550,7 +550,7 @@ goto skip_it; root_mnt = collect_mounts(nd.path.mnt, nd.path.dentry); - path_release(&nd); + path_put(&nd.path); if (!root_mnt) goto skip_it; @@ -642,7 +642,7 @@ if (err) goto Err; mnt = collect_mounts(nd.path.mnt, nd.path.dentry); - path_release(&nd); + path_put(&nd.path); if (!mnt) { err = -ENOMEM; goto Err; @@ -702,7 +702,7 @@ if (err) return err; tagged = collect_mounts(nd.path.mnt, nd.path.dentry); - path_release(&nd); + path_put(&nd.path); if (!tagged) return -ENOMEM; @@ -713,7 +713,7 @@ } mnt = mntget(nd.path.mnt); dentry = dget(nd.path.dentry); - path_release(&nd); + path_put(&nd.path); if (dentry == tagged->mnt_root && dentry == mnt->mnt_root) follow_up(&mnt, &dentry); @@ -744,13 +744,13 @@ spin_lock(&vfsmount_lock); if (!is_under(mnt, dentry, &nd)) { spin_unlock(&vfsmount_lock); - path_release(&nd); + path_put(&nd.path); put_tree(tree); mutex_lock(&audit_filter_mutex); continue; } spin_unlock(&vfsmount_lock); - path_release(&nd); + path_put(&nd.path); list_for_each_entry(p, &list, mnt_list) { failed = tag_chunk(p->mnt_root->d_inode, tree);
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c index a36e667..2f2914b 100644 --- a/kernel/auditfilter.c +++ b/kernel/auditfilter.c
@@ -1161,11 +1161,11 @@ static void audit_put_nd(struct nameidata *ndp, struct nameidata *ndw) { if (ndp) { - path_release(ndp); + path_put(&ndp->path); kfree(ndp); } if (ndw) { - path_release(ndw); + path_put(&ndw->path); kfree(ndw); } }
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 6bc3bab..1b395a4 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c
@@ -495,7 +495,7 @@ static void rpc_release_path(struct nameidata *nd) { - path_release(nd); + path_put(&nd->path); rpc_put_mount(); }
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 7c3323e..b8788fd 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c
@@ -727,7 +727,7 @@ if (u->sk_type == type) touch_atime(nd.path.mnt, nd.path.dentry); - path_release(&nd); + path_put(&nd.path); err=-EPROTOTYPE; if (u->sk_type != type) { @@ -748,7 +748,7 @@ return u; put_fail: - path_release(&nd); + path_put(&nd.path); fail: *error=err; return NULL; @@ -862,7 +862,7 @@ dput(dentry); out_mknod_unlock: mutex_unlock(&nd.path.dentry->d_inode->i_mutex); - path_release(&nd); + path_put(&nd.path); out_mknod_parent: if (err==-EEXIST) err=-EADDRINUSE;