All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfs: support 64-bit root inode number in NFS FSID
@ 2013-05-22 23:06 Dilger, Andreas
  2013-05-23  8:12 ` Peng Tao
  0 siblings, 1 reply; 11+ messages in thread
From: Dilger, Andreas @ 2013-05-22 23:06 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: linux-nfs@vger.kernel.org, Yong, Fan

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

When exporting a filesystem via NFS, it can generate several kinds
of NFS filesystem IDs. For most of cases, it uses a 32-bit inode
number in the NFS FSID, but this does not work on a filesystem
using a 64-bit root inode number.

In kernel space, NFS can generate/use NFS FSID with a 64-bit inode
number for the "FSID_UUID16_INUM" type. Unfortunately, while the
user space nfs-utils decode the 64-bit inode number from the FSID
correctly, it is truncated when storing it in "struct parsed_fsid".
Expand the "struct parsed_fsid" inode field to store the full 64-bit
root inode number.

Intel-bug-id: LU-2904
Signed-off-by: Fan Yong <fan.yong@intel.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 utils/mountd/cache.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index 517aa62..a7212e7 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -388,7 +388,7 @@ struct parsed_fsid {
 	int fsidtype;
 	/* We could use a union for this, but it would be more
 	 * complicated; why bother? */
-	unsigned int inode;
+	unsigned long long inode; /* We need 64-bits ino# */
 	unsigned int minor;
 	unsigned int major;
 	unsigned int fsidnum;
--1.7.1

Patch is also attached separately, since it will likely be butchered
by this email client.


Cheers, Andreas
-- 
Andreas Dilger

Lustre Software Architect
Intel High Performance Data Division



[-- Attachment #2: nfs-suport-64-bit-root-inode-number.patch --]
[-- Type: application/octet-stream, Size: 1453 bytes --]

From bebf55d991322c72d5b09b216c776ab0387c043e Mon Sep 17 00:00:00 2001
From: Fan Yong <fan.yong@intel.com>
Date: Mon, 13 May 2013 13:53:42 +0800
Subject: [PATCH] nfs: support 64-bit root inode number in NFS FSID

When exporting a filesystem via NFS, it can generate several kinds
of NFS filesystem IDs. For most of cases, it uses a 32-bit inode
number in the NFS FSID, but this does not work on a filesystem
using a 64-bit root inode number.

In kernel space, NFS can generate/use NFS FSID with a 64-bit inode
number for the "FSID_UUID16_INUM" type. Unfortunately, while the
user space nfs-utils decode the 64-bit inode number from the FSID
correctly, it is truncated when storing it in "struct parsed_fsid".
Expand the "struct parsed_fsid" inode field to store the full 64-bit
root inode number.

Intel-bug-id: LU-2904
Signed-off-by: Fan Yong <fan.yong@intel.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 utils/mountd/cache.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index 517aa62..a7212e7 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -388,7 +388,7 @@ struct parsed_fsid {
 	int fsidtype;
 	/* We could use a union for this, but it would be more
 	 * complicated; why bother? */
-	unsigned int inode;
+	unsigned long long inode; /* We need 64-bits ino# */
 	unsigned int minor;
 	unsigned int major;
 	unsigned int fsidnum;
-- 
1.7.1


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

* Re: [PATCH] nfs: support 64-bit root inode number in NFS FSID
  2013-05-22 23:06 [PATCH] nfs: support 64-bit root inode number in NFS FSID Dilger, Andreas
@ 2013-05-23  8:12 ` Peng Tao
  2013-05-23 12:49   ` Myklebust, Trond
  0 siblings, 1 reply; 11+ messages in thread
From: Peng Tao @ 2013-05-23  8:12 UTC (permalink / raw)
  To: Dilger, Andreas
  Cc: J. Bruce Fields, linux-nfs@vger.kernel.org, Yong, Fan,
	Steve Dickson

[nfs-utils patch needs to be sent to Steve Dickson (CC'ed)]

On Thu, May 23, 2013 at 7:06 AM, Dilger, Andreas
<andreas.dilger@intel.com> wrote:
> When exporting a filesystem via NFS, it can generate several kinds
> of NFS filesystem IDs. For most of cases, it uses a 32-bit inode
> number in the NFS FSID, but this does not work on a filesystem
> using a 64-bit root inode number.
>
> In kernel space, NFS can generate/use NFS FSID with a 64-bit inode
> number for the "FSID_UUID16_INUM" type. Unfortunately, while the
> user space nfs-utils decode the 64-bit inode number from the FSID
> correctly, it is truncated when storing it in "struct parsed_fsid".
> Expand the "struct parsed_fsid" inode field to store the full 64-bit
> root inode number.
>
> Intel-bug-id: LU-2904
> Signed-off-by: Fan Yong <fan.yong@intel.com>
> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
> ---
>  utils/mountd/cache.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
> index 517aa62..a7212e7 100644
> --- a/utils/mountd/cache.c
> +++ b/utils/mountd/cache.c
> @@ -388,7 +388,7 @@ struct parsed_fsid {
>         int fsidtype;
>         /* We could use a union for this, but it would be more
>          * complicated; why bother? */
> -       unsigned int inode;
> +       unsigned long long inode; /* We need 64-bits ino# */
>         unsigned int minor;
>         unsigned int major;
>         unsigned int fsidnum;
> --1.7.1
>
> Patch is also attached separately, since it will likely be butchered
> by this email client.
>
>
> Cheers, Andreas
> --
> Andreas Dilger
>
> Lustre Software Architect
> Intel High Performance Data Division
>
>

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

* Re: [PATCH] nfs: support 64-bit root inode number in NFS FSID
  2013-05-23  8:12 ` Peng Tao
