public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Tim J?dicke <tim.joedicke@fh-worms.de>
Cc: xfs@oss.sgi.com
Subject: Re: vfs dmapi handle generation problem
Date: Wed, 4 Jun 2008 11:16:51 -0400	[thread overview]
Message-ID: <20080604151651.GA16376@infradead.org> (raw)
In-Reply-To: <8efbf9761cbff87b03e5326866cd914d.squirrel@webmailer.fh-worms.de>

On Wed, Jun 04, 2008 at 03:55:04PM +0200, Tim J?dicke wrote:
> int
> vfs_dm_inode_to_fh(struct inode *ip, dm_fid_t *dmfid, dm_fsid_t *dmfsid)
> {
>    dmfid->dm_fid_len = sizeof(dm_fid_t) - sizeof(dmfid->dm_fid_len);
>    dmfid->dm_fid_pad = 0;
>    memcpy(&dmfid->dm_fid_ino, &ip->i_ino, sizeof(dmfid->dm_fid_ino));
>    dmfid->dm_fid_gen = ip->i_generation;
> 
>    *dmfsid = 11; // need generation system
> 
>    return 0;

i_ino in struct inode is unsigned long.  If you run the above code
on a 32bit system you'll get crap in the upper half of dm_fid_ino.

Try:

int
vfs_dm_inode_to_fh(struct inode *ip, dm_fid_t *dmfid, dm_fsid_t *dmfsid)
{
	dmfid->dm_fid_len = sizeof(dm_fid_t) - sizeof(dmfid->dm_fid_len);
	dmfid->dm_fid_pad = 0;
	dmfid->dm_fid_ino = ip->i_ino;
	dmfid->dm_fid_gen = ip->i_generation;

	*dmfsid = 11; // need generation system
	return 0;
}

instead.  If you actually want to support 64bit inode numbers on 32bit
systems you'll have to query for it with vfs_getattr, though.

      reply	other threads:[~2008-06-04 15:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-04 13:55 vfs dmapi handle generation problem Tim Jödicke
2008-06-04 15:16 ` Christoph Hellwig [this message]

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=20080604151651.GA16376@infradead.org \
    --to=hch@infradead.org \
    --cc=tim.joedicke@fh-worms.de \
    --cc=xfs@oss.sgi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox