xfs
[Top] [All Lists]

RE: xfs: validate inode numbers in file handles correctly

To: <hch@xxxxxxxxxxxxx>
Subject: RE: xfs: validate inode numbers in file handles correctly
From: yangguoquan <ygq51@xxxxxxxxxxx>
Date: Sat, 3 Dec 2011 17:56:20 +0800
Cc: <linux-xfs@xxxxxxxxxxx>, <pengxihan@xxxxxxxxx>
Importance: Normal
In-reply-to: <20111128111947.GA26454@xxxxxxxxxxxxx>
References: <1276846374-23916-1-git-send-email-david@xxxxxxxxxxxxx>,<loom.20111123T134243-580@xxxxxxxxxxxxxx>,<20111123143045.GA20892@xxxxxxxxxxxxx>,<20111128111947.GA26454@xxxxxxxxxxxxx>
I have tried this patch, And problem resolved!
Thank you for your help!

 
> Date: Mon, 28 Nov 2011 06:19:47 -0500
> From: hch@xxxxxxxxxxxxx
> To: ygq51@xxxxxxxxxxx
> Subject: Re: xfs: validate inode numbers in file handles correctly
> CC: linux-xfs@xxxxxxxxxxx; pengxihan@xxxxxxxxx
>
> 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@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs
<Prev in Thread] Current Thread [Next in Thread>