All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/4] NFS: Use common device name parsing logic for NFSv4 and NFSv2/v3
Date: Tue, 17 Jun 2008 16:37:39 -0400	[thread overview]
Message-ID: <1213735059.7288.29.camel@localhost> (raw)
In-Reply-To: <1213734797.7288.27.camel@localhost>

On Tue, 2008-06-17 at 16:33 -0400, Trond Myklebust wrote:
> On Tue, 2008-06-17 at 14:17 -0400, Chuck Lever wrote:
> > To support passing a raw IPv6 address as a server hostname, we need to
> > expand the logic that handles splitting the passed-in device name into
> > a server hostname and export path
> > 
> > Start by pulling device name parsing out of the mount option validation
> > functions and into separate helper functions.
> > 
> > Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> > ---
> > 
> >  fs/nfs/super.c |  124 ++++++++++++++++++++++++++++++++++++--------------------
> >  1 files changed, 79 insertions(+), 45 deletions(-)
> > 
> > 
> > diff --git a/fs/nfs/super.c b/fs/nfs/super.c
> > index d884f52..5e0eefa 100644
> > --- a/fs/nfs/super.c
> > +++ b/fs/nfs/super.c
> > @@ -1216,6 +1216,67 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
> >  }
> >  
> >  /*
> > + * Split "dev_name" into "hostname:export_path".
> > + *
> > + * Note: caller frees hostname and export path, even on error.
> > + */
> > +static int nfs_parse_devname(const char *dev_name,
> > +			     char **hostname, size_t maxnamlen,
> > +			     char **export_path, size_t maxpathlen)
> > +{
> > +	size_t len;
> > +	char *colon, *comma;
> > +
> > +	colon = strchr(dev_name, ':');
> > +	if (colon == NULL)
> > +		goto out_bad_devname;
> > +
> > +	len = colon - dev_name;
> > +	if (len > maxnamlen)
> > +		goto out_hostname;
> > +
> > +	/* N.B. caller will free nfs_server.hostname in all cases */
> > +	*hostname = kstrndup(dev_name, len, GFP_KERNEL);
> > +	if (!*hostname)
> > +		goto out_nomem;
> > +
> > +	/* kill possible hostname list: not supported */
> > +	comma = strchr(*hostname, ',');
> > +	if (comma != NULL) {
> > +		if (comma == *hostname)
> > +			goto out_bad_devname;
> 
> Won't this and subsequent errors leak memory in *hostname?

Sorry. I missed the fact that nfs_get_sb() and nfs4_get_sb() will do it
for us...

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com

  reply	other threads:[~2008-06-17 20:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-17 18:17 [PATCH 0/4] NFS mounting with raw IPv6 server hostnames Chuck Lever
     [not found] ` <20080617181622.3215.61295.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-06-17 18:17   ` [PATCH 1/4] NFS: Use common device name parsing logic for NFSv4 and NFSv2/v3 Chuck Lever
     [not found]     ` <20080617181719.3215.5824.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-06-17 20:33       ` Trond Myklebust
2008-06-17 20:37         ` Trond Myklebust [this message]
2008-06-17 20:47           ` Chuck Lever
2008-06-17 20:41         ` Chuck Lever
2008-06-17 18:17   ` [PATCH 2/4] NFS: Support raw IPv6 address hostnames during NFS mount operation Chuck Lever
2008-06-17 18:17   ` [PATCH 3/4] NFS: Add string length argument to nfs_parse_server_address Chuck Lever
2008-06-17 18:17   ` [PATCH 4/4] NFS: handle interface identifiers in incoming IPv6 addresses Chuck Lever
2008-06-18  0:07   ` [PATCH 0/4] NFS mounting with raw IPv6 server hostnames Trond Myklebust
  -- strict thread matches above, loose matches on Subject: below --
2008-06-23 16:36 [PATCH 0/4] NFS mounting with raw IPv6 server hostnames (take 3) Chuck Lever
     [not found] ` <20080623163129.10539.15565.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-06-23 16:36   ` [PATCH 1/4] NFS: Use common device name parsing logic for NFSv4 and NFSv2/v3 Chuck Lever
2008-06-18 22:31 [PATCH 0/4] NFS mounting with raw IPv6 server hostnames (take 2) Chuck Lever
     [not found] ` <20080618222951.16006.3679.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-06-18 22:31   ` [PATCH 1/4] NFS: Use common device name parsing logic for NFSv4 and NFSv2/v3 Chuck Lever
2008-05-18 21:19 [PATCH 0/4] RFC: raw IPv6 address parsing in NFS client Chuck Lever
2008-05-18 21:20 ` [PATCH 1/4] NFS: Use common device name parsing logic for NFSv4 and NFSv2/v3 Chuck Lever

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=1213735059.7288.29.camel@localhost \
    --to=trond.myklebust@netapp.com \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.