Introduce path_put()
authorJan Blunck <jblunck@suse.de>
Fri, 15 Feb 2008 03:34:35 +0000 (19:34 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Fri, 15 Feb 2008 05:13:33 +0000 (21:13 -0800)
* 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>
41 files changed:
arch/alpha/kernel/osf_sys.c
arch/mips/kernel/sysirix.c
arch/parisc/hpux/sys_hpux.c
arch/powerpc/platforms/cell/spufs/syscalls.c
arch/sparc64/solaris/fs.c
drivers/md/dm-table.c
drivers/mtd/mtdsuper.c
fs/afs/mntpt.c
fs/autofs4/root.c
fs/block_dev.c
fs/cifs/cifs_dfs_ref.c
fs/coda/pioctl.c
fs/compat.c
fs/configfs/symlink.c
fs/dquot.c
fs/ecryptfs/main.c
fs/exec.c
fs/ext3/super.c
fs/ext4/super.c
fs/gfs2/ops_fstype.c
fs/inotify_user.c
fs/namei.c
fs/namespace.c
fs/nfs/namespace.c
fs/nfsctl.c
fs/nfsd/export.c
fs/nfsd/nfs4recover.c
fs/nfsd/nfs4state.c
fs/open.c
fs/proc/base.c
fs/reiserfs/super.c
fs/stat.c
fs/utimes.c
fs/xattr.c
fs/xfs/linux-2.6/xfs_ioctl.c
include/linux/namei.h
include/linux/path.h
kernel/audit_tree.c
kernel/auditfilter.c
net/sunrpc/rpc_pipe.c
net/unix/af_unix.c

index f2bef5e14faa0f99799ceec6ba3510775f4f5929..8c71daf94a59ce0f27537a4c8352ab362152dbbe 100644 (file)
@@ -260,7 +260,7 @@ osf_statfs(char __user *path, struct osf_statfs __user *buffer, unsigned long bu
        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;
 }
index 49d6292ffa058dc90d7c9d7687d7ee55506e9199..672fba84b2ccb50a145a7966890a8dfb6b4562f0 100644 (file)
@@ -711,7 +711,7 @@ asmlinkage int irix_statfs(const char __user *path,
        }
 
 dput_and_out:
-       path_release(&nd);
+       path_put(&nd.path);
 out:
        return error;
 }
@@ -1385,7 +1385,7 @@ asmlinkage int irix_statvfs(char __user *fname, struct irix_statvfs __user *buf)
                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 @@ asmlinkage int irix_statvfs64(char __user *fname, struct irix_statvfs64 __user *
                error |= __put_user(0, &buf->f_fstr[i]);
 
 dput_and_out:
-       path_release(&nd);
+       path_put(&nd.path);
 out:
        return error;
 }
index d7395af3e8464c100f3ab650e52136f29cc53da3..0c5b9dabb4754b350d3763f1ae31b1b3f706e64a 100644 (file)
@@ -222,7 +222,7 @@ asmlinkage long hpux_statfs(const char __user *path,
                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;
 }
index 430404413178852c146c67e57a763d5aebf3ccd2..49c87769b1f8f96936ac713be1b42014062adf51 100644 (file)
@@ -73,7 +73,7 @@ static long do_spu_create(const char __user *pathname, unsigned int flags,
                                LOOKUP_OPEN|LOOKUP_CREATE, &nd);
                if (!ret) {
                        ret = spufs_create(&nd, flags, mode, neighbor);
-                       path_release(&nd);
+                       path_put(&nd.path);
                }
                putname(tmp);
        }
index 516932e9f70b8a35b030fb62f96ee6c8a6180034..7d035f0d3ae1fcbf0084f11b2451077616115a34 100644 (file)
@@ -436,7 +436,7 @@ asmlinkage int solaris_statvfs(u32 path, u32 buf)
        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 @@ asmlinkage int solaris_statvfs64(u32 path, u32 buf)
        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;
index b611a3c61504eaead7adda1db2bee33f83005085..e75b1437b58b67ad8ecac097d6b3c50e9bf0b2ba 100644 (file)
@@ -375,7 +375,7 @@ static int lookup_device(const char *path, dev_t *dev)
        *dev = inode->i_rdev;
 
  out:
-       path_release(&nd);
+       path_put(&nd.path);
        return r;
 }
 
