]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/namei.c
fs: fix do_lookup false negative
[net-next-2.6.git] / fs / namei.c
index 42d2d28fb827c41f5aad101e0faa340ac2dfa332..c2742b7dec595207aed06e78fec1bffed8c9db70 100644 (file)
@@ -483,13 +483,8 @@ ok:
 
 static __always_inline void set_root(struct nameidata *nd)
 {
-       if (!nd->root.mnt) {
-               struct fs_struct *fs = current->fs;
-               read_lock(&fs->lock);
-               nd->root = fs->root;
-               path_get(&nd->root);
-               read_unlock(&fs->lock);
-       }
+       if (!nd->root.mnt)
+               get_fs_root(current->fs, &nd->root);
 }
 
 static int link_path_walk(const char *, struct nameidata *);
@@ -714,6 +709,7 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
        dentry = __d_lookup(nd->path.dentry, name);
        if (!dentry)
                goto need_lookup;
+found:
        if (dentry->d_op && dentry->d_op->d_revalidate)
                goto need_revalidate;
 done:
@@ -771,14 +767,7 @@ out_unlock:
         * we waited on the semaphore. Need to revalidate.
         */
        mutex_unlock(&dir->i_mutex);
-       if (dentry->d_op && dentry->d_op->d_revalidate) {
-               dentry = do_revalidate(dentry, nd);
-               if (!dentry)
-                       dentry = ERR_PTR(-ENOENT);
-       }
-       if (IS_ERR(dentry))
-               goto fail;
-       goto done;
+       goto found;
 
 need_revalidate:
        dentry = do_revalidate(dentry, nd);
@@ -1015,11 +1004,7 @@ static int path_init(int dfd, const char *name, unsigned int flags, struct namei
                nd->path = nd->root;
                path_get(&nd->root);
        } else if (dfd == AT_FDCWD) {
-               struct fs_struct *fs = current->fs;
-               read_lock(&fs->lock);
-               nd->path = fs->pwd;
-               path_get(&fs->pwd);
-               read_unlock(&fs->lock);
+               get_fs_pwd(current->fs, &nd->path);
        } else {
                struct dentry *dentry;
 
@@ -2633,7 +2618,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 {
        int error;
        int is_dir = S_ISDIR(old_dentry->d_inode->i_mode);
-       const char *old_name;
+       const unsigned char *old_name;
 
        if (old_dentry->d_inode == new_dentry->d_inode)
                return 0;