diff options
Diffstat (limited to 'fs/gfs2/ops_export.c')
-rw-r--r-- | fs/gfs2/ops_export.c | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/fs/gfs2/ops_export.c b/fs/gfs2/ops_export.c index 0fe14478a54d..e317db2a5548 100644 --- a/fs/gfs2/ops_export.c +++ b/fs/gfs2/ops_export.c | |||
@@ -27,12 +27,7 @@ | |||
27 | #include "util.h" | 27 | #include "util.h" |
28 | 28 | ||
29 | #define GFS2_SMALL_FH_SIZE 4 | 29 | #define GFS2_SMALL_FH_SIZE 4 |
30 | #define GFS2_LARGE_FH_SIZE 10 | 30 | #define GFS2_LARGE_FH_SIZE 8 |
31 | |||
32 | struct gfs2_fh_obj { | ||
33 | struct gfs2_inum_host this; | ||
34 | u32 imode; | ||
35 | }; | ||
36 | 31 | ||
37 | static struct dentry *gfs2_decode_fh(struct super_block *sb, | 32 | static struct dentry *gfs2_decode_fh(struct super_block *sb, |
38 | __u32 *p, | 33 | __u32 *p, |
@@ -43,11 +38,8 @@ static struct dentry *gfs2_decode_fh(struct super_block *sb, | |||
43 | void *context) | 38 | void *context) |
44 | { | 39 | { |
45 | __be32 *fh = (__force __be32 *)p; | 40 | __be32 *fh = (__force __be32 *)p; |
46 | struct gfs2_fh_obj fh_obj; | 41 | struct gfs2_inum_host inum, parent; |
47 | struct gfs2_inum_host *this, parent; | ||
48 | 42 | ||
49 | this = &fh_obj.this; | ||
50 | fh_obj.imode = DT_UNKNOWN; | ||
51 | memset(&parent, 0, sizeof(struct gfs2_inum)); | 43 | memset(&parent, 0, sizeof(struct gfs2_inum)); |
52 | 44 | ||
53 | switch (fh_len) { | 45 | switch (fh_len) { |
@@ -56,18 +48,17 @@ static struct dentry *gfs2_decode_fh(struct super_block *sb, | |||
56 | parent.no_formal_ino |= be32_to_cpu(fh[5]); | 48 | parent.no_formal_ino |= be32_to_cpu(fh[5]); |
57 | parent.no_addr = ((u64)be32_to_cpu(fh[6])) << 32; | 49 | parent.no_addr = ((u64)be32_to_cpu(fh[6])) << 32; |
58 | parent.no_addr |= be32_to_cpu(fh[7]); | 50 | parent.no_addr |= be32_to_cpu(fh[7]); |
59 | fh_obj.imode = be32_to_cpu(fh[8]); | ||
60 | case GFS2_SMALL_FH_SIZE: | 51 | case GFS2_SMALL_FH_SIZE: |
61 | this->no_formal_ino = ((u64)be32_to_cpu(fh[0])) << 32; | 52 | inum.no_formal_ino = ((u64)be32_to_cpu(fh[0])) << 32; |
62 | this->no_formal_ino |= be32_to_cpu(fh[1]); | 53 | inum.no_formal_ino |= be32_to_cpu(fh[1]); |
63 | this->no_addr = ((u64)be32_to_cpu(fh[2])) << 32; | 54 | inum.no_addr = ((u64)be32_to_cpu(fh[2])) << 32; |
64 | this->no_addr |= be32_to_cpu(fh[3]); | 55 | inum.no_addr |= be32_to_cpu(fh[3]); |
65 | break; | 56 | break; |
66 | default: | 57 | default: |
67 | return NULL; | 58 | return NULL; |
68 | } | 59 | } |
69 | 60 | ||
70 | return gfs2_export_ops.find_exported_dentry(sb, &fh_obj, &parent, | 61 | return gfs2_export_ops.find_exported_dentry(sb, &inum, &parent, |
71 | acceptable, context); | 62 | acceptable, context); |
72 | } | 63 | } |
73 | 64 | ||
@@ -102,9 +93,6 @@ static int gfs2_encode_fh(struct dentry *dentry, __u32 *p, int *len, | |||
102 | fh[5] = cpu_to_be32(ip->i_no_formal_ino & 0xFFFFFFFF); | 93 | fh[5] = cpu_to_be32(ip->i_no_formal_ino & 0xFFFFFFFF); |
103 | fh[6] = cpu_to_be32(ip->i_no_addr >> 32); | 94 | fh[6] = cpu_to_be32(ip->i_no_addr >> 32); |
104 | fh[7] = cpu_to_be32(ip->i_no_addr & 0xFFFFFFFF); | 95 | fh[7] = cpu_to_be32(ip->i_no_addr & 0xFFFFFFFF); |
105 | |||
106 | fh[8] = cpu_to_be32(inode->i_mode); | ||
107 | fh[9] = 0; /* pad to double word */ | ||
108 | *len = GFS2_LARGE_FH_SIZE; | 96 | *len = GFS2_LARGE_FH_SIZE; |
109 | 97 | ||
110 | iput(inode); | 98 | iput(inode); |
@@ -201,8 +189,7 @@ static struct dentry *gfs2_get_parent(struct dentry *child) | |||
201 | static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_obj) | 189 | static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_obj) |
202 | { | 190 | { |
203 | struct gfs2_sbd *sdp = sb->s_fs_info; | 191 | struct gfs2_sbd *sdp = sb->s_fs_info; |
204 | struct gfs2_fh_obj *fh_obj = (struct gfs2_fh_obj *)inum_obj; | 192 | struct gfs2_inum_host *inum = inum_obj; |
205 | struct gfs2_inum_host *inum = &fh_obj->this; | ||
206 | struct gfs2_holder i_gh, ri_gh, rgd_gh; | 193 | struct gfs2_holder i_gh, ri_gh, rgd_gh; |
207 | struct gfs2_rgrpd *rgd; | 194 | struct gfs2_rgrpd *rgd; |
208 | struct inode *inode; | 195 | struct inode *inode; |
@@ -245,9 +232,9 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_obj) | |||
245 | gfs2_glock_dq_uninit(&rgd_gh); | 232 | gfs2_glock_dq_uninit(&rgd_gh); |
246 | gfs2_glock_dq_uninit(&ri_gh); | 233 | gfs2_glock_dq_uninit(&ri_gh); |
247 | 234 | ||
248 | inode = gfs2_inode_lookup(sb, fh_obj->imode, | 235 | inode = gfs2_inode_lookup(sb, DT_UNKNOWN, |
249 | inum->no_addr, | 236 | inum->no_addr, |
250 | inum->no_formal_ino); | 237 | 0); |
251 | if (!inode) | 238 | if (!inode) |
252 | goto fail; | 239 | goto fail; |
253 | if (IS_ERR(inode)) { | 240 | if (IS_ERR(inode)) { |
@@ -260,6 +247,11 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_obj) | |||
260 | iput(inode); | 247 | iput(inode); |
261 | goto fail; | 248 | goto fail; |
262 | } | 249 | } |
250 | |||
251 | /* Pick up the works we bypass in gfs2_inode_lookup */ | ||
252 | if (inode->i_state & I_NEW) | ||
253 | gfs2_set_iop(inode); | ||
254 | |||
263 | if (GFS2_I(inode)->i_no_formal_ino != inum->no_formal_ino) { | 255 | if (GFS2_I(inode)->i_no_formal_ino != inum->no_formal_ino) { |
264 | iput(inode); | 256 | iput(inode); |
265 | goto fail; | 257 | goto fail; |