diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2007-05-15 10:37:50 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2007-07-09 03:22:24 -0400 |
commit | dbb7cae2a36170cd17ffbe286ec0c91a998740ff (patch) | |
tree | 1f4da65b07ac31648fe9b72f2742075486a86008 /fs/gfs2/ops_export.c | |
parent | 41d7db0ab437bc84f8a6e77cccc626ce937605ac (diff) |
[GFS2] Clean up inode number handling
This patch cleans up the inode number handling code. The main difference
is that instead of looking up the inodes using a struct gfs2_inum_host
we now use just the no_addr member of this structure. The tests relating
to no_formal_ino can then be done by the calling code. This has
advantages in that we want to do different things in different code
paths if the no_formal_ino doesn't match. In the NFS patch we want to
return -ESTALE, but in the ->lookup() path, its a bug in the fs if the
no_formal_ino doesn't match and thus we can withdraw in this case.
In order to later fix bz #201012, we need to be able to look up an inode
without knowing no_formal_ino, as the only information that is known to
us is the on-disk location of the inode in question.
This patch will also help us to fix bz #236099 at a later date by
cleaning up a lot of the code in that area.
There are no user visible changes as a result of this patch and there
are no changes to the on-disk format either.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_export.c')
-rw-r--r-- | fs/gfs2/ops_export.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/fs/gfs2/ops_export.c b/fs/gfs2/ops_export.c index aad918337a46..51a8a14deb29 100644 --- a/fs/gfs2/ops_export.c +++ b/fs/gfs2/ops_export.c | |||
@@ -75,10 +75,10 @@ static int gfs2_encode_fh(struct dentry *dentry, __u32 *p, int *len, | |||
75 | (connectable && *len < GFS2_LARGE_FH_SIZE)) | 75 | (connectable && *len < GFS2_LARGE_FH_SIZE)) |
76 | return 255; | 76 | return 255; |
77 | 77 | ||
78 | fh[0] = cpu_to_be32(ip->i_num.no_formal_ino >> 32); | 78 | fh[0] = cpu_to_be32(ip->i_no_formal_ino >> 32); |
79 | fh[1] = cpu_to_be32(ip->i_num.no_formal_ino & 0xFFFFFFFF); | 79 | fh[1] = cpu_to_be32(ip->i_no_formal_ino & 0xFFFFFFFF); |
80 | fh[2] = cpu_to_be32(ip->i_num.no_addr >> 32); | 80 | fh[2] = cpu_to_be32(ip->i_no_addr >> 32); |
81 | fh[3] = cpu_to_be32(ip->i_num.no_addr & 0xFFFFFFFF); | 81 | fh[3] = cpu_to_be32(ip->i_no_addr & 0xFFFFFFFF); |
82 | *len = GFS2_SMALL_FH_SIZE; | 82 | *len = GFS2_SMALL_FH_SIZE; |
83 | 83 | ||
84 | if (!connectable || inode == sb->s_root->d_inode) | 84 | if (!connectable || inode == sb->s_root->d_inode) |
@@ -90,10 +90,10 @@ static int gfs2_encode_fh(struct dentry *dentry, __u32 *p, int *len, | |||
90 | igrab(inode); | 90 | igrab(inode); |
91 | spin_unlock(&dentry->d_lock); | 91 | spin_unlock(&dentry->d_lock); |
92 | 92 | ||
93 | fh[4] = cpu_to_be32(ip->i_num.no_formal_ino >> 32); | 93 | fh[4] = cpu_to_be32(ip->i_no_formal_ino >> 32); |
94 | fh[5] = cpu_to_be32(ip->i_num.no_formal_ino & 0xFFFFFFFF); | 94 | fh[5] = cpu_to_be32(ip->i_no_formal_ino & 0xFFFFFFFF); |
95 | fh[6] = cpu_to_be32(ip->i_num.no_addr >> 32); | 95 | fh[6] = cpu_to_be32(ip->i_no_addr >> 32); |
96 | fh[7] = cpu_to_be32(ip->i_num.no_addr & 0xFFFFFFFF); | 96 | fh[7] = cpu_to_be32(ip->i_no_addr & 0xFFFFFFFF); |
97 | 97 | ||
98 | fh[8] = cpu_to_be32(inode->i_mode); | 98 | fh[8] = cpu_to_be32(inode->i_mode); |
99 | fh[9] = 0; /* pad to double word */ | 99 | fh[9] = 0; /* pad to double word */ |
@@ -144,7 +144,8 @@ static int gfs2_get_name(struct dentry *parent, char *name, | |||
144 | ip = GFS2_I(inode); | 144 | ip = GFS2_I(inode); |
145 | 145 | ||
146 | *name = 0; | 146 | *name = 0; |
147 | gnfd.inum = ip->i_num; | 147 | gnfd.inum.no_addr = ip->i_no_addr; |
148 | gnfd.inum.no_formal_ino = ip->i_no_formal_ino; | ||
148 | gnfd.name = name; | 149 | gnfd.name = name; |
149 | 150 | ||
150 | error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &gh); | 151 | error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &gh); |
@@ -202,9 +203,9 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_obj) | |||
202 | 203 | ||
203 | /* System files? */ | 204 | /* System files? */ |
204 | 205 | ||
205 | inode = gfs2_ilookup(sb, inum); | 206 | inode = gfs2_ilookup(sb, inum->no_addr); |
206 | if (inode) { | 207 | if (inode) { |
207 | if (GFS2_I(inode)->i_num.no_formal_ino != inum->no_formal_ino) { | 208 | if (GFS2_I(inode)->i_no_formal_ino != inum->no_formal_ino) { |
208 | iput(inode); | 209 | iput(inode); |
209 | return ERR_PTR(-ESTALE); | 210 | return ERR_PTR(-ESTALE); |
210 | } | 211 | } |
@@ -236,7 +237,7 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_obj) | |||
236 | gfs2_glock_dq_uninit(&rgd_gh); | 237 | gfs2_glock_dq_uninit(&rgd_gh); |
237 | gfs2_glock_dq_uninit(&ri_gh); | 238 | gfs2_glock_dq_uninit(&ri_gh); |
238 | 239 | ||
239 | inode = gfs2_inode_lookup(sb, inum, fh_obj->imode); | 240 | inode = gfs2_inode_lookup(sb, inum->no_addr, fh_obj->imode); |
240 | if (!inode) | 241 | if (!inode) |
241 | goto fail; | 242 | goto fail; |
242 | if (IS_ERR(inode)) { | 243 | if (IS_ERR(inode)) { |
@@ -249,6 +250,10 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_obj) | |||
249 | iput(inode); | 250 | iput(inode); |
250 | goto fail; | 251 | goto fail; |
251 | } | 252 | } |
253 | if (GFS2_I(inode)->i_no_formal_ino != inum->no_formal_ino) { | ||
254 | iput(inode); | ||
255 | goto fail; | ||
256 | } | ||
252 | 257 | ||
253 | error = -EIO; | 258 | error = -EIO; |
254 | if (GFS2_I(inode)->i_di.di_flags & GFS2_DIF_SYSTEM) { | 259 | if (GFS2_I(inode)->i_di.di_flags & GFS2_DIF_SYSTEM) { |