From: Christoph Hellwig <hch@infradead.org>
To: Guoquan Yang <ygq51@hotmail.com>
Cc: linux-xfs@oss.sgi.com, hank peng <pengxihan@gmail.com>
Subject: Re: xfs: validate inode numbers in file handles correctly
Date: Mon, 28 Nov 2011 06:19:47 -0500 [thread overview]
Message-ID: <20111128111947.GA26454@infradead.org> (raw)
In-Reply-To: <20111123143045.GA20892@infradead.org>
Guoquan and hank,
are you using 32-bit or 64-bit kernels? I just noticed we have a
problem with exporting 64-bit inodes on 32-bit kernel because the
VFS i_ino field is just 32-bits long. The patch below would fix
that issue.
--- xfs.orig/fs/xfs/linux-2.6/xfs_export.c 2011-11-28 12:11:08.923630697 +0100
+++ xfs/fs/xfs/linux-2.6/xfs_export.c 2011-11-28 12:13:21.766244360 +0100
@@ -61,6 +61,8 @@ xfs_fs_encode_fh(
struct fid *fid = (struct fid *)fh;
struct xfs_fid64 *fid64 = (struct xfs_fid64 *)fh;
struct inode *inode = dentry->d_inode;
+ struct inode *parent;
+ struct xfs_inode *ip = XFS_I(inode);
int fileid_type;
int len;
@@ -98,22 +100,24 @@ xfs_fs_encode_fh(
switch (fileid_type) {
case FILEID_INO32_GEN_PARENT:
spin_lock(&dentry->d_lock);
- fid->i32.parent_ino = dentry->d_parent->d_inode->i_ino;
- fid->i32.parent_gen = dentry->d_parent->d_inode->i_generation;
+ parent = dentry->d_parent->d_inode;
+ fid->i32.parent_ino = XFS_I(parent)->i_ino;
+ fid->i32.parent_gen = parent->i_generation;
spin_unlock(&dentry->d_lock);
/*FALLTHRU*/
case FILEID_INO32_GEN:
- fid->i32.ino = inode->i_ino;
+ fid->i32.ino = ip->i_ino;
fid->i32.gen = inode->i_generation;
break;
case FILEID_INO32_GEN_PARENT | XFS_FILEID_TYPE_64FLAG:
spin_lock(&dentry->d_lock);
- fid64->parent_ino = dentry->d_parent->d_inode->i_ino;
- fid64->parent_gen = dentry->d_parent->d_inode->i_generation;
+ parent = dentry->d_parent->d_inode;
+ fid64->parent_ino = XFS_I(parent)->i_ino;
+ fid64->parent_gen = parent->i_generation;
spin_unlock(&dentry->d_lock);
/*FALLTHRU*/
case FILEID_INO32_GEN | XFS_FILEID_TYPE_64FLAG:
- fid64->ino = inode->i_ino;
+ fid64->ino = ip->i_ino;
fid64->gen = inode->i_generation;
break;
}
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2011-11-28 11:19 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-18 7:32 xfs: validate inode numbers in file handles correctly Dave Chinner
2010-06-18 7:32 ` [PATCH 1/4] xfs: always use iget in bulkstat Dave Chinner
2010-06-18 7:32 ` [PATCH 2/4] xfs: validate untrusted inode numbers during lookup Dave Chinner
2010-06-18 11:41 ` Christoph Hellwig
2010-06-19 0:07 ` Dave Chinner
2010-06-18 7:32 ` [PATCH 3/4] xfs: rename XFS_IGET_BULKSTAT to XFS_IGET_UNTRUSTED Dave Chinner
2010-06-18 11:42 ` Christoph Hellwig
2010-06-18 7:32 ` [PATCH 4/4] xfs: remove block number from inode lookup code Dave Chinner
2010-06-18 8:22 ` Christoph Hellwig
2011-11-23 13:04 ` xfs: validate inode numbers in file handles correctly Guoquan Yang
2011-11-23 14:30 ` Christoph Hellwig
[not found] ` <SNT135-W7F5C64C2A3F67B48EFF3AA4CE0@phx.gbl>
2011-11-24 12:52 ` Christoph Hellwig
2011-11-28 11:19 ` Christoph Hellwig [this message]
2011-12-03 8:27 ` hank peng
2011-12-06 15:17 ` Christoph Hellwig
2011-12-03 9:56 ` yangguoquan
2011-12-29 9:19 ` xfs: validate inode numbers in file handles correctly--NFS Stale File Handle Again yangguoquan
2012-01-02 15:02 ` Christoph Hellwig
2012-01-04 2:20 ` yangguoquan
2012-01-24 17:58 ` Christoph Hellwig
2012-02-01 5:46 ` yangguoquan
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=20111128111947.GA26454@infradead.org \
--to=hch@infradead.org \
--cc=linux-xfs@oss.sgi.com \
--cc=pengxihan@gmail.com \
--cc=ygq51@hotmail.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