All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: Malahal Naineni <malahal@us.ibm.com>
Cc: <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] Check for beginning '/' in the mount path
Date: Fri, 3 Feb 2012 13:15:12 +0200	[thread overview]
Message-ID: <4F2BC1C0.8070900@panasas.com> (raw)
In-Reply-To: <1328233332-26020-1-git-send-email-malahal@us.ibm.com>

On 02/03/2012 03:42 AM, Malahal Naineni wrote:
> NFSv4 gladly accepts and mounts "hostname:path" instead of
> "hostname:/path". This causes mount entry mistmatch between /etc/mtab
> and /proc/mounts files. The former will have "hostname:path" but the
> latter will have "hostname:/path". This causes umount not work at all.
> 

NACK

like it or not you are changing ABI. Bunch of systems will not work now.

Also some other NFS servers/clients support it fine. Actually some servers
make it a special case. (It's called mount by tag)

The bug is else where fix it there. Either add the preceding '/' to
/etc/mtab or remove it from /proc/mounts (I prefer the later). Or
fix umount to work with that case.

It's just a bug please fix it.

Boaz

> Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
> ---
>  utils/mount/stropts.c |   22 ++++++++++++++++++++++
>  1 files changed, 22 insertions(+), 0 deletions(-)
> 
> diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
> index d52e21a..559114d 100644
> --- a/utils/mount/stropts.c
> +++ b/utils/mount/stropts.c
> @@ -571,6 +571,7 @@ static int nfs_sys_mount(struct nfsmount_info *mi, struct mount_options *opts)
>  {
>  	char *options = NULL;
>  	int result;
> +	char *dirname;
>  
>  	if (mi->fake)
>  		return 1;
> @@ -580,6 +581,27 @@ static int nfs_sys_mount(struct nfsmount_info *mi, struct mount_options *opts)
>  		return 0;
>  	}
>  
> +	/*
> +	 * Make sure that dirname in the spec starts with '/'. The mount
> +	 * works fine in NFSv4 without the '/', but then /etc/mtab and
> +	 * /proc/mounts disagree on the actual mount entry causing later
> +	 * umount to fail! There is no reason to allow any dirname not
> +	 * starting with '/', so fail it here.
> +	 *
> +	 * Note that for NFSv2 and NFSv3, the mount call itself fails if
> +	 * dirname doesn't start with '/'. So this check is only useful
> +	 * for NFSv4.
> +	 */
> +	dirname = strchr(mi->spec, ']');	/* IPv6 address check */
> +	if (dirname)
> +		dirname = strchr(dirname+1, ':');
> +	else
> +		dirname = strchr(mi->spec, ':');
> +	if (!dirname || *(dirname+1) != '/') {
> +		errno = EINVAL;
> +		return 0;
> +	}
> +
>  	result = mount(mi->spec, mi->node, mi->type,
>  			mi->flags & ~(MS_USER|MS_USERS), options);
>  	free(options);


  reply	other threads:[~2012-02-03 11:15 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-03  1:42 [PATCH] Check for beginning '/' in the mount path Malahal Naineni
2012-02-03 11:15 ` Boaz Harrosh [this message]
2012-02-03 12:16   ` NeilBrown
2012-02-03 14:29     ` Malahal Naineni
2012-02-05 11:03       ` Boaz Harrosh
2012-02-06 18:11         ` Malahal Naineni
2012-02-07 20:44         ` [PATCH] Get normalized paths for comparing NFS export paths Malahal Naineni
2012-02-16 18:09           ` Malahal Naineni
2012-03-02 19:10           ` Steve Dickson
2012-03-02 19:27             ` Malahal Naineni
2012-03-02 20:57               ` Steve Dickson
2012-03-02 22:01                 ` Malahal Naineni
2012-03-03 17:39                   ` Steve Dickson
2012-03-03 19:12                     ` Myklebust, Trond
2012-03-04 22:31                       ` Steve Dickson
2012-03-04 22:46                         ` Myklebust, Trond
2012-03-04 23:08                           ` Steve Dickson
2012-03-05  4:46                           ` Malahal Naineni
2012-03-05 12:03                             ` Steve Dickson
2012-03-04 22:58                         ` Steve Dickson
2012-03-04 23:26                           ` Myklebust, Trond
2012-03-05  0:03                             ` Steve Dickson
2012-03-05  2:04                               ` Myklebust, Trond
2012-03-05  4:53                                 ` Malahal Naineni
2012-03-05 11:55                                 ` Steve Dickson
2012-03-05 14:47                                   ` Malahal Naineni
2012-03-05 15:03                                     ` Steve Dickson

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=4F2BC1C0.8070900@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=malahal@us.ibm.com \
    /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.