diff options
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r-- | fs/gfs2/inode.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 4c5d286fefdb..7ba05fc553aa 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -208,13 +208,18 @@ fail: | |||
208 | return ERR_PTR(error); | 208 | return ERR_PTR(error); |
209 | } | 209 | } |
210 | 210 | ||
211 | static void gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) | 211 | static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) |
212 | { | 212 | { |
213 | struct gfs2_dinode_host *di = &ip->i_di; | 213 | struct gfs2_dinode_host *di = &ip->i_di; |
214 | const struct gfs2_dinode *str = buf; | 214 | const struct gfs2_dinode *str = buf; |
215 | 215 | ||
216 | gfs2_meta_header_in(&di->di_header, buf); | 216 | if (ip->i_num.no_addr != be64_to_cpu(str->di_num.no_addr)) { |
217 | gfs2_inum_in(&di->di_num, &str->di_num); | 217 | if (gfs2_consist_inode(ip)) |
218 | gfs2_dinode_print(ip); | ||
219 | return -EIO; | ||
220 | } | ||
221 | if (ip->i_num.no_formal_ino != be64_to_cpu(str->di_num.no_formal_ino)) | ||
222 | return -ESTALE; | ||
218 | 223 | ||
219 | di->di_mode = be32_to_cpu(str->di_mode); | 224 | di->di_mode = be32_to_cpu(str->di_mode); |
220 | di->di_uid = be32_to_cpu(str->di_uid); | 225 | di->di_uid = be32_to_cpu(str->di_uid); |
@@ -240,6 +245,7 @@ static void gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) | |||
240 | di->di_entries = be32_to_cpu(str->di_entries); | 245 | di->di_entries = be32_to_cpu(str->di_entries); |
241 | 246 | ||
242 | di->di_eattr = be64_to_cpu(str->di_eattr); | 247 | di->di_eattr = be64_to_cpu(str->di_eattr); |
248 | return 0; | ||
243 | } | 249 | } |
244 | 250 | ||
245 | /** | 251 | /** |
@@ -263,21 +269,12 @@ int gfs2_inode_refresh(struct gfs2_inode *ip) | |||
263 | return -EIO; | 269 | return -EIO; |
264 | } | 270 | } |
265 | 271 | ||
266 | gfs2_dinode_in(ip, dibh->b_data); | 272 | error = gfs2_dinode_in(ip, dibh->b_data); |
267 | 273 | ||
268 | brelse(dibh); | 274 | brelse(dibh); |
269 | |||
270 | if (ip->i_num.no_addr != ip->i_di.di_num.no_addr) { | ||
271 | if (gfs2_consist_inode(ip)) | ||
272 | gfs2_dinode_print(ip); | ||
273 | return -EIO; | ||
274 | } | ||
275 | if (ip->i_num.no_formal_ino != ip->i_di.di_num.no_formal_ino) | ||
276 | return -ESTALE; | ||
277 | |||
278 | ip->i_vn = ip->i_gl->gl_vn; | 275 | ip->i_vn = ip->i_gl->gl_vn; |
279 | 276 | ||
280 | return 0; | 277 | return error; |
281 | } | 278 | } |
282 | 279 | ||
283 | int gfs2_dinode_dealloc(struct gfs2_inode *ip) | 280 | int gfs2_dinode_dealloc(struct gfs2_inode *ip) |