From: Christoph Hellwig <hch@infradead.org>
To: Josef 'Jeff' Sipek <jsipek@cs.sunysb.edu>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
hch@infradead.org, akpm@linux-foundation.org,
viro@ftp.linux.org.uk, Trond.Myklebust@netapp.com, neilb@suse.de,
mhalcrow@us.ibm.com
Subject: Re: [PATCH 3/5] nfsctl: Use vfs_path_lookup
Date: Sun, 6 May 2007 22:19:46 +0100 [thread overview]
Message-ID: <20070506211946.GC13333@infradead.org> (raw)
In-Reply-To: <1178473290774-git-send-email-jsipek@cs.sunysb.edu>
On Sun, May 06, 2007 at 01:41:27PM -0400, Josef 'Jeff' Sipek wrote:
> use vfs_path_lookup instead of open-coding the necessary functionality.
>
> Signed-off-by: Josef 'Jeff' Sipek <jsipek@cs.sunysb.edu>
> ---
> fs/nfsctl.c | 15 +++++----------
> 1 files changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/fs/nfsctl.c b/fs/nfsctl.c
> index c043136..c97df14 100644
> --- a/fs/nfsctl.c
> +++ b/fs/nfsctl.c
> @@ -23,19 +23,14 @@
> 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);
> if (error)
> return ERR_PTR(error);
I think you're leaking a reference on the mount here as we didn't
do a mntget before. We need to do an additional mntput just after
the lookup to drop the reference from do_kern_mount.
next prev parent reply other threads:[~2007-05-06 21:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-06 17:41 [PATCH 0/5] [RFC] New path lookup function (V3) Josef 'Jeff' Sipek
2007-05-06 17:41 ` [PATCH 1/5] fs: Introduce vfs_path_lookup Josef 'Jeff' Sipek
2007-05-06 21:18 ` Christoph Hellwig
2007-05-06 17:41 ` [PATCH 2/5] sunrpc: Use vfs_path_lookup Josef 'Jeff' Sipek
2007-05-06 21:18 ` Christoph Hellwig
2007-05-06 17:41 ` [PATCH 3/5] nfsctl: " Josef 'Jeff' Sipek
2007-05-06 21:19 ` Christoph Hellwig [this message]
2007-05-06 22:13 ` [PATCH 1/1] " Josef 'Jeff' Sipek
2007-05-07 1:59 ` Neil Brown
2007-05-06 17:41 ` [PATCH 4/5] fs: Mark link_path_walk static Josef 'Jeff' Sipek
2007-05-06 21:20 ` Christoph Hellwig
2007-05-06 21:46 ` Josef 'Jeff' Sipek
2007-05-06 17:41 ` [PATCH 5/5] fs: Remove path_walk export Josef 'Jeff' Sipek
2007-05-06 21:20 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2007-05-24 1:54 [PATCH 0/5] New path lookup function (V4) Josef 'Jeff' Sipek
2007-05-24 1:54 ` [PATCH 3/5] nfsctl: Use vfs_path_lookup Josef 'Jeff' Sipek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070506211946.GC13333@infradead.org \
--to=hch@infradead.org \
--cc=Trond.Myklebust@netapp.com \
--cc=akpm@linux-foundation.org \
--cc=jsipek@cs.sunysb.edu \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhalcrow@us.ibm.com \
--cc=neilb@suse.de \
--cc=viro@ftp.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).