Commit 16b6287a5286e872abece4f42a6eb5899157a836

Authored by Josef 'Jeff' Sipek
Committed by Linus Torvalds
1 parent 4ac4efc1f5

nfsctl: use vfs_path_lookup

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>

Showing 1 changed file with 6 additions and 10 deletions Side-by-side Diff

... ... @@ -23,19 +23,15 @@
23 23 static struct file *do_open(char *name, int flags)
24 24 {
25 25 struct nameidata nd;
  26 + struct vfsmount *mnt;
26 27 int error;
27 28  
28   - nd.mnt = do_kern_mount("nfsd", 0, "nfsd", NULL);
  29 + mnt = do_kern_mount("nfsd", 0, "nfsd", NULL);
  30 + if (IS_ERR(mnt))
  31 + return (struct file *)mnt;
29 32  
30   - if (IS_ERR(nd.mnt))
31   - return (struct file *)nd.mnt;
32   -
33   - nd.dentry = dget(nd.mnt->mnt_root);
34   - nd.last_type = LAST_ROOT;
35   - nd.flags = 0;
36   - nd.depth = 0;
37   -
38   - error = path_walk(name, &nd);
  33 + error = vfs_path_lookup(mnt->mnt_root, mnt, name, 0, &nd);
  34 + mntput(mnt); /* drop do_kern_mount reference */
39 35 if (error)
40 36 return ERR_PTR(error);
41 37