diff options
author | Wendy Cheng <wcheng@redhat.com> | 2006-07-11 13:28:53 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-07-13 09:24:48 -0400 |
commit | 2eb168ca94aba3bcae350ad9b31870955174a218 (patch) | |
tree | ba50aeedc42f33a24ff031780f4cd1a00f3afeb9 | |
parent | 4da3c6463ef6759fb50d12c8652bc29c5c1730a4 (diff) |
[GFS2] NFS update
Update the NFS filehandles so that they contain the file type.
Signed-off-by: Wendy Cheng <wcheng@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r-- | fs/gfs2/ops_export.c | 32 | ||||
-rw-r--r-- | fs/gfs2/ops_export.h | 4 |
2 files changed, 24 insertions, 12 deletions
diff --git a/fs/gfs2/ops_export.c b/fs/gfs2/ops_export.c index eacc1c092f91..6354f4799e68 100644 --- a/fs/gfs2/ops_export.c +++ b/fs/gfs2/ops_export.c | |||
@@ -34,30 +34,34 @@ static struct dentry *gfs2_decode_fh(struct super_block *sb, | |||
34 | struct dentry *dentry), | 34 | struct dentry *dentry), |
35 | void *context) | 35 | void *context) |
36 | { | 36 | { |
37 | struct gfs2_inum this, parent; | 37 | struct gfs2_fh_obj fh_obj; |
38 | struct gfs2_inum *this, parent; | ||
38 | 39 | ||
39 | if (fh_type != fh_len) | 40 | if (fh_type != fh_len) |
40 | return NULL; | 41 | return NULL; |
41 | 42 | ||
43 | this = &fh_obj.this; | ||
44 | fh_obj.imode = DT_UNKNOWN; | ||
42 | memset(&parent, 0, sizeof(struct gfs2_inum)); | 45 | memset(&parent, 0, sizeof(struct gfs2_inum)); |
43 | 46 | ||
44 | switch (fh_type) { | 47 | switch (fh_type) { |
45 | case 8: | 48 | case 10: |
46 | parent.no_formal_ino = ((uint64_t)be32_to_cpu(fh[4])) << 32; | 49 | parent.no_formal_ino = ((uint64_t)be32_to_cpu(fh[4])) << 32; |
47 | parent.no_formal_ino |= be32_to_cpu(fh[5]); | 50 | parent.no_formal_ino |= be32_to_cpu(fh[5]); |
48 | parent.no_addr = ((uint64_t)be32_to_cpu(fh[6])) << 32; | 51 | parent.no_addr = ((uint64_t)be32_to_cpu(fh[6])) << 32; |
49 | parent.no_addr |= be32_to_cpu(fh[7]); | 52 | parent.no_addr |= be32_to_cpu(fh[7]); |
53 | fh_obj.imode = be32_to_cpu(fh[8]); | ||
50 | case 4: | 54 | case 4: |
51 | this.no_formal_ino = ((uint64_t)be32_to_cpu(fh[0])) << 32; | 55 | this->no_formal_ino = ((uint64_t)be32_to_cpu(fh[0])) << 32; |
52 | this.no_formal_ino |= be32_to_cpu(fh[1]); | 56 | this->no_formal_ino |= be32_to_cpu(fh[1]); |
53 | this.no_addr = ((uint64_t)be32_to_cpu(fh[2])) << 32; | 57 | this->no_addr = ((uint64_t)be32_to_cpu(fh[2])) << 32; |
54 | this.no_addr |= be32_to_cpu(fh[3]); | 58 | this->no_addr |= be32_to_cpu(fh[3]); |
55 | break; | 59 | break; |
56 | default: | 60 | default: |
57 | return NULL; | 61 | return NULL; |
58 | } | 62 | } |
59 | 63 | ||
60 | return gfs2_export_ops.find_exported_dentry(sb, &this, &parent, | 64 | return gfs2_export_ops.find_exported_dentry(sb, &fh_obj, &parent, |
61 | acceptable, context); | 65 | acceptable, context); |
62 | } | 66 | } |
63 | 67 | ||
@@ -68,7 +72,7 @@ static int gfs2_encode_fh(struct dentry *dentry, __u32 *fh, int *len, | |||
68 | struct super_block *sb = inode->i_sb; | 72 | struct super_block *sb = inode->i_sb; |
69 | struct gfs2_inode *ip = GFS2_I(inode); | 73 | struct gfs2_inode *ip = GFS2_I(inode); |
70 | 74 | ||
71 | if (*len < 4 || (connectable && *len < 8)) | 75 | if (*len < 4 || (connectable && *len < 10)) |
72 | return 255; | 76 | return 255; |
73 | 77 | ||
74 | fh[0] = ip->i_num.no_formal_ino >> 32; | 78 | fh[0] = ip->i_num.no_formal_ino >> 32; |
@@ -98,7 +102,10 @@ static int gfs2_encode_fh(struct dentry *dentry, __u32 *fh, int *len, | |||
98 | fh[6] = cpu_to_be32(fh[6]); | 102 | fh[6] = cpu_to_be32(fh[6]); |
99 | fh[7] = ip->i_num.no_addr & 0xFFFFFFFF; | 103 | fh[7] = ip->i_num.no_addr & 0xFFFFFFFF; |
100 | fh[7] = cpu_to_be32(fh[7]); | 104 | fh[7] = cpu_to_be32(fh[7]); |
101 | *len = 8; | 105 | |
106 | fh[8] = cpu_to_be32(inode->i_mode); | ||
107 | fh[9] = 0; /* pad to double word */ | ||
108 | *len = 10; | ||
102 | 109 | ||
103 | iput(inode); | 110 | iput(inode); |
104 | 111 | ||
@@ -186,10 +193,11 @@ static struct dentry *gfs2_get_parent(struct dentry *child) | |||
186 | return dentry; | 193 | return dentry; |
187 | } | 194 | } |
188 | 195 | ||
189 | static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_p) | 196 | static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_obj) |
190 | { | 197 | { |
191 | struct gfs2_sbd *sdp = sb->s_fs_info; | 198 | struct gfs2_sbd *sdp = sb->s_fs_info; |
192 | struct gfs2_inum *inum = inum_p; | 199 | struct gfs2_fh_obj *fh_obj = (struct gfs2_fh_obj *)inum_obj; |
200 | struct gfs2_inum *inum = &fh_obj->this; | ||
193 | struct gfs2_holder i_gh, ri_gh, rgd_gh; | 201 | struct gfs2_holder i_gh, ri_gh, rgd_gh; |
194 | struct gfs2_rgrpd *rgd; | 202 | struct gfs2_rgrpd *rgd; |
195 | struct inode *inode; | 203 | struct inode *inode; |
@@ -233,7 +241,7 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_p) | |||
233 | gfs2_glock_dq_uninit(&rgd_gh); | 241 | gfs2_glock_dq_uninit(&rgd_gh); |
234 | gfs2_glock_dq_uninit(&ri_gh); | 242 | gfs2_glock_dq_uninit(&ri_gh); |
235 | 243 | ||
236 | inode = gfs2_inode_lookup(sb, inum, DT_UNKNOWN); | 244 | inode = gfs2_inode_lookup(sb, inum, fh_obj->imode); |
237 | if (!inode) | 245 | if (!inode) |
238 | goto fail; | 246 | goto fail; |
239 | if (IS_ERR(inode)) { | 247 | if (IS_ERR(inode)) { |
diff --git a/fs/gfs2/ops_export.h b/fs/gfs2/ops_export.h index 88d58e57f518..09fc077657d1 100644 --- a/fs/gfs2/ops_export.h +++ b/fs/gfs2/ops_export.h | |||
@@ -11,5 +11,9 @@ | |||
11 | #define __OPS_EXPORT_DOT_H__ | 11 | #define __OPS_EXPORT_DOT_H__ |
12 | 12 | ||
13 | extern struct export_operations gfs2_export_ops; | 13 | extern struct export_operations gfs2_export_ops; |
14 | struct gfs2_fh_obj { | ||
15 | struct gfs2_inum this; | ||
16 | __u32 imode; | ||
17 | }; | ||
14 | 18 | ||
15 | #endif /* __OPS_EXPORT_DOT_H__ */ | 19 | #endif /* __OPS_EXPORT_DOT_H__ */ |