aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/ops_fstype.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2008-12-19 10:32:06 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2009-01-05 02:39:18 -0500
commitfefc03bfedeff2002f14e848ecb7c0cd77ee0b15 (patch)
tree830ec1d36b8688a70580e8c5c18ac5f40015448f /fs/gfs2/ops_fstype.c
parent7ed122e42c72b3e4531f8b4a9f72159e8303ac15 (diff)
Revert "GFS2: Fix use-after-free bug on umount"
This reverts commit 78802499912f1ba31ce83a94c55b5a980f250a43. The original patch is causing problems in relation to order of operations at umount in relation to jdata files. I need to fix this a different way. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_fstype.c')
-rw-r--r--fs/gfs2/ops_fstype.c98
1 files changed, 10 insertions, 88 deletions
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 2e735bece6b..4cae60f4a17 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -705,40 +705,6 @@ static int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)
705 return error; 705 return error;
706} 706}
707 707
708/**
709 * gfs2_jindex_free - Clear all the journal index information
710 * @sdp: The GFS2 superblock
711 *
712 */
713
714static void gfs2_jindex_free(struct gfs2_sbd *sdp)
715{
716 struct list_head list, *head;
717 struct gfs2_jdesc *jd;
718 struct gfs2_journal_extent *jext;
719
720 spin_lock(&sdp->sd_jindex_spin);
721 list_add(&list, &sdp->sd_jindex_list);
722 list_del_init(&sdp->sd_jindex_list);
723 sdp->sd_journals = 0;
724 spin_unlock(&sdp->sd_jindex_spin);
725
726 while (!list_empty(&list)) {
727 jd = list_entry(list.next, struct gfs2_jdesc, jd_list);
728 head = &jd->extent_list;
729 while (!list_empty(head)) {
730 jext = list_entry(head->next,
731 struct gfs2_journal_extent,
732 extent_list);
733 list_del(&jext->extent_list);
734 kfree(jext);
735 }
736 list_del(&jd->jd_list);
737 iput(jd->jd_inode);
738 kfree(jd);
739 }
740}
741
742static int init_journal(struct gfs2_sbd *sdp, int undo) 708static int init_journal(struct gfs2_sbd *sdp, int undo)
743{ 709{
744 struct inode *master = sdp->sd_master_dir->d_inode; 710 struct inode *master = sdp->sd_master_dir->d_inode;
@@ -1237,7 +1203,7 @@ fail_sb:
1237fail_locking: 1203fail_locking:
1238 init_locking(sdp, &mount_gh, UNDO); 1204 init_locking(sdp, &mount_gh, UNDO);
1239fail_lm: 1205fail_lm:
1240 gfs2_gl_hash_clear(sb); 1206 gfs2_gl_hash_clear(sdp);
1241 gfs2_lm_unmount(sdp); 1207 gfs2_lm_unmount(sdp);
1242 while (invalidate_inodes(sb)) 1208 while (invalidate_inodes(sb))
1243 yield(); 1209 yield();
@@ -1297,61 +1263,17 @@ static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags,
1297static void gfs2_kill_sb(struct super_block *sb) 1263static void gfs2_kill_sb(struct super_block *sb)
1298{ 1264{
1299 struct gfs2_sbd *sdp = sb->s_fs_info; 1265 struct gfs2_sbd *sdp = sb->s_fs_info;
1300 1266 if (sdp) {
1301 if (sdp == NULL) { 1267 gfs2_meta_syncfs(sdp);
1302 kill_block_super(sb); 1268 dput(sdp->sd_root_dir);
1303 return; 1269 dput(sdp->sd_master_dir);
1304 } 1270 sdp->sd_root_dir = NULL;
1305 gfs2_meta_syncfs(sdp); 1271 sdp->sd_master_dir = NULL;
1306 dput(sdp->sd_root_dir);
1307 dput(sdp->sd_master_dir);
1308 sdp->sd_root_dir = NULL;
1309 sdp->sd_master_dir = NULL;
1310
1311 /* Unfreeze the filesystem, if we need to */
1312 mutex_lock(&sdp->sd_freeze_lock);
1313 if (sdp->sd_freeze_count)
1314 gfs2_glock_dq_uninit(&sdp->sd_freeze_gh);
1315 mutex_unlock(&sdp->sd_freeze_lock);
1316
1317 kthread_stop(sdp->sd_quotad_process);
1318 kthread_stop(sdp->sd_logd_process);
1319 kthread_stop(sdp->sd_recoverd_process);
1320
1321 if (!(sb->s_flags & MS_RDONLY)) {
1322 int error = gfs2_make_fs_ro(sdp);
1323 if (error)
1324 gfs2_io_error(sdp);
1325 }
1326
1327 /* At this point, we're through modifying the disk */
1328 gfs2_jindex_free(sdp);
1329 gfs2_clear_rgrpd(sdp);
1330 iput(sdp->sd_jindex);
1331 iput(sdp->sd_inum_inode);
1332 iput(sdp->sd_statfs_inode);
1333 iput(sdp->sd_rindex);
1334 iput(sdp->sd_quota_inode);
1335
1336 gfs2_glock_put(sdp->sd_rename_gl);
1337 gfs2_glock_put(sdp->sd_trans_gl);
1338
1339 if (!sdp->sd_args.ar_spectator) {
1340 gfs2_glock_dq_uninit(&sdp->sd_journal_gh);
1341 gfs2_glock_dq_uninit(&sdp->sd_jinode_gh);
1342 gfs2_glock_dq_uninit(&sdp->sd_ir_gh);
1343 gfs2_glock_dq_uninit(&sdp->sd_sc_gh);
1344 gfs2_glock_dq_uninit(&sdp->sd_qc_gh);
1345 iput(sdp->sd_ir_inode);
1346 iput(sdp->sd_sc_inode);
1347 iput(sdp->sd_qc_inode);
1348 } 1272 }
1349 gfs2_glock_dq_uninit(&sdp->sd_live_gh); 1273 shrink_dcache_sb(sb);
1350 kill_block_super(sb); 1274 kill_block_super(sb);
1351 gfs2_lm_unmount(sdp); 1275 if (sdp)
1352 gfs2_sys_fs_del(sdp); 1276 gfs2_delete_debugfs_file(sdp);
1353 gfs2_delete_debugfs_file(sdp);
1354 kfree(sdp);
1355} 1277}
1356 1278
1357struct file_system_type gfs2_fs_type = { 1279struct file_system_type gfs2_fs_type = {