linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nfs: use canonical path in nfs_show_devname
       [not found] <600788954.21849581.1408502615727.JavaMail.zimbra@redhat.com>
@ 2014-08-20  3:06 ` Xiong Zhou
  2014-08-20 23:10   ` Ben Hutchings
  0 siblings, 1 reply; 5+ messages in thread
From: Xiong Zhou @ 2014-08-20  3:06 UTC (permalink / raw)
  To: trond.myklebust; +Cc: linux-nfs, ben, linux-kernel


When export root dir(/) via nfs, and mount a particular dir under root, eg
/nfsexport, there will be defect double slash output in /proc/mounts, like
localhost://nfsexport.

Signed-off-by: Xiong Zhou <xzhou@redhat.com>
---
 fs/nfs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index e4499d5..62b1cab 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -780,7 +780,7 @@ int nfs_show_devname(struct seq_file *m, struct dentry *root)
 	int err = 0;
 	if (!page)
 		return -ENOMEM;
-	devname = nfs_path(&dummy, root, page, PAGE_SIZE, 0);
+	devname = nfs_path(&dummy, root, page, PAGE_SIZE, 1);
 	if (IS_ERR(devname))
 		err = PTR_ERR(devname);
 	else
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] nfs: use canonical path in nfs_show_devname
  2014-08-20  3:06 ` [PATCH] nfs: use canonical path in nfs_show_devname Xiong Zhou
@ 2014-08-20 23:10   ` Ben Hutchings
  2014-08-25  5:51     ` [PATCH v2] nfs: remove redundant slash from nfs_path Xiong Zhou
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Hutchings @ 2014-08-20 23:10 UTC (permalink / raw)
  To: Xiong Zhou; +Cc: trond.myklebust, linux-nfs, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1003 bytes --]

On Tue, 2014-08-19 at 23:06 -0400, Xiong Zhou wrote:
> When export root dir(/) via nfs, and mount a particular dir under root, eg
> /nfsexport, there will be defect double slash output in /proc/mounts, like
> localhost://nfsexport.
> 
> Signed-off-by: Xiong Zhou <xzhou@redhat.com>
> ---
>  fs/nfs/super.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/nfs/super.c b/fs/nfs/super.c
> index e4499d5..62b1cab 100644
> --- a/fs/nfs/super.c
> +++ b/fs/nfs/super.c
> @@ -780,7 +780,7 @@ int nfs_show_devname(struct seq_file *m, struct dentry *root)
>  	int err = 0;
>  	if (!page)
>  		return -ENOMEM;
> -	devname = nfs_path(&dummy, root, page, PAGE_SIZE, 0);
> +	devname = nfs_path(&dummy, root, page, PAGE_SIZE, 1);
>  	if (IS_ERR(devname))
>  		err = PTR_ERR(devname);
>  	else

This will reintroduce the problem reported in
<https://bugs.debian.org/669314>.

Ben.

-- 
Ben Hutchings
If at first you don't succeed, you're doing about average.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] nfs: remove redundant slash from nfs_path
  2014-08-20 23:10   ` Ben Hutchings
@ 2014-08-25  5:51     ` Xiong Zhou
  2014-08-25 21:07       ` Ben Hutchings
  0 siblings, 1 reply; 5+ messages in thread
From: Xiong Zhou @ 2014-08-25  5:51 UTC (permalink / raw)
  To: Ben Hutchings, trond myklebust; +Cc: linux-nfs, linux-kernel

When export root dir(/) via nfs, and mount a particular dir under root, eg
/nfsexport, there will be defect double slash output in /proc/mounts, like
localhost://nfsexport. While this patch change it to localhost:/nfsexport.

Signed-off-by: Xiong Zhou <xzhou@redhat.com>
---
 fs/nfs/namespace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
index b5a0afc..24f954e 100644
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
@@ -98,7 +98,7 @@ rename_retry:
 		return end;
 	}
 	namelen = strlen(base);
