diff options
Diffstat (limited to 'fs/gfs2/super.c')
-rw-r--r-- | fs/gfs2/super.c | 43 |
1 files changed, 17 insertions, 26 deletions
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index 4140811a921c..77cb9f830ee4 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -1188,7 +1188,7 @@ static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data) | |||
1188 | * node for later deallocation. | 1188 | * node for later deallocation. |
1189 | */ | 1189 | */ |
1190 | 1190 | ||
1191 | static void gfs2_drop_inode(struct inode *inode) | 1191 | static int gfs2_drop_inode(struct inode *inode) |
1192 | { | 1192 | { |
1193 | struct gfs2_inode *ip = GFS2_I(inode); | 1193 | struct gfs2_inode *ip = GFS2_I(inode); |
1194 | 1194 | ||
@@ -1197,26 +1197,7 @@ static void gfs2_drop_inode(struct inode *inode) | |||
1197 | if (gl && test_bit(GLF_DEMOTE, &gl->gl_flags)) | 1197 | if (gl && test_bit(GLF_DEMOTE, &gl->gl_flags)) |
1198 | clear_nlink(inode); | 1198 | clear_nlink(inode); |
1199 | } | 1199 | } |
1200 | generic_drop_inode(inode); | 1200 | return generic_drop_inode(inode); |
1201 | } | ||
1202 | |||
1203 | /** | ||
1204 | * gfs2_clear_inode - Deallocate an inode when VFS is done with it | ||
1205 | * @inode: The VFS inode | ||
1206 | * | ||
1207 | */ | ||
1208 | |||
1209 | static void gfs2_clear_inode(struct inode *inode) | ||
1210 | { | ||
1211 | struct gfs2_inode *ip = GFS2_I(inode); | ||
1212 | |||
1213 | ip->i_gl->gl_object = NULL; | ||
1214 | gfs2_glock_put(ip->i_gl); | ||
1215 | ip->i_gl = NULL; | ||
1216 | if (ip->i_iopen_gh.gh_gl) { | ||
1217 | ip->i_iopen_gh.gh_gl->gl_object = NULL; | ||
1218 | gfs2_glock_dq_uninit(&ip->i_iopen_gh); | ||
1219 | } | ||
1220 | } | 1201 | } |
1221 | 1202 | ||
1222 | static int is_ancestor(const struct dentry *d1, const struct dentry *d2) | 1203 | static int is_ancestor(const struct dentry *d1, const struct dentry *d2) |
@@ -1344,13 +1325,16 @@ static int gfs2_show_options(struct seq_file *s, struct vfsmount *mnt) | |||
1344 | * is safe, just less efficient. | 1325 | * is safe, just less efficient. |
1345 | */ | 1326 | */ |
1346 | 1327 | ||
1347 | static void gfs2_delete_inode(struct inode *inode) | 1328 | static void gfs2_evict_inode(struct inode *inode) |
1348 | { | 1329 | { |
1349 | struct gfs2_sbd *sdp = inode->i_sb->s_fs_info; | 1330 | struct gfs2_sbd *sdp = inode->i_sb->s_fs_info; |
1350 | struct gfs2_inode *ip = GFS2_I(inode); | 1331 | struct gfs2_inode *ip = GFS2_I(inode); |
1351 | struct gfs2_holder gh; | 1332 | struct gfs2_holder gh; |
1352 | int error; | 1333 | int error; |
1353 | 1334 | ||
1335 | if (inode->i_nlink) | ||
1336 | goto out; | ||
1337 | |||
1354 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); | 1338 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); |
1355 | if (unlikely(error)) { | 1339 | if (unlikely(error)) { |
1356 | gfs2_glock_dq_uninit(&ip->i_iopen_gh); | 1340 | gfs2_glock_dq_uninit(&ip->i_iopen_gh); |
@@ -1404,10 +1388,18 @@ out_unlock: | |||
1404 | gfs2_holder_uninit(&ip->i_iopen_gh); | 1388 | gfs2_holder_uninit(&ip->i_iopen_gh); |
1405 | gfs2_glock_dq_uninit(&gh); | 1389 | gfs2_glock_dq_uninit(&gh); |
1406 | if (error && error != GLR_TRYFAILED && error != -EROFS) | 1390 | if (error && error != GLR_TRYFAILED && error != -EROFS) |
1407 | fs_warn(sdp, "gfs2_delete_inode: %d\n", error); | 1391 | fs_warn(sdp, "gfs2_evict_inode: %d\n", error); |
1408 | out: | 1392 | out: |
1409 | truncate_inode_pages(&inode->i_data, 0); | 1393 | truncate_inode_pages(&inode->i_data, 0); |
1410 | clear_inode(inode); | 1394 | end_writeback(inode); |
1395 | |||
1396 | ip->i_gl->gl_object = NULL; | ||
1397 | gfs2_glock_put(ip->i_gl); | ||
1398 | ip->i_gl = NULL; | ||
1399 | if (ip->i_iopen_gh.gh_gl) { | ||
1400 | ip->i_iopen_gh.gh_gl->gl_object = NULL; | ||
1401 | gfs2_glock_dq_uninit(&ip->i_iopen_gh); | ||
1402 | } | ||
1411 | } | 1403 | } |
1412 | 1404 | ||
1413 | static struct inode *gfs2_alloc_inode(struct super_block *sb) | 1405 | static struct inode *gfs2_alloc_inode(struct super_block *sb) |
@@ -1431,14 +1423,13 @@ const struct super_operations gfs2_super_ops = { | |||
1431 | .alloc_inode = gfs2_alloc_inode, | 1423 | .alloc_inode = gfs2_alloc_inode, |
1432 | .destroy_inode = gfs2_destroy_inode, | 1424 | .destroy_inode = gfs2_destroy_inode, |
1433 | .write_inode = gfs2_write_inode, | 1425 | .write_inode = gfs2_write_inode, |
1434 | .delete_inode = gfs2_delete_inode, | 1426 | .evict_inode = gfs2_evict_inode, |
1435 | .put_super = gfs2_put_super, | 1427 | .put_super = gfs2_put_super, |
1436 | .sync_fs = gfs2_sync_fs, | 1428 | .sync_fs = gfs2_sync_fs, |
1437 | .freeze_fs = gfs2_freeze, | 1429 | .freeze_fs = gfs2_freeze, |
1438 | .unfreeze_fs = gfs2_unfreeze, | 1430 | .unfreeze_fs = gfs2_unfreeze, |
1439 | .statfs = gfs2_statfs, | 1431 | .statfs = gfs2_statfs, |
1440 | .remount_fs = gfs2_remount_fs, | 1432 | .remount_fs = gfs2_remount_fs, |
1441 | .clear_inode = gfs2_clear_inode, | ||
1442 | .drop_inode = gfs2_drop_inode, | 1433 | .drop_inode = gfs2_drop_inode, |
1443 | .show_options = gfs2_show_options, | 1434 | .show_options = gfs2_show_options, |
1444 | }; | 1435 | }; |