diff options
Diffstat (limited to 'fs/gfs2/super.c')
| -rw-r--r-- | fs/gfs2/super.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index a4e23d68a398..b9f28e66dad1 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
| @@ -1318,15 +1318,17 @@ static int gfs2_show_options(struct seq_file *s, struct vfsmount *mnt) | |||
| 1318 | 1318 | ||
| 1319 | static void gfs2_evict_inode(struct inode *inode) | 1319 | static void gfs2_evict_inode(struct inode *inode) |
| 1320 | { | 1320 | { |
| 1321 | struct gfs2_sbd *sdp = inode->i_sb->s_fs_info; | 1321 | struct super_block *sb = inode->i_sb; |
| 1322 | struct gfs2_sbd *sdp = sb->s_fs_info; | ||
| 1322 | struct gfs2_inode *ip = GFS2_I(inode); | 1323 | struct gfs2_inode *ip = GFS2_I(inode); |
| 1323 | struct gfs2_holder gh; | 1324 | struct gfs2_holder gh; |
| 1324 | int error; | 1325 | int error; |
| 1325 | 1326 | ||
| 1326 | if (inode->i_nlink) | 1327 | if (inode->i_nlink || (sb->s_flags & MS_RDONLY)) |
| 1327 | goto out; | 1328 | goto out; |
| 1328 | 1329 | ||
| 1329 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); | 1330 | /* Must not read inode block until block type has been verified */ |
| 1331 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_SKIP, &gh); | ||
| 1330 | if (unlikely(error)) { | 1332 | if (unlikely(error)) { |
| 1331 | gfs2_glock_dq_uninit(&ip->i_iopen_gh); | 1333 | gfs2_glock_dq_uninit(&ip->i_iopen_gh); |
| 1332 | goto out; | 1334 | goto out; |
| @@ -1336,6 +1338,12 @@ static void gfs2_evict_inode(struct inode *inode) | |||
| 1336 | if (error) | 1338 | if (error) |
| 1337 | goto out_truncate; | 1339 | goto out_truncate; |
| 1338 | 1340 | ||
| 1341 | if (test_bit(GIF_INVALID, &ip->i_flags)) { | ||
| 1342 | error = gfs2_inode_refresh(ip); | ||
| 1343 | if (error) | ||
| 1344 | goto out_truncate; | ||
| 1345 | } | ||
| 1346 | |||
| 1339 | ip->i_iopen_gh.gh_flags |= GL_NOCACHE; | 1347 | ip->i_iopen_gh.gh_flags |= GL_NOCACHE; |
| 1340 | gfs2_glock_dq_wait(&ip->i_iopen_gh); | 1348 | gfs2_glock_dq_wait(&ip->i_iopen_gh); |
| 1341 | gfs2_holder_reinit(LM_ST_EXCLUSIVE, LM_FLAG_TRY_1CB | GL_NOCACHE, &ip->i_iopen_gh); | 1349 | gfs2_holder_reinit(LM_ST_EXCLUSIVE, LM_FLAG_TRY_1CB | GL_NOCACHE, &ip->i_iopen_gh); |
