diff options
Diffstat (limited to 'mm/shmem.c')
-rw-r--r-- | mm/shmem.c | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index 289dbb0a6fd6..404e53bb2127 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -2020,33 +2020,25 @@ static int shmem_match(struct inode *ino, void *vfh) | |||
2020 | return ino->i_ino == inum && fh[0] == ino->i_generation; | 2020 | return ino->i_ino == inum && fh[0] == ino->i_generation; |
2021 | } | 2021 | } |
2022 | 2022 | ||
2023 | static struct dentry *shmem_get_dentry(struct super_block *sb, void *vfh) | 2023 | static struct dentry *shmem_fh_to_dentry(struct super_block *sb, |
2024 | struct fid *fid, int fh_len, int fh_type) | ||
2024 | { | 2025 | { |
2025 | struct dentry *de = NULL; | ||
2026 | struct inode *inode; | 2026 | struct inode *inode; |
2027 | __u32 *fh = vfh; | 2027 | struct dentry *dentry = NULL; |
2028 | __u64 inum = fh[2]; | 2028 | u64 inum = fid->raw[2]; |
2029 | inum = (inum << 32) | fh[1]; | 2029 | inum = (inum << 32) | fid->raw[1]; |
2030 | |||
2031 | if (fh_len < 3) | ||
2032 | return NULL; | ||
2030 | 2033 | ||
2031 | inode = ilookup5(sb, (unsigned long)(inum+fh[0]), shmem_match, vfh); | 2034 | inode = ilookup5(sb, (unsigned long)(inum + fid->raw[0]), |
2035 | shmem_match, fid->raw); | ||
2032 | if (inode) { | 2036 | if (inode) { |
2033 | de = d_find_alias(inode); | 2037 | dentry = d_find_alias(inode); |
2034 | iput(inode); | 2038 | iput(inode); |
2035 | } | 2039 | } |
2036 | 2040 | ||
2037 | return de? de: ERR_PTR(-ESTALE); | 2041 | return dentry; |
2038 | } | ||
2039 | |||
2040 | static struct dentry *shmem_decode_fh(struct super_block *sb, __u32 *fh, | ||
2041 | int len, int type, | ||
2042 | int (*acceptable)(void *context, struct dentry *de), | ||
2043 | void *context) | ||
2044 | { | ||
2045 | if (len < 3) | ||
2046 | return ERR_PTR(-ESTALE); | ||
2047 | |||
2048 | return sb->s_export_op->find_exported_dentry(sb, fh, NULL, acceptable, | ||
2049 | context); | ||
2050 | } | 2042 | } |
2051 | 2043 | ||
2052 | static int shmem_encode_fh(struct dentry *dentry, __u32 *fh, int *len, | 2044 | static int shmem_encode_fh(struct dentry *dentry, __u32 *fh, int *len, |
@@ -2079,11 +2071,10 @@ static int shmem_encode_fh(struct dentry *dentry, __u32 *fh, int *len, | |||
2079 | return 1; | 2071 | return 1; |
2080 | } | 2072 | } |
2081 | 2073 | ||
2082 | static struct export_operations shmem_export_ops = { | 2074 | static const struct export_operations shmem_export_ops = { |
2083 | .get_parent = shmem_get_parent, | 2075 | .get_parent = shmem_get_parent, |
2084 | .get_dentry = shmem_get_dentry, | ||
2085 | .encode_fh = shmem_encode_fh, | 2076 | .encode_fh = shmem_encode_fh, |
2086 | .decode_fh = shmem_decode_fh, | 2077 | .fh_to_dentry = shmem_fh_to_dentry, |
2087 | }; | 2078 | }; |
2088 | 2079 | ||
2089 | static int shmem_parse_options(char *options, int *mode, uid_t *uid, | 2080 | static int shmem_parse_options(char *options, int *mode, uid_t *uid, |