index e376f45179052d37de992cff9272b038008b2c7f..28cc6787a800c3ba651a4dd5734718874d117aa4 100644 (file)
@@ -203,7 +203,7 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
                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 @@ not_an_MTD_device:
                       "MTD: Attempt to mount non-MTD device \"%s\"\n",
                       dev_name);
 out:
-       path_release(&nd);
+       path_put(&nd.path);
        return ret;
 
 }
index 4136dfb9ffb8c3a5978fe0d4ca6c19e753d097a3..e13cea2206693d9831b93db3271a0938db64e8a9 100644 (file)
@@ -227,7 +227,7 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
 
        newmnt = afs_mntpt_do_automount(nd->path.dentry);
        if (IS_ERR(newmnt)) {
-               path_release(nd);
+               path_put(&nd->path);
                return (void *)newmnt;
        }
 
index a119c863ff37adc8a79540e299ca18ceeb8919a5..a54a946a50ae55bc44f04142565834527f07d524 100644 (file)
@@ -383,7 +383,7 @@ done:
        return NULL;
 
 out_error:
-       path_release(nd);
+       path_put(&nd->path);
        return ERR_PTR(status);
 }
 
index 5f4721fdbdb6f647d0ebf28e69978a20b0b5649a..67fe72ce6ac7b0f2795a15cb17ae67f25244de67 100644 (file)
@@ -1409,7 +1409,7 @@ struct block_device *lookup_bdev(const char *path)
        if (!bdev)
                goto fail;
 out:
-       path_release(&nd);
+       path_put(&nd.path);
        return bdev;
 fail:
        bdev = ERR_PTR(error);
index bcd53c2fe78132bab81095fe4e08051fb5390e9d..6ad447529961c0939c84b1eba822cb7076e3817d 100644 (file)
@@ -368,7 +368,7 @@ out:
        cFYI(1, ("leaving %s" , __FUNCTION__));
        return ERR_PTR(rc);
 out_err:
-       path_release(nd);
+       path_put(&nd->path);
        goto out;
 }
 