@ 2013-05-23 12:49   ` Myklebust, Trond
  2013-05-23 12:59     ` Yong, Fan
                       ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Myklebust, Trond @ 2013-05-23 12:49 UTC (permalink / raw)
  To: Peng Tao
  Cc: Dilger, Andreas, J. Bruce Fields, linux-nfs@vger.kernel.org,
	Yong, Fan, Steve Dickson

On Thu, 2013-05-23 at 16:12 +0800, Peng Tao wrote:
> [nfs-utils patch needs to be sent to Steve Dickson (CC'ed)]
> 
> On Thu, May 23, 2013 at 7:06 AM, Dilger, Andreas
> <andreas.dilger@intel.com> wrote:
> > When exporting a filesystem via NFS, it can generate several kinds
> > of NFS filesystem IDs. For most of cases, it uses a 32-bit inode
> > number in the NFS FSID, but this does not work on a filesystem
> > using a 64-bit root inode number.
> >
> > In kernel space, NFS can generate/use NFS FSID with a 64-bit inode
> > number for the "FSID_UUID16_INUM" type. Unfortunately, while the
> > user space nfs-utils decode the 64-bit inode number from the FSID
> > correctly, it is truncated when storing it in "struct parsed_fsid".
> > Expand the "struct parsed_fsid" inode field to store the full 64-bit
> > root inode number.
> >
> > Intel-bug-id: LU-2904
> > Signed-off-by: Fan Yong <fan.yong@intel.com>
> > Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
> > ---
> >  utils/mountd/cache.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
> > index 517aa62..a7212e7 100644
> > --- a/utils/mountd/cache.c
> > +++ b/utils/mountd/cache.c
> > @@ -388,7 +388,7 @@ struct parsed_fsid {
> >         int fsidtype;
> >         /* We could use a union for this, but it would be more
> >          * complicated; why bother? */
> > -       unsigned int inode;
> > +       unsigned long long inode; /* We need 64-bits ino# */
> >         unsigned int minor;
> >         unsigned int major;
> >         unsigned int fsidnum;
> > --1.7.1
> >
> > Patch is also attached separately, since it will likely be butchered
> > by this email client.
> >
> >
> > Cheers, Andreas
> > --
> > Andreas Dilger

Why not just specify a uint64_t size then?

-- 
Trond Myklebust
Linux NFS client maintainer

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

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

* RE: [PATCH] nfs: support 64-bit root inode number in NFS FSID
  2013-05-23 12:49   ` Myklebust, Trond
@ 2013-05-23 12:59     ` Yong, Fan
  2013-05-23 13:39       ` Myklebust, Trond
  2013-06-03  1:59     ` Yong, Fan
  2013-06-03  2:02     ` Yong, Fan
  2 siblings, 1 reply; 11+ messages in thread
From: Yong, Fan @ 2013-05-23 12:59 UTC (permalink / raw)
  To: Myklebust, Trond, Peng Tao
  Cc: Dilger, Andreas, J. Bruce Fields, linux-nfs@vger.kernel.org,
	Steve Dickson

Just make it match the "inode64" in nfs-utils parse_fsid(), which is defined as "unsigned long long", and the parsed_fsid:: inode is copied from "inode64" as following:

static int parse_fsid(int fsidtype, int fsidlen, char *fsid,
                struct parsed_fsid *parsed)
{
        unsigned int dev;
        unsigned long long inode64;
...
        case FSID_UUID16_INUM: /* 8 byte inode number and 16 byte uuid */
                if (fsidlen != 24)
                        return -1;
                memcpy(&inode64, fsid, 8);
                parsed->inode = inode64;
                parsed->uuidlen = 16;
                parsed->fhuuid = fsid+8;
                break;
        }

--
Cheers,
Nasf



-----Original Message-----
From: Myklebust, Trond [mailto:Trond.Myklebust@netapp.com] 
Sent: Thursday, May 23, 2013 8:50 PM
To: Peng Tao
Cc: Dilger, Andreas; J. Bruce Fields; linux-nfs@vger.kernel.org; Yong, Fan; Steve Dickson
Subject: Re: [PATCH] nfs: support 64-bit root inode number in NFS FSID

On Thu, 2013-05-23 at 16:12 +0800, Peng Tao wrote:
> [nfs-utils patch needs to be sent to Steve Dickson (CC'ed)]
> 
> On Thu, May 23, 2013 at 7:06 AM, Dilger, Andreas 
> <andreas.dilger@intel.com> wrote:
> > When exporting a filesystem via NFS, it can generate several kinds 
> > of NFS filesystem IDs. For most of cases, it uses a 32-bit inode 
> > number in the NFS FSID, but this does not work on a filesystem using 
> > a 64-bit root inode number.
> >
> > In kernel space, NFS can generate/use NFS FSID with a 64-bit inode 
> > number for the "FSID_UUID16_INUM" type. Unfortunately, while the 
> > user space nfs-utils decode the 64-bit inode number from the FSID 
> > correctly, it is truncated when storing it in "struct parsed_fsid".
> > Expand the "struct parsed_fsid" inode field to store the full 64-bit 
> > root inode number.
> >
> > Intel-bug-id: LU-2904
> > Signed-off-by: Fan Yong <fan.yong@intel.com>
> > Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
> > ---
> >  utils/mountd/cache.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c index 
> > 517aa62..a7212e7 100644
> > --- a/utils/mountd/cache.c
> > +++ b/utils/mountd/cache.c
> > @@ -388,7 +388,7 @@ struct parsed_fsid {
> >         int fsidtype;
> >         /* We could use a union for this, but it would be more
> >          * complicated; why bother? */
> > -       unsigned int inode;
> > +       unsigned long long inode; /* We need 64-bits ino# */
> >         unsigned int minor;
> >         unsigned int major;
> >         unsigned int fsidnum;
> > --1.7.1
> >
> > Patch is also attached separately, since it will likely be butchered 
> > by this email client.
> >
> >
> > Cheers, Andreas
> > --
> > Andreas Dilger

Why not just specify a uint64_t size then?

--
Trond Myklebust
Linux NFS client maintainer

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

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

* Re: [PATCH] nfs: support 64-bit root inode number in NFS FSID
  2013-05-23 12:59     ` Yong, Fan
@ 2013-05-23 13:39       ` Myklebust, Trond
  2013-05-23 14:20         ` Jim Rees
  0 siblings, 1 reply; 11+ messages in thread
From: Myklebust, Trond @ 2013-05-23 13:39 UTC (permalink / raw)
  To: Yong, Fan
  Cc: Peng Tao, Dilger, Andreas, J. Bruce Fields,
	linux-nfs@vger.kernel.org, Steve Dickson

On Thu, 2013-05-23 at 12:59 +0000, Yong, Fan wrote:
> Just make it match the "inode64" in nfs-utils parse_fsid(), which is defined as "unsigned long long", and the parsed_fsid:: inode is copied from "inode64" as following:
> 
> static int parse_fsid(int fsidtype, int fsidlen, char *fsid,
>                 struct parsed_fsid *parsed)
> {
>         unsigned int dev;
>         unsigned long long inode64;
> ...
>         case FSID_UUID16_INUM: /* 8 byte inode number and 16 byte uuid */
>                 if (fsidlen != 24)
>                         return -1;
>                 memcpy(&inode64, fsid, 8);
>                 parsed->inode = inode64;
>                 parsed->uuidlen = 16;
>                 parsed->fhuuid = fsid+8;
>                 break;
>         }
> 
> --
> Cheers,
> Nasf

Eeeeeeeewww! This is _exactly_ why we should be using properly
dimensioned types. Feel free to tell me how the value of 'inode64' is
well defined on systems where sizeof(unsigned long long) != 8...

Trond

> -----Original Message-----
> From: Myklebust, Trond [mailto:Trond.Myklebust@netapp.com] 
> Sent: Thursday, May 23, 2013 8:50 PM
> To: Peng Tao
> Cc: Dilger, Andreas; J. Bruce Fields; linux-nfs@vger.kernel.org; Yong, Fan; Steve Dickson
> Subject: Re: [PATCH] nfs: support 64-bit root inode number in NFS FSID
> 
> On Thu, 2013-05-23 at 16:12 +0800, Peng Tao wrote:
> > [nfs-utils patch needs to be sent to Steve Dickson (CC'ed)]
> > 
> > On Thu, May 23, 2013 at 7:06 AM, Dilger, Andreas 
> > <andreas.dilger@intel.com> wrote:
> > > When exporting a filesystem via NFS, it can generate several kinds 
> > > of NFS filesystem IDs. For most of cases, it uses a 32-bit inode 
> > > number in the NFS FSID, but this does not work on a filesystem using 
> > > a 64-bit root inode number.
> > >
> > > In kernel space, NFS can generate/use NFS FSID with a 64-bit inode 
> > > number for the "FSID_UUID16_INUM" type. Unfortunately, while the 
> > > user space nfs-utils decode the 64-bit inode number from the FSID 
> > > correctly, it is truncated when storing it in "struct parsed_fsid".
> > > Expand the "struct parsed_fsid" inode field to store the full 64-bit 
> > > root inode number.
> > >
> > > Intel-bug-id: LU-2904
> > > Signed-off-by: Fan Yong <fan.yong@intel.com>
> > > Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
> > > ---
> > >  utils/mountd/cache.c |    2 +-
> > >  1 files changed, 1 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c index 
> > > 517aa62..a7212e7 100644
> > > --- a/utils/mountd/cache.c
> > > +++ b/utils/mountd/cache.c
> > > @@ -388,7 +388,7 @@ struct parsed_fsid {
> > >         int fsidtype;
> > >         /* We could use a union for this, but it would be more
> > >          * complicated; why bother? */
> > > -       unsigned int inode;
> > > +       unsigned long long inode; /* We need 64-bits ino# */
> > >         unsigned int minor;
> > >         unsigned int major;
> > >         unsigned int fsidnum;
> > > --1.7.1
> > >
> > > Patch is also attached separately, since it will likely be butchered 
> > > by this email client.
> > >
> > >
> > > Cheers, Andreas
> > > --
> > > Andreas Dilger
> 
> Why not just specify a uint64_t size then?
> 
> --
> Trond Myklebust
> Linux NFS client maintainer
> 
> NetApp
> Trond.Myklebust@netapp.com
> www.netapp.com
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Trond Myklebust
Linux NFS client maintainer

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

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

* Re: [PATCH] nfs: support 64-bit root inode number in NFS FSID
  2013-05-23 13:39       ` Myklebust, Trond
@ 2013-05-23 14:20         ` Jim Rees
  2013-05-23 14:21           ` Myklebust, Trond
  0 siblings, 1 reply; 11+ messages in thread
From: Jim Rees @ 2013-05-23 14:20 UTC (permalink / raw)
  To: Myklebust, Trond
  Cc: Yong, Fan, Peng Tao, Dilger, Andreas, J. Bruce Fields,
	linux-nfs@vger.kernel.org, Steve Dickson

Myklebust, Trond wrote:

  On Thu, 2013-05-23 at 12:59 +0000, Yong, Fan wrote:
  > Just make it match the "inode64" in nfs-utils parse_fsid(), which is defined as "unsigned long long", and the parsed_fsid:: inode is copied from "inode64" as following:
  > 
  > static int parse_fsid(int fsidtype, int fsidlen, char *fsid,
  >                 struct parsed_fsid *parsed)
  > {
  >         unsigned int dev;
  >         unsigned long long inode64;
  > ...
  >         case FSID_UUID16_INUM: /* 8 byte inode number and 16 byte uuid */
  >                 if (fsidlen != 24)
  >                         return -1;
  >                 memcpy(&inode64, fsid, 8);
  >                 parsed->inode = inode64;
  >                 parsed->uuidlen = 16;
  >                 parsed->fhuuid = fsid+8;
  >                 break;
  >         }
  > 
  > --
  > Cheers,
  > Nasf
  
  Eeeeeeeewww! This is _exactly_ why we should be using properly
  dimensioned types. Feel free to tell me how the value of 'inode64' is
  well defined on systems where sizeof(unsigned long long) != 8...

Is there any reason not to use ino_t?

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

* RE: [PATCH] nfs: support 64-bit root inode number in NFS FSID
  2013-05-23 14:20         ` Jim Rees
@ 2013-05-23 14:21           ` Myklebust, Trond
  2013-05-24  1:30             ` Yong, Fan
  0 siblings, 1 reply; 11+ messages in thread
From: Myklebust, Trond @ 2013-05-23 14:21 UTC (permalink / raw)
  To: Jim Rees
  Cc: Yong, Fan, Peng Tao, Dilger, Andreas, J. Bruce Fields,
	linux-nfs@vger.kernel.org, Steve Dickson

> -----Original Message-----
> From: Jim Rees [mailto:rees@umich.edu]
> Sent: Thursday, May 23, 2013 10:20 AM
> To: Myklebust, Trond
> Cc: Yong, Fan; Peng Tao; Dilger, Andreas; J. Bruce Fields; linux-
> nfs@vger.kernel.org; Steve Dickson
> Subject: Re: [PATCH] nfs: support 64-bit root inode number in NFS FSID
> 
> Myklebust, Trond wrote:
> 
>   On Thu, 2013-05-23 at 12:59 +0000, Yong, Fan wrote:
>   > Just make it match the "inode64" in nfs-utils parse_fsid(), which is defined
> as "unsigned long long", and the parsed_fsid:: inode is copied from "inode64"
> as following:
>   >
>   > static int parse_fsid(int fsidtype, int fsidlen, char *fsid,
>   >                 struct parsed_fsid *parsed)
>   > {
>   >         unsigned int dev;
>   >         unsigned long long inode64;
>   > ...
>   >         case FSID_UUID16_INUM: /* 8 byte inode number and 16 byte uuid
> */
>   >                 if (fsidlen != 24)
>   >                         return -1;
>   >                 memcpy(&inode64, fsid, 8);
>   >                 parsed->inode = inode64;
>   >                 parsed->uuidlen = 16;
>   >                 parsed->fhuuid = fsid+8;
>   >                 break;
>   >         }
>   >
>   > --
>   > Cheers,
>   > Nasf
> 
>   Eeeeeeeewww! This is _exactly_ why we should be using properly
>   dimensioned types. Feel free to tell me how the value of 'inode64' is
>   well defined on systems where sizeof(unsigned long long) != 8...
> 
> Is there any reason not to use ino_t?

Yes. It's not guaranteed to be 64-bit either.

Trond

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

* RE: [PATCH] nfs: support 64-bit root inode number in NFS FSID
  2013-05-23 14:21           ` Myklebust, Trond
@ 2013-05-24  1:30             ` Yong, Fan
  2013-05-24  1:49               ` Myklebust, Trond
  0 siblings, 1 reply; 11+ messages in thread
From: Yong, Fan @ 2013-05-24  1:30 UTC (permalink / raw)
  To: Myklebust, Trond, Jim Rees
  Cc: Peng Tao, Dilger, Andreas, J. Bruce Fields,
	linux-nfs@vger.kernel.org, Steve Dickson

For the rare unfortunate cases of "sizeof(unsigned long) < 4" or "sizeof(unsigned long long) < 8", current nfs-utils will cross-boundary memory copy. So need more work to make it stably runnable on kinds of platform...

--
Cheers,
Nasf

-----Original Message-----
From: Myklebust, Trond [mailto:Trond.Myklebust@netapp.com] 
Sent: Thursday, May 23, 2013 10:22 PM
To: Jim Rees
Cc: Yong, Fan; Peng Tao; Dilger, Andreas; J. Bruce Fields; linux-nfs@vger.kernel.org; Steve Dickson
Subject: RE: [PATCH] nfs: support 64-bit root inode number in NFS FSID

> -----Original Message-----
> From: Jim Rees [mailto:rees@umich.edu]
> Sent: Thursday, May 23, 2013 10:20 AM
> To: Myklebust, Trond
> Cc: Yong, Fan; Peng Tao; Dilger, Andreas; J. Bruce Fields; linux- 
> nfs@vger.kernel.org; Steve Dickson
> Subject: Re: [PATCH] nfs: support 64-bit root inode number in NFS FSID
> 
> Myklebust, Trond wrote:
> 
>   On Thu, 2013-05-23 at 12:59 +0000, Yong, Fan wrote:
>   > Just make it match the "inode64" in nfs-utils parse_fsid(), which 
> is defined as "unsigned long long", and the parsed_fsid:: inode is copied from "inode64"
> as following:
>   >
>   > static int parse_fsid(int fsidtype, int fsidlen, char *fsid,
>   >                 struct parsed_fsid *parsed)
>   > {
>   >         unsigned int dev;
>   >         unsigned long long inode64;
>   > ...
>   >         case FSID_UUID16_INUM: /* 8 byte inode number and 16 byte uuid
> */
>   >                 if (fsidlen != 24)
>   >                         return -1;
>   >                 memcpy(&inode64, fsid, 8);
>   >                 parsed->inode = inode64;
>   >                 parsed->uuidlen = 16;
>   >                 parsed->fhuuid = fsid+8;
>   >                 break;
>   >         }
>   >
>   > --
>   > Cheers,
>   > Nasf
> 
>   Eeeeeeeewww! This is _exactly_ why we should be using properly
>   dimensioned types. Feel free to tell me how the value of 'inode64' is
>   well defined on systems where sizeof(unsigned long long) != 8...
> 
> Is there any reason not to use ino_t?

Yes. It's not guaranteed to be 64-bit either.

Trond

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

* RE: [PATCH] nfs: support 64-bit root inode number in NFS FSID
  2013-05-24  1:30             ` Yong, Fan
@ 2013-05-24  1:49               ` Myklebust, Trond
  0 siblings, 0 replies; 11+ messages in thread
From: Myklebust, Trond @ 2013-05-24  1:49 UTC (permalink / raw)
  To: Yong, Fan, Jim Rees
  Cc: Peng Tao, Dilger, Andreas, J. Bruce Fields,
	linux-nfs@vger.kernel.org, Steve Dickson

> -----Original Message-----
> From: Yong, Fan [mailto:fan.yong@intel.com]
> Sent: Thursday, May 23, 2013 9:30 PM
> To: Myklebust, Trond; Jim Rees
> Cc: Peng Tao; Dilger, Andreas; J. Bruce Fields; linux-nfs@vger.kernel.org;
> Steve Dickson
> Subject: RE: [PATCH] nfs: support 64-bit root inode number in NFS FSID
> 
> For the rare unfortunate cases of "sizeof(unsigned long) < 4" or
> "sizeof(unsigned long long) < 8", current nfs-utils will cross-boundary
> memory copy. So need more work to make it stably runnable on kinds of
> platform...

unsigned long long is guaranteed by C99 to be >= 64 bits. IOW: it could be 128 bits depending on the compiler.


> --
> Cheers,
> Nasf
> 
> -----Original Message-----
> From: Myklebust, Trond [mailto:Trond.Myklebust@netapp.com]
> Sent: Thursday, May 23, 2013 10:22 PM
> To: Jim Rees
> Cc: Yong, Fan; Peng Tao; Dilger, Andreas; J. Bruce Fields; linux-
> nfs@vger.kernel.org; Steve Dickson
> Subject: RE: [PATCH] nfs: support 64-bit root inode number in NFS FSID
> 
> > -----Original Message-----
> > From: Jim Rees [mailto:rees@umich.edu]
> > Sent: Thursday, May 23, 2013 10:20 AM
> > To: Myklebust, Trond
> > Cc: Yong, Fan; Peng Tao; Dilger, Andreas; J. Bruce Fields; linux-
> > nfs@vger.kernel.org; Steve Dickson
> > Subject: Re: [PATCH] nfs: support 64-bit root inode number in NFS FSID
> >
> > Myklebust, Trond wrote:
> >
> >   On Thu, 2013-05-23 at 12:59 +0000, Yong, Fan wrote:
> >   > Just make it match the "inode64" in nfs-utils parse_fsid(), which
> > is defined as "unsigned long long", and the parsed_fsid:: inode is copied
> from "inode64"
> > as following:
> >   >
> >   > static int parse_fsid(int fsidtype, int fsidlen, char *fsid,
> >   >                 struct parsed_fsid *parsed)
> >   > {
> >   >         unsigned int dev;
> >   >         unsigned long long inode64;
> >   > ...
> >   >         case FSID_UUID16_INUM: /* 8 byte inode number and 16 byte uuid
> > */
> >   >                 if (fsidlen != 24)
> >   >                         return -1;
> >   >                 memcpy(&inode64, fsid, 8);
> >   >                 parsed->inode = inode64;
> >   >                 parsed->uuidlen = 16;
> >   >                 parsed->fhuuid = fsid+8;
> >   >                 break;
> >   >         }
> >   >
> >   > --
> >   > Cheers,
> >   > Nasf
> >
> >   Eeeeeeeewww! This is _exactly_ why we should be using properly
> >   dimensioned types. Feel free to tell me how the value of 'inode64' is
> >   well defined on systems where sizeof(unsigned long long) != 8...
> >
> > Is there any reason not to use ino_t?
> 
> Yes. It's not guaranteed to be 64-bit either.
> 
> Trond

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

* RE: [PATCH] nfs: support 64-bit root inode number in NFS FSID
  2013-05-23 12:49   ` Myklebust, Trond
  2013-05-23 12:59     ` Yong, Fan
@ 2013-06-03  1:59     ` Yong, Fan
  2013-06-03  2:02     ` Yong, Fan
  2 siblings, 0 replies; 11+ messages in thread
From: Yong, Fan @ 2013-06-03  1:59 UTC (permalink / raw)
  To: Myklebust, Trond, linux-nfs@vger.kernel.org
  Cc: Dilger, Andreas, J. Bruce Fields, Steve Dickson,
	Peng Tao (bergwolf@gmail.com)

Update the patch as suggested.

--
Cheers,
Nasf



-----Original Message-----
From: Myklebust, Trond [mailto:Trond.Myklebust@netapp.com] 
Sent: Thursday, May 23, 2013 8:50 PM
To: Peng Tao
Cc: Dilger, Andreas; J. Bruce Fields; linux-nfs@vger.kernel.org; Yong, Fan; Steve Dickson
Subject: Re: [PATCH] nfs: support 64-bit root inode number in NFS FSID

On Thu, 2013-05-23 at 16:12 +0800, Peng Tao wrote:
> [nfs-utils patch needs to be sent to Steve Dickson (CC'ed)]
> 
> On Thu, May 23, 2013 at 7:06 AM, Dilger, Andreas 
> <andreas.dilger@intel.com> wrote:
> > When exporting a filesystem via NFS, it can generate several kinds 
> > of NFS filesystem IDs. For most of cases, it uses a 32-bit inode 
> > number in the NFS FSID, but this does not work on a filesystem using 
> > a 64-bit root inode number.
> >
> > In kernel space, NFS can generate/use NFS FSID with a 64-bit inode 
> > number for the "FSID_UUID16_INUM" type. Unfortunately, while the 
> > user space nfs-utils decode the 64-bit inode number from the FSID 
> > correctly, it is truncated when storing it in "struct parsed_fsid".
> > Expand the "struct parsed_fsid" inode field to store the full 64-bit 
> > root inode number.
> >
> > Intel-bug-id: LU-2904
> > Signed-off-by: Fan Yong <fan.yong@intel.com>
> > Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
> > ---
> >  utils/mountd/cache.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c index 
> > 517aa62..a7212e7 100644
> > --- a/utils/mountd/cache.c
> > +++ b/utils/mountd/cache.c
> > @@ -388,7 +388,7 @@ struct parsed_fsid {
> >         int fsidtype;
> >         /* We could use a union for this, but it would be more
> >          * complicated; why bother? */
> > -       unsigned int inode;
> > +       unsigned long long inode; /* We need 64-bits ino# */
> >         unsigned int minor;
> >         unsigned int major;
> >         unsigned int fsidnum;
> > --1.7.1
> >
> > Patch is also attached separately, since it will likely be butchered 
> > by this email client.
> >
> >
> > Cheers, Andreas
> > --
> > Andreas Dilger

Why not just specify a uint64_t size then?

--
Trond Myklebust
Linux NFS client maintainer

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

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

* RE: [PATCH] nfs: support 64-bit root inode number in NFS FSID
  2013-05-23 12:49   ` Myklebust, Trond
  2013-05-23 12:59     ` Yong, Fan
  2013-06-03  1:59     ` Yong, Fan
@ 2013-06-03  2:02     ` Yong, Fan
  2 siblings, 0 replies; 11+ messages in thread
From: Yong, Fan @ 2013-06-03  2:02 UTC (permalink / raw)
  To: Myklebust, Trond, linux-nfs@vger.kernel.org
  Cc: Dilger, Andreas, J. Bruce Fields, Steve Dickson,
	Peng Tao (bergwolf@gmail.com)

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

Update the patch as suggested. Here is the patch...

--
Cheers,
Nasf



-----Original Message-----
From: Myklebust, Trond [mailto:Trond.Myklebust@netapp.com] 
Sent: Thursday, May 23, 2013 8:50 PM
To: Peng Tao
Cc: Dilger, Andreas; J. Bruce Fields; linux-nfs@vger.kernel.org; Yong, Fan; Steve Dickson
Subject: Re: [PATCH] nfs: support 64-bit root inode number in NFS FSID

On Thu, 2013-05-23 at 16:12 +0800, Peng Tao wrote:
> [nfs-utils patch needs to be sent to Steve Dickson (CC'ed)]
> 
> On Thu, May 23, 2013 at 7:06 AM, Dilger, Andreas 
> <andreas.dilger@intel.com> wrote:
> > When exporting a filesystem via NFS, it can generate several kinds 
> > of NFS filesystem IDs. For most of cases, it uses a 32-bit inode 
> > number in the NFS FSID, but this does not work on a filesystem using 
> > a 64-bit root inode number.
> >
> > In kernel space, NFS can generate/use NFS FSID with a 64-bit inode 
> > number for the "FSID_UUID16_INUM" type. Unfortunately, while the 
> > user space nfs-utils decode the 64-bit inode number from the FSID 
> > correctly, it is truncated when storing it in "struct parsed_fsid".
> > Expand the "struct parsed_fsid" inode field to store the full 64-bit 
> > root inode number.
> >
> > Intel-bug-id: LU-2904
> > Signed-off-by: Fan Yong <fan.yong@intel.com>
> > Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
> > ---
> >  utils/mountd/cache.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c index 
> > 517aa62..a7212e7 100644
> > --- a/utils/mountd/cache.c
> > +++ b/utils/mountd/cache.c
> > @@ -388,7 +388,7 @@ struct parsed_fsid {
> >         int fsidtype;
> >         /* We could use a union for this, but it would be more
> >          * complicated; why bother? */
> > -       unsigned int inode;
> > +       unsigned long long inode; /* We need 64-bits ino# */
> >         unsigned int minor;
> >         unsigned int major;
> >         unsigned int fsidnum;
> > --1.7.1
> >
> > Patch is also attached separately, since it will likely be butchered 
> > by this email client.
> >
> >
> > Cheers, Andreas
> > --
> > Andreas Dilger

Why not just specify a uint64_t size then?

--
Trond Myklebust
Linux NFS client maintainer

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

[-- Attachment #2: 0001-nfs-support-64-bit-root-inode-number-in-NFS-FSID.patch --]
[-- Type: application/octet-stream, Size: 1779 bytes --]

From 606d7b43be841773bf1d342d6de0267c8bb0b45e Mon Sep 17 00:00:00 2001
From: Fan Yong <yong.fan@whamcloud.com>
Date: Mon, 13 May 2013 13:53:42 +0800
Subject: [PATCH] nfs: support 64-bit root inode number in NFS FSID

When exporting a filesystem via NFS, it can generate several kinds
of NFS filesystem IDs. For most of cases, it uses a 32-bit inode
number in the NFS FSID, but this does not work on a filesystem
using a 64-bit root inode number.

In kernel space, NFS can generate/use NFS FSID with a 64-bit inode
number for the "FSID_UUID16_INUM" type. Unfortunately, while the
user space nfs-utils decode the 64-bit inode number from the FSID
correctly, it is truncated when storing it in "struct parsed_fsid".
Expand the "struct parsed_fsid" inode field to store the full 64-bit
root inode number.

Intel-bug-id: LU-2904
Signed-off-by: Fan Yong <fan.yong@intel.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 utils/mountd/cache.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index 517aa62..be99b7d 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -385,10 +385,10 @@ static bool subexport(struct exportent *e1, struct exportent *e2)
 }
 
 struct parsed_fsid {
+	uint64_t inode; /* We need 64-bits ino# */
 	int fsidtype;
 	/* We could use a union for this, but it would be more
 	 * complicated; why bother? */
-	unsigned int inode;
 	unsigned int minor;
 	unsigned int major;
 	unsigned int fsidnum;
@@ -400,7 +400,7 @@ static int parse_fsid(int fsidtype, int fsidlen, char *fsid,
 		struct parsed_fsid *parsed)
 {
 	unsigned int dev;
-	unsigned long long inode64;
+	uint64_t inode64;
 
 	memset(parsed, 0, sizeof(*parsed));
 	parsed->fsidtype = fsidtype;
-- 
1.7.1


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

end of thread, other threads:[~2013-06-03  2:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-22 23:06 [PATCH] nfs: support 64-bit root inode number in NFS FSID Dilger, Andreas
2013-05-23  8:12 ` Peng Tao
2013-05-23 12:49   ` Myklebust, Trond
2013-05-23 12:59     ` Yong, Fan
2013-05-23 13:39       ` Myklebust, Trond
2013-05-23 14:20         ` Jim Rees
2013-05-23 14:21           ` Myklebust, Trond
2013-05-24  1:30             ` Yong, Fan
2013-05-24  1:49               ` Myklebust, Trond
2013-06-03  1:59     ` Yong, Fan
2013-06-03  2:02     ` Yong, Fan

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.