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.c52
1 files changed, 20 insertions, 32 deletions
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 4d1aad38f1b1..77cb9f830ee4 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -342,8 +342,6 @@ int gfs2_jdesc_check(struct gfs2_jdesc *jd)
342{ 342{
343 struct gfs2_inode *ip = GFS2_I(jd->jd_inode); 343 struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
344 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); 344 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
345 int ar;
346 int error;
347 345
348 if (ip->i_disksize < (8 << 20) || ip->i_disksize > (1 << 30) || 346 if (ip->i_disksize < (8 << 20) || ip->i_disksize > (1 << 30) ||
349 (ip->i_disksize & (sdp->sd_sb.sb_bsize - 1))) { 347 (ip->i_disksize & (sdp->sd_sb.sb_bsize - 1))) {
@@ -352,13 +350,12 @@ int gfs2_jdesc_check(struct gfs2_jdesc *jd)
352 } 350 }
353 jd->jd_blocks = ip->i_disksize >> sdp->sd_sb.sb_bsize_shift; 351 jd->jd_blocks = ip->i_disksize >> sdp->sd_sb.sb_bsize_shift;
354 352
355 error = gfs2_write_alloc_required(ip, 0, ip->i_disksize, &ar); 353 if (gfs2_write_alloc_required(ip, 0, ip->i_disksize)) {
356 if (!error && ar) {
357 gfs2_consist_inode(ip); 354 gfs2_consist_inode(ip);
358 error = -EIO; 355 return -EIO;
359 } 356 }
360 357
361 return error; 358 return 0;
362} 359}
363 360
364/** 361/**
@@ -1191,7 +1188,7 @@ static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data)
1191 * node for later deallocation. 1188 * node for later deallocation.
1192 */ 1189 */
1193 1190
1194static void gfs2_drop_inode(struct inode *inode) 1191static int gfs2_drop_inode(struct inode *inode)
1195{ 1192{
1196 struct gfs2_inode *ip = GFS2_I(inode); 1193 struct gfs2_inode *ip = GFS2_I(inode);
1197 1194
@@ -1200,26 +1197,7 @@ static void gfs2_drop_inode(struct inode *inode)
1200 if (gl && test_bit(GLF_DEMOTE, &gl->gl_flags)) 1197 if (gl && test_bit(GLF_DEMOTE, &gl->gl_flags))
1201 clear_nlink(inode); 1198 clear_nlink(inode);
1202 } 1199 }
1203 generic_drop_inode(inode); 1200 return generic_drop_inode(inode);
1204}
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} 1201}
1224 1202
1225static int is_ancestor(const struct dentry *d1, const struct dentry *d2) 1203static int is_ancestor(const struct dentry *d1, const struct dentry *d2)
@@ -1347,13 +1325,16 @@ static int gfs2_show_options(struct seq_file *s, struct vfsmount *mnt)
1347 * is safe, just less efficient. 1325 * is safe, just less efficient.
1348 */ 1326 */
1349 1327
1350static void gfs2_delete_inode(struct inode *inode) 1328static void gfs2_evict_inode(struct inode *inode)
1351{ 1329{
1352 struct gfs2_sbd *sdp = inode->i_sb->s_fs_info; 1330 struct gfs2_sbd *sdp = inode->i_sb->s_fs_info;
1353 struct gfs2_inode *ip = GFS2_I(inode); 1331 struct gfs2_inode *ip = GFS2_I(inode);
1354 struct gfs2_holder gh; 1332 struct gfs2_holder gh;
1355 int error; 1333 int error;
1356 1334
1335 if (inode->i_nlink)
1336 goto out;
1337
1357 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);
1358 if (unlikely(error)) { 1339 if (unlikely(error)) {
1359 gfs2_glock_dq_uninit(&ip->i_iopen_gh); 1340 gfs2_glock_dq_uninit(&ip->i_iopen_gh);
@@ -1407,10 +1388,18 @@ out_unlock:
1407 gfs2_holder_uninit(&ip->i_iopen_gh); 1388 gfs2_holder_uninit(&ip->i_iopen_gh);
1408 gfs2_glock_dq_uninit(&gh); 1389 gfs2_glock_dq_uninit(&gh);
1409 if (error && error != GLR_TRYFAILED && error != -EROFS) 1390 if (error && error != GLR_TRYFAILED && error != -EROFS)
1410 fs_warn(sdp, "gfs2_delete_inode: %d\n", error); 1391 fs_warn(sdp, "gfs2_evict_inode: %d\n", error);
1411out: 1392out:
1412 truncate_inode_pages(&inode->i_data, 0); 1393 truncate_inode_pages(&inode->i_data, 0);
1413 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 }
1414} 1403}
1415 1404
1416static struct inode *gfs2_alloc_inode(struct super_block *sb) 1405static struct inode *gfs2_alloc_inode(struct super_block *sb)
@@ -1434,14 +1423,13 @@ const struct super_operations gfs2_super_ops = {
1434 .alloc_inode = gfs2_alloc_inode, 1423 .alloc_inode = gfs2_alloc_inode,
1435 .destroy_inode = gfs2_destroy_inode, 1424 .destroy_inode = gfs2_destroy_inode,
1436 .write_inode = gfs2_write_inode, 1425 .write_inode = gfs2_write_inode,
1437 .delete_inode = gfs2_delete_inode, 1426 .evict_inode = gfs2_evict_inode,
1438 .put_super = gfs2_put_super, 1427 .put_super = gfs2_put_super,
1439 .sync_fs = gfs2_sync_fs, 1428 .sync_fs = gfs2_sync_fs,
1440 .freeze_fs = gfs2_freeze, 1429 .freeze_fs = gfs2_freeze,
1441 .unfreeze_fs = gfs2_unfreeze, 1430 .unfreeze_fs = gfs2_unfreeze,
1442 .statfs = gfs2_statfs, 1431 .statfs = gfs2_statfs,
1443 .remount_fs = gfs2_remount_fs, 1432 .remount_fs = gfs2_remount_fs,
1444 .clear_inode = gfs2_clear_inode,
1445 .drop_inode = gfs2_drop_inode, 1433 .drop_inode = gfs2_drop_inode,
1446 .show_options = gfs2_show_options, 1434 .show_options = gfs2_show_options,
1447}; 1435};