Re: [PATCH] NFS client has troubles with fileid with bit 31 (or bit 63) set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2010-12-01 at 19:01 -0800, Frank Filz wrote:
> On Wed, 2010-12-01 at 20:36 -0500, Trond Myklebust wrote:
> > On Wed, 2010-12-01 at 17:03 -0800, Frank Filz wrote:
> > > Signed-off-by: Frank Filz <ffilzlnx@xxxxxxxxxx>
> > > ---
> > > diff -X ignore.patcher -ruNp linux-2.6.18-194.el5/fs/nfs/inode.c linux-2.6.18-194.ff/fs/nfs/inode.c
> > > --- linux-2.6.18-194.el5/fs/nfs/inode.c	2010-12-01 15:52:11.000000000 -0800
> > > +++ linux-2.6.18-194.ff/fs/nfs/inode.c	2010-12-01 16:53:28.000000000 -0800
> > > @@ -71,7 +71,7 @@ static kmem_cache_t * nfs_inode_cachep;
> > >   */
> > >  u64 nfs_compat_user_ino64(u64 fileid)
> > >  {
> > > -	int ino;
> > > +	unsigned int ino;
> > 
> > Shouldn't this just be of type 'compat_ulong_t' if CONFIG_COMPAT is
> > defined, and of type 'unsigned long' if not?
> 
> The full (patched) function is:
> 
> u64 nfs_compat_user_ino64(u64 fileid)
> {
> 	unsigned int ino;
> 
> 	if (enable_ino64)
> 		return fileid;
> 	ino = fileid;
> 	if (sizeof(ino) < sizeof(fileid))
> 		ino ^= fileid >> (sizeof(fileid)-sizeof(ino)) * 8;
> 	return ino;
> }
> 
> ino is only used if the function is expected to return a 32 bit fileid,
> so no need for it to be anything other than an unsigned int. I suppose
> it should actually be a uint32.

I'm suggesting it should rather match the compat_ulong_t, since that is
what 64-bit kernels will need to deal with if running a 32-bit
userspace. For 64-bit kernels that have no 32-bit userspace emulation
layer, why would we care about returning a truncated 32-bit fileid?

Conversely, if running a 32-bit kernel, then 'unsigned long' will
directly match the types used by fs/readdir.c:filldir()

Cheers
  Trond

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@xxxxxxxxxx
www.netapp.com

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux