Skip to content

Commit c29f7d4

Browse files
Christoph HellwigBen Myers
authored andcommitted
xfs: fix nfs export of 64-bit inodes numbers on 32-bit kernels
The i_ino field in the VFS inode is of type unsigned long and thus can't hold the full 64-bit inode number on 32-bit kernels. We have the full inode number in the XFS inode, so use that one for nfs exports. Note that I've also switched the 32-bit file handles types to it, just to make the code more consistent and copy & paste errors less likely to happen. Reported-by: Guoquan Yang <ygq51@hotmail.com> Reported-by: Hank Peng <pengxihan@gmail.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ben Myers <bpm@sgi.com>
1 parent a99ebf4 commit c29f7d4

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎fs/xfs/xfs_export.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,22 +98,22 @@ xfs_fs_encode_fh(
9898
switch (fileid_type) {
9999
case FILEID_INO32_GEN_PARENT:
100100
spin_lock(&dentry->d_lock);
101-
fid->i32.parent_ino = dentry->d_parent->d_inode->i_ino;
101+
fid->i32.parent_ino = XFS_I(dentry->d_parent->d_inode)->i_ino;
102102
fid->i32.parent_gen = dentry->d_parent->d_inode->i_generation;
103103
spin_unlock(&dentry->d_lock);
104104
/*FALLTHRU*/
105105
case FILEID_INO32_GEN:
106-
fid->i32.ino = inode->i_ino;
106+
fid->i32.ino = XFS_I(inode)->i_ino;
107107
fid->i32.gen = inode->i_generation;
108108
break;
109109
case FILEID_INO32_GEN_PARENT | XFS_FILEID_TYPE_64FLAG:
110110
spin_lock(&dentry->d_lock);
111-
fid64->parent_ino = dentry->d_parent->d_inode->i_ino;
111+
fid64->parent_ino = XFS_I(dentry->d_parent->d_inode)->i_ino;
112112
fid64->parent_gen = dentry->d_parent->d_inode->i_generation;
113113
spin_unlock(&dentry->d_lock);
114114
/*FALLTHRU*/
115115
case FILEID_INO32_GEN | XFS_FILEID_TYPE_64FLAG:
116-
fid64->ino = inode->i_ino;
116+
fid64->ino = XFS_I(inode)->i_ino;
117117
fid64->gen = inode->i_generation;
118118
break;
119119
}

0 commit comments

Comments
 (0)