-	if (flags & NFS_PATH_CANONICAL) {
+	if ((flags & NFS_PATH_CANONICAL) || *end == '/') {
 		/* Strip off excess slashes in base string */
 		while (namelen > 0 && base[namelen - 1] == '/')
 			namelen--;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] nfs: remove redundant slash from nfs_path
  2014-08-25  5:51     ` [PATCH v2] nfs: remove redundant slash from nfs_path Xiong Zhou
@ 2014-08-25 21:07       ` Ben Hutchings
  2014-08-25 21:17         ` Trond Myklebust
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Hutchings @ 2014-08-25 21:07 UTC (permalink / raw)
  To: Xiong Zhou; +Cc: trond myklebust, linux-nfs, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1053 bytes --]

On Mon, 2014-08-25 at 01:51 -0400, Xiong Zhou wrote:
> When export root dir(/) via nfs, and mount a particular dir under root, eg
> /nfsexport, there will be defect double slash output in /proc/mounts, like
> localhost://nfsexport. While this patch change it to localhost:/nfsexport.
> 
> Signed-off-by: Xiong Zhou <xzhou@redhat.com>
> ---
>  fs/nfs/namespace.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
> index b5a0afc..24f954e 100644
> --- a/fs/nfs/namespace.c
> +++ b/fs/nfs/namespace.c
> @@ -98,7 +98,7 @@ rename_retry:
>  		return end;
>  	}
>  	namelen = strlen(base);
> -	if (flags & NFS_PATH_CANONICAL) {
> +	if ((flags & NFS_PATH_CANONICAL) || *end == '/') {
>  		/* Strip off excess slashes in base string */
>  		while (namelen > 0 && base[namelen - 1] == '/')
>  			namelen--;

I think this makes sense, though I'm not sure I completely understand
this function. :-/

Ben.

-- 
Ben Hutchings
All extremists should be taken out and shot.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] nfs: remove redundant slash from nfs_path
  2014-08-25 21:07       ` Ben Hutchings
@ 2014-08-25 21:17         ` Trond Myklebust
  0 siblings, 0 replies; 5+ messages in thread
From: Trond Myklebust @ 2014-08-25 21:17 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Xiong Zhou, Linux NFS Mailing List, Linux Kernel mailing list

On Mon, Aug 25, 2014 at 5:07 PM, Ben Hutchings <ben@decadent.org.uk> wrote:
> On Mon, 2014-08-25 at 01:51 -0400, Xiong Zhou wrote:
>> When export root dir(/) via nfs, and mount a particular dir under root, eg
>> /nfsexport, there will be defect double slash output in /proc/mounts, like
>> localhost://nfsexport. While this patch change it to localhost:/nfsexport.
>>
>> Signed-off-by: Xiong Zhou <xzhou@redhat.com>
>> ---
>>  fs/nfs/namespace.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
>> index b5a0afc..24f954e 100644
>> --- a/fs/nfs/namespace.c
>> +++ b/fs/nfs/namespace.c
>> @@ -98,7 +98,7 @@ rename_retry:
>>               return end;
>>       }
>>       namelen = strlen(base);
>> -     if (flags & NFS_PATH_CANONICAL) {
>> +     if ((flags & NFS_PATH_CANONICAL) || *end == '/') {
>>               /* Strip off excess slashes in base string */
>>               while (namelen > 0 && base[namelen - 1] == '/')
>>                       namelen--;
>
> I think this makes sense, though I'm not sure I completely understand
> this function. :-/
>

It breaks the function's guarantee concerning NFS_PATH_CANONICAL; that
"if unset, the original name is returned verbatim".

-- 
Trond Myklebust

Linux NFS client maintainer, PrimaryData

trond.myklebust@primarydata.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-08-25 21:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <600788954.21849581.1408502615727.JavaMail.zimbra@redhat.com>
2014-08-20  3:06 ` [PATCH] nfs: use canonical path in nfs_show_devname Xiong Zhou
2014-08-20 23:10   ` Ben Hutchings
2014-08-25  5:51     ` [PATCH v2] nfs: remove redundant slash from nfs_path Xiong Zhou
2014-08-25 21:07       ` Ben Hutchings
2014-08-25 21:17         ` Trond Myklebust

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).