linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: Frank Filz <ffilzlnx@us.ibm.com>
Cc: ffilz@us.ibm.com, NFS List <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] NFS client has troubles with fileid with bit 31 (or bit 63) set
Date: Wed, 01 Dec 2010 22:13:16 -0500	[thread overview]
Message-ID: <1291259596.6609.109.camel@heimdal.trondhjem.org> (raw)
In-Reply-To: <1291258912.5075.10.camel@KPMH461.ibm.com>

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@us.ibm.com>
> > > ---
> > > 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@netapp.com
www.netapp.com


  reply	other threads:[~2010-12-02  3:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-02  1:03 [PATCH] NFS client has troubles with fileid with bit 31 (or bit 63) set Frank Filz
2010-12-02  1:36 ` Trond Myklebust
2010-12-02  3:01   ` Frank Filz
2010-12-02  3:13     ` Trond Myklebust [this message]
2010-12-02 17:44       ` Frank Filz

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=1291259596.6609.109.camel@heimdal.trondhjem.org \
    --to=trond.myklebust@netapp.com \
    --cc=ffilz@us.ibm.com \
    --cc=ffilzlnx@us.ibm.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 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).