aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/super.c')
-rw-r--r--fs/gfs2/super.c39
1 files changed, 15 insertions, 24 deletions
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 4d1aad38f1b1..555f5a417c67 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -1203,25 +1203,6 @@ static void gfs2_drop_inode(struct inode *inode)
1203 generic_drop_inode(inode); 1203 generic_drop_inode(inode);
1204} 1204}
1205 1205
1206/**
1207 * gfs2_clear_inode - Deallocate an inode when VFS is done with it
1208 * @inode: The VFS inode
1209 *
1210 */
1211
1212static void gfs2_clear_inode(struct inode *inode)
1213{
1214 struct gfs2_inode *ip = GFS2_I(inode);
1215
1216 ip->i_gl->gl_object = NULL;
1217 gfs2_glock_put(ip->i_gl);
1218 ip->i_gl = NULL;
1219 if (ip->i_iopen_gh.gh_gl) {
1220 ip->i_iopen_gh.gh_gl->gl_object = NULL;
1221 gfs2_glock_dq_uninit(&ip->i_iopen_gh);
1222 }
1223}
1224
1225static int is_ancestor(const struct dentry *d1, const struct dentry *d2) 1206static int is_ancestor(const struct dentry *d1, const struct dentry *d2)
1226{ 1207{
1227 do { 1208 do {
@@ -1347,13 +1328,16 @@ static int gfs2_show_options(struct seq_file *s, struct vfsmount *mnt)
1347 * is safe, just less efficient. 1328 * is safe, just less efficient.
1348 */ 1329 */
1349 1330
1350static void gfs2_delete_inode(struct inode *inode) 1331static void gfs2_evict_inode(struct inode *inode)
1351{ 1332{
1352 struct gfs2_sbd *sdp = inode->i_sb->s_fs_info; 1333 struct gfs2_sbd *sdp = inode->i_sb->s_fs_info;
1353 struct gfs2_inode *ip = GFS2_I(inode); 1334 struct gfs2_inode *ip = GFS2_I(inode);
1354 struct gfs2_holder gh; 1335 struct gfs2_holder gh;
1355 int error; 1336 int error;
1356 1337
1338 if (inode->i_nlink)
1339 goto out;
1340
1357 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); 1341 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
1358 if (unlikely(error)) { 1342 if (unlikely(error)) {
1359 gfs2_glock_dq_uninit(&ip->i_iopen_gh); 1343 gfs2_glock_dq_uninit(&ip->i_iopen_gh);
@@ -1407,10 +1391,18 @@ out_unlock:
1407 gfs2_holder_uninit(&ip->i_iopen_gh); 1391 gfs2_holder_uninit(&ip->i_iopen_gh);
1408 gfs2_glock_dq_uninit(&gh); 1392 gfs2_glock_dq_uninit(&gh);
1409 if (error && error != GLR_TRYFAILED && error != -EROFS) 1393 if (error && error != GLR_TRYFAILED && error != -EROFS)
1410 fs_warn(sdp, "gfs2_delete_inode: %d\n", error); 1394 fs_warn(sdp, "gfs2_evict_inode: %d\n", error);
1411out: 1395out:
1412 truncate_inode_pages(&inode->i_data, 0); 1396 truncate_inode_pages(&inode->i_data, 0);
1413 clear_inode(inode); 1397 end_writeback(inode);
1398
1399 ip->i_gl->gl_object = NULL;
1400 gfs2_glock_put(ip->i_gl);
1401 ip->i_gl = NULL;
1402 if (ip->i_iopen_gh.gh_gl) {
1403 ip->i_iopen_gh.gh_gl->gl_object = NULL;
1404 gfs2_glock_dq_uninit(&ip->i_iopen_gh);
1405 }
1414} 1406}
1415 1407
1416static struct inode *gfs2_alloc_inode(struct super_block *sb) 1408static struct inode *gfs2_alloc_inode(struct super_block *sb)
@@ -1434,14 +1426,13 @@ const struct super_operations gfs2_super_ops = {
1434 .alloc_inode = gfs2_alloc_inode, 1426 .alloc_inode = gfs2_alloc_inode,
1435 .destroy_inode = gfs2_destroy_inode, 1427 .destroy_inode = gfs2_destroy_inode,
1436 .write_inode = gfs2_write_inode, 1428 .write_inode = gfs2_write_inode,
1437 .delete_inode = gfs2_delete_inode, 1429 .evict_inode = gfs2_evict_inode,
1438 .put_super = gfs2_put_super, 1430 .put_super = gfs2_put_super,
1439 .sync_fs = gfs2_sync_fs, 1431 .sync_fs = gfs2_sync_fs,
1440 .freeze_fs = gfs2_freeze, 1432 .freeze_fs = gfs2_freeze,
1441 .unfreeze_fs = gfs2_unfreeze, 1433 .unfreeze_fs = gfs2_unfreeze,
1442 .statfs = gfs2_statfs, 1434 .statfs = gfs2_statfs,
1443 .remount_fs = gfs2_remount_fs, 1435 .remount_fs = gfs2_remount_fs,
1444 .clear_inode = gfs2_clear_inode,
1445 .drop_inode = gfs2_drop_inode, 1436 .drop_inode = gfs2_drop_inode,
1446 .show_options = gfs2_show_options, 1437 .show_options = gfs2_show_options,
1447}; 1438};