index 3b6a1b721b469ab9aeeffc77574ed47d2d98da46..c21a1f552a63bf0ca7ef5d09905a326036f0e844 100644 (file)
@@ -80,7 +80,7 @@ static int coda_pioctl(struct inode * inode, struct file * filp,
        
        /* 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 @@ static int coda_pioctl(struct inode * inode, struct file * filp,
 
        error = venus_pioctl(inode->i_sb, &(cnp->c_fid), cmd, &data);
 
-       path_release(&nd);
+       path_put(&nd.path);
         return error;
 }
 
index a8d62375ada18e7eaa4918bf5aee737f84ebc526..43ca0165740c09d6384fff4bce30279aca3e8ab4 100644 (file)
@@ -244,7 +244,7 @@ asmlinkage long compat_sys_statfs(const char __user *path, struct compat_statfs
                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 @@ asmlinkage long compat_sys_statfs64(const char __user *path, compat_size_t sz, s
                error = vfs_statfs(nd.path.dentry, &tmp);
                if (!error)
                        error = put_compat_statfs64(buf, &tmp);
-               path_release(&nd);
+               path_put(&nd.path);
        }
        return error;
 }
index cda3ea001ae6d927ba0390f1e954acc0236154a8..78929ea84ff2da08688619b2b83d74700ca0dc25 100644 (file)
@@ -103,7 +103,7 @@ static int get_target(const char *symname, struct nameidata *nd,
                        *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 @@ int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symna
                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);
index 289f48d2c72778b19c72db05d75abbfff727cf30..9c7feb62eed153ae9ef923c4767d506a14250189 100644 (file)
@@ -1643,7 +1643,7 @@ int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path)
                error = vfs_quota_on_inode(nd.path.dentry->d_inode, type,
                                           format_id);
 out_path:
-       path_release(&nd);
+       path_put(&nd.path);
        return error;
 }
 
index a70555a6472c7880a5a01e7633f7540a4e83f78c..d25ac9500a92bd31282f477461161f7ac6cbfeb5 100644 (file)
@@ -526,7 +526,7 @@ static int ecryptfs_read_super(struct super_block *sb, const char *dev_name)
        rc = 0;
        goto out;
 out_free:
-       path_release(&nd);
+       path_put(&nd.path);
 out:
        return rc;
 }
index 7a12d2d1ac11f554d30da121dde26887cd3933f8..a44b142fb4607baee2d832b1056103b5d157e5a7 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -148,7 +148,7 @@ out:
        return error;
 exit:
        release_open_intent(&nd);
-       path_release(&nd);
+       path_put(&nd.path);
        goto out;
 }
 
@@ -672,7 +672,7 @@ out:
                        }
                }
                release_open_intent(&nd);
-               path_release(&nd);
+               path_put(&nd.path);
        }
        goto out;
 }
index 0b5057e0dc1e2c72df39807c10857e86142700da..18769cc3237703e3426012378b31ca2e8c6024aa 100644 (file)
@@ -2759,7 +2759,7 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id,
                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 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id,
                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);
 }
 
index 37117990073de840780e5175624df73f5a5b8326..13383ba18f1d72d1440a90e021bf21bffb24d039 100644 (file)
@@ -3159,7 +3159,7 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
                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 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
                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);
 }
 
index f4ced7fcda8215499297c071bdd0de942679be0e..4bee6aa845e430d00ec4254277f9fa91aa5d5175 100644 (file)
@@ -900,7 +900,7 @@ static struct super_block* get_gfs2_sb(const char *dev_name)
               "mount point %s\n", dev_name);
 
 free_nd:
-       path_release(&nd);
+       path_put(&nd.path);
 out:
        return sb;
 }
index e9c58652533aacddc9a81672421c1bde37a23f75..7b94a1e3c015468b30e6343156053fd5e409afca 100644 (file)
@@ -367,7 +367,7 @@ static int find_inode(const char __user *dirname, struct nameidata *nd,
        /* 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 @@ asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask)
                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;
index c9b05a71c39cbdcf10415984d8644d8c16a68a6e..b0df7ea733d7debb7b57171da9a2d9e347527f48 100644 (file)
@@ -362,11 +362,18 @@ int deny_write_access(struct file * file)
        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 @@ static __always_inline int __vfs_follow_link(struct nameidata *nd, const char *l
                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 @@ out:
         */
        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 @@ static inline int do_follow_link(struct path *path, struct nameidata *nd)
        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_reval:
 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 @@ static int __emul_lookup_dentry(const char *name, struct nameidata *nd)
                                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 @@ static int __path_lookup_intent_open(int dfd, const char *name,
        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 @@ ok:
        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 @@ asmlinkage long sys_mknodat(int dfd, const char __user *filename, int mode,
                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 @@ asmlinkage long sys_mkdirat(int dfd, const char __user *pathname, int mode)
        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 @@ static long do_rmdir(int dfd, const char __user *pathname)
 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 @@ static long do_unlinkat(int dfd, const char __user *pathname)
        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 @@ asmlinkage long sys_symlinkat(const char __user *oldname,
        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 @@ asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
 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 @@ exit4:
 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);
 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);
index 5d9fd4c6d1f5d6a27d5f75ba2bd1fa127d1e3a9d..c77eedd2ac6696ffc15f582df5d3ab010845f44a 100644 (file)
@@ -1007,7 +1007,7 @@ static noinline int do_loopback(struct nameidata *nd, char *old_name,
 
 out:
        up_write(&namespace_sem);
-       path_release(&old_nd);
+       path_put(&old_nd.path);
        return err;
 }
 
@@ -1126,8 +1126,8 @@ out1:
 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 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
                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 @@ asmlinkage long sys_pivot_root(const char __user * new_root,
 
        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 @@ asmlinkage long sys_pivot_root(const char __user * new_root,
        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;
index 3b6d83dc98a7524cc7ad13cc0a925af74b5b7804..607f6eb9cdb519f549ce19e590470d24e52ed90e 100644 (file)
@@ -148,7 +148,7 @@ out:
        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) &&
index 49ef0b4d4439d51905be6edd66612e7f48d3c2a7..aed8145d9087e053a9349a46c07bd03ac6b02ed5 100644 (file)
@@ -43,7 +43,7 @@ static struct file *do_open(char *name, int flags)
        if (!error)
                return dentry_open(nd.path.dentry, nd.path.mnt, flags);
 
-       path_release(&nd);
+       path_put(&nd.path);
        return ERR_PTR(error);
 }
 
index 2ac0e30285c2ce37e105a6a0b7cdfcb4b2605290..717413f07e9a3f20d7b242e6e2090d98941fd875 100644 (file)
@@ -177,7 +177,7 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
                        cache_put(&ek->h, &svc_expkey_cache);
                else
                        err = -ENOMEM;
-               path_release(&nd);
+               path_put(&nd.path);
        }
        cache_flush();
  out:
@@ -630,7 +630,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
        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 @@ finish:
                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 @@ exp_unexport(struct nfsctl_export *nxp)
 
        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 @@ exp_rootfh(svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
        fh_put(&fh);
        exp_put(exp);
 out:
-       path_release(&nd);
+       path_put(&nd.path);
        return err;
 }
 
index a7a8fdf86ea7207740ffcb76a9bf9be4cac4c14e..1ff90625860f712397e9251d328ac3708d43b5b8 100644 (file)
@@ -415,5 +415,5 @@ nfsd4_shutdown_recdir(void)
        if (!rec_dir_init)
                return;
        rec_dir_init = 0;
-       path_release(&rec_dir);
+       path_put(&rec_dir.path);
 }
index be2b9ecd230ab17f95ba5ac295ad4e8c958d0bce..bcb97d8e8b8bd6791a6161eb216ecba76a6e712d 100644 (file)
@@ -3265,7 +3265,7 @@ nfs4_reset_recoverydir(char *recdir)
                nfs4_set_recdir(recdir);
                status = 0;
        }
-       path_release(&nd);
+       path_put(&nd.path);
        return status;
 }
 
index 279aacf256001b356e42da929dc8149c054d5029..ca8ac4bbd3bd8d8419467f61f510ed3a7e7bddec 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -130,7 +130,7 @@ asmlinkage long sys_statfs(const char __user * path, struct statfs __user * buf)
                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 @@ asmlinkage long sys_statfs64(const char __user *path, size_t sz, struct statfs64
                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 @@ static long do_sys_truncate(const char __user * path, loff_t length)
 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 @@ asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode)
                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 @@ asmlinkage long sys_chdir(const char __user * filename)
        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 @@ asmlinkage long sys_chroot(const char __user * filename)
        set_fs_altroot();
        error = 0;
 dput_and_out:
-       path_release(&nd);
+       path_put(&nd.path);
 out:
        return error;
 }
@@ -621,7 +621,7 @@ asmlinkage long sys_fchmodat(int dfd, const char __user *filename,
        mutex_unlock(&inode->i_mutex);
 
 dput_and_out:
-       path_release(&nd);
+       path_put(&nd.path);
 out:
        return error;
 }
@@ -676,7 +676,7 @@ asmlinkage long sys_chown(const char __user * filename, uid_t user, gid_t group)
        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 @@ asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user,
        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 @@ asmlinkage long sys_lchown(const char __user * filename, uid_t user, gid_t group
        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 @@ struct file *nameidata_to_filp(struct nameidata *nd, int flags)
                filp = __dentry_open(nd->path.dentry, nd->path.mnt, flags, filp,
                                     NULL);
        else
-               path_release(nd);
+               path_put(&nd->path);
        return filp;
 }
 
index 0ef52230f8c7f14f1adf4b2b8a12805780af0069..c742be48348f9c211969ca09153b43b5471b8138 100644 (file)
@@ -1164,7 +1164,7 @@ static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd)
        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))
index 2d1d6ac0c3f7b4847f1a5be9df6cd1dba2047bff..6841452e0dea00620cd2053f9cd02356f94f6169 100644 (file)
@@ -2027,20 +2027,20 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
                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 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
                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);
 }
 
index 82680f2c01d2d14805232fe48e1e0d90edb78738..9cf41f719d50d18adf2fca7a6582b0ecfdc506aa 100644 (file)
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -63,7 +63,7 @@ int vfs_stat_fd(int dfd, char __user *name, struct kstat *stat)
        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 @@ int vfs_lstat_fd(int dfd, char __user *name, struct kstat *stat)
        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 @@ asmlinkage long sys_readlinkat(int dfd, const char __user *path,
                                                              buf, bufsiz);
                        }
                }
-               path_release(&nd);
+               path_put(&nd.path);
        }
        return error;
 }
index 679b08288a660c8ed5c7ccdd7636f3e2d7c0bc38..b18da9c0b97f5f03185b13678ac0ca16932d9c70 100644 (file)
@@ -138,7 +138,7 @@ dput_and_out:
        if (f)
                fput(f);
        else
-               path_release(&nd);
+               path_put(&nd.path);
 out:
        return error;
 }
index be0ee756c5f19b6519618d96c39c0d341b207f4d..3acab16154608724f5558458eea5cac2a00b0b5a 100644 (file)
@@ -263,7 +263,7 @@ sys_setxattr(char __user *path, char __user *name, void __user *value,
        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 @@ sys_lsetxattr(char __user *path, char __user *name, void __user *value,
        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 @@ sys_getxattr(char __user *path, char __user *name, void __user *value,
        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 @@ sys_lgetxattr(char __user *path, char __user *name, void __user *value,
        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 @@ sys_listxattr(char __user *path, char __user *list, size_t size)
        if (error)
                return error;
        error = listxattr(nd.path.dentry, list, size);
-       path_release(&nd);
+       path_put(&nd.path);
        return error;
 }
 
@@ -436,7 +436,7 @@ sys_llistxattr(char __user *path, char __user *list, size_t size)
        if (error)
                return error;
        error = listxattr(nd.path.dentry, list, size);
-       path_release(&nd);
+       path_put(&nd.path);
        return error;
 }
 
@@ -483,7 +483,7 @@ sys_removexattr(char __user *path, char __user *name)
        if (error)
                return error;
        error = removexattr(nd.path.dentry, name);
-       path_release(&nd);
+       path_put(&nd.path);
        return error;
 }
 
@@ -497,7 +497,7 @@ sys_lremovexattr(char __user *path, char __user *name)
        if (error)
                return error;
        error = removexattr(nd.path.dentry, name);
-       path_release(&nd);
+       path_put(&nd.path);
        return error;
 }
 
index f052a108bcc19063c804f98ab8927a6b22e2e148..a9952e490ac9c7458cc5110e7d84b09fc45c867b 100644 (file)
@@ -94,7 +94,7 @@ xfs_find_handle(
                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;
        }
 
index 52fa2f78bb71f103b8bea633f4e3a96ee4cc5906..24d88e98a62648180a553fdfb457837bcbcb5c00 100644 (file)
@@ -66,7 +66,6 @@ extern int __user_walk_fd(int dfd, const char __user *, unsigned, struct nameida
 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);
index cbebdc5c9a60be0320cf9d20af1968992674c9cf..4d976f959f338b54eb810a14e89f4ff1c1a9d6fe 100644 (file)
@@ -9,4 +9,6 @@ struct path {
        struct dentry *dentry;
 };
 
+extern void path_put(struct path *);
+
 #endif  /* _LINUX_PATH_H */
index b898814fe4a08f38fd00f308058a36496d4fa837..9ef5e0aacc3cd5461d203b2a998f40186f02dd8a 100644 (file)
@@ -550,7 +550,7 @@ void audit_trim_trees(void)
                        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 @@ int audit_add_tree_rule(struct audit_krule *rule)
        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 @@ int audit_tag_tree(char *old, char *new)
        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 @@ int audit_tag_tree(char *old, char *new)
        }
        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 @@ int audit_tag_tree(char *old, char *new)
                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);
index a36e66797c3d871a4381647aebfb3f3926fd5dcf..2f2914b7cc302136c223b6bd44ff49ea6a30de24 100644 (file)
@@ -1161,11 +1161,11 @@ static int audit_get_nd(char *path, struct nameidata **ndp,
 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);
        }
 }
index 6bc3babf617564efb95b27db64060ce96aba507d..1b395a41a8b2336f9d7ce73dad93549129945248 100644 (file)
@@ -495,7 +495,7 @@ rpc_lookup_parent(char *path, struct nameidata *nd)
 static void
 rpc_release_path(struct nameidata *nd)
 {
-       path_release(nd);
+       path_put(&nd->path);
        rpc_put_mount();
 }
 
index 7c3323e8827bc183fd29e3c5aa8b6e14e8e44016..b8788fd5e3c6ded44c09994f80f3ce84d6975405 100644 (file)
@@ -727,7 +727,7 @@ static struct sock *unix_find_other(struct net *net,
                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 @@ static struct sock *unix_find_other(struct net *net,
        return u;
 
 put_fail:
-       path_release(&nd);
+       path_put(&nd.path);
 fail:
        *error=err;
        return NULL;
@@ -862,7 +862,7 @@ out_mknod_dput:
        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;