diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_export.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_export.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/linux-2.6/xfs_export.c index 15bd494883..ca4f66c4de 100644 --- a/fs/xfs/linux-2.6/xfs_export.c +++ b/fs/xfs/linux-2.6/xfs_export.c | |||
@@ -118,20 +118,29 @@ xfs_nfs_get_inode( | |||
118 | u64 ino, | 118 | u64 ino, |
119 | u32 generation) | 119 | u32 generation) |
120 | { | 120 | { |
121 | xfs_fid_t xfid; | 121 | xfs_mount_t *mp = XFS_M(sb); |
122 | bhv_vnode_t *vp; | 122 | xfs_inode_t *ip; |
123 | int error; | 123 | int error; |
124 | 124 | ||
125 | xfid.fid_len = sizeof(xfs_fid_t) - sizeof(xfid.fid_len); | 125 | /* |
126 | xfid.fid_pad = 0; | 126 | * NFS can sometimes send requests for ino 0. Fail them gracefully. |
127 | xfid.fid_ino = ino; | 127 | */ |
128 | xfid.fid_gen = generation; | 128 | if (ino == 0) |
129 | return ERR_PTR(-ESTALE); | ||
129 | 130 | ||
130 | error = xfs_vget(XFS_M(sb), &vp, &xfid); | 131 | error = xfs_iget(mp, NULL, ino, 0, XFS_ILOCK_SHARED, &ip, 0); |
131 | if (error) | 132 | if (error) |
132 | return ERR_PTR(-error); | 133 | return ERR_PTR(-error); |
134 | if (!ip) | ||
135 | return ERR_PTR(-EIO); | ||
136 | |||
137 | if (!ip->i_d.di_mode || ip->i_d.di_gen != generation) { | ||
138 | xfs_iput_new(ip, XFS_ILOCK_SHARED); | ||
139 | return ERR_PTR(-ENOENT); | ||
140 | } | ||
133 | 141 | ||
134 | return vp ? vn_to_inode(vp) : NULL; | 142 | xfs_iunlock(ip, XFS_ILOCK_SHARED); |
143 | return ip->i_vnode; | ||
135 | } | 144 | } |
136 | 145 | ||
137 | STATIC struct dentry * | 146 | STATIC struct dentry * |