nfsctl: use vfs_path_lookup
authorJosef 'Jeff' Sipek <jsipek@cs.sunysb.edu>
Thu, 19 Jul 2007 08:48:21 +0000 (01:48 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 19 Jul 2007 17:04:45 +0000 (10:04 -0700)
use vfs_path_lookup instead of open-coding the necessary functionality.

Signed-off-by: Josef 'Jeff' Sipek <jsipek@cs.sunysb.edu>
Acked-by: NeilBrown <neilb@suse.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Christoph Hellwig <hch@lst.de>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Michael Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/nfsctl.c

index c043136a82caa862d9b72d7196047765490064a0..51f1b31acbf69c7a2aad8877f5b34c9fe19d6ec3 100644 (file)
 static struct file *do_open(char *name, int flags)
 {
        struct nameidata nd;
+       struct vfsmount *mnt;
        int error;
 
-       nd.mnt = do_kern_mount("nfsd", 0, "nfsd", NULL);
+       mnt = do_kern_mount("nfsd", 0, "nfsd", NULL);
+       if (IS_ERR(mnt))
+               return (struct file *)mnt;
 
-       if (IS_ERR(nd.mnt))
-               return (struct file *)nd.mnt;
-
-       nd.dentry = dget(nd.mnt->mnt_root);
-       nd.last_type = LAST_ROOT;
-       nd.flags = 0;
-       nd.depth = 0;
-
-       error = path_walk(name, &nd);
+       error = vfs_path_lookup(mnt->mnt_root, mnt, name, 0, &nd);
+       mntput(mnt);    /* drop do_kern_mount reference */
        if (error)
                return ERR_PTR(error);