aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/ops_super.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_super.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_super.c')
-rw-r--r--fs/gfs2/ops_super.c68
1 files changed, 66 insertions, 2 deletions
diff --git a/fs/gfs2/ops_super.c b/fs/gfs2/ops_super.c
index bd08a0a8d9bf..08837a728635 100644
--- a/fs/gfs2/ops_super.c
+++ b/fs/gfs2/ops_super.c
@@ -95,7 +95,7 @@ do_flush:
95 * Returns: errno 95 * Returns: errno
96 */ 96 */
97 97
98int gfs2_make_fs_ro(struct gfs2_sbd *sdp) 98static int gfs2_make_fs_ro(struct gfs2_sbd *sdp)
99{ 99{
100 struct gfs2_holder t_gh; 100 struct gfs2_holder t_gh;
101 int error; 101 int error;
@@ -122,6 +122,70 @@ int gfs2_make_fs_ro(struct gfs2_sbd *sdp)
122} 122}
123 123
124/** 124/**
125 * gfs2_put_super - Unmount the filesystem
126 * @sb: The VFS superblock
127 *
128 */
129
130static void gfs2_put_super(struct super_block *sb)
131{
132 struct gfs2_sbd *sdp = sb->s_fs_info;
133 int error;
134
135 /* Unfreeze the filesystem, if we need to */
136
137 mutex_lock(&sdp->sd_freeze_lock);
138 if (sdp->sd_freeze_count)
139 gfs2_glock_dq_uninit(&sdp->sd_freeze_gh);
140 mutex_unlock(&sdp->sd_freeze_lock);
141
142 kthread_stop(sdp->sd_quotad_process);
143 kthread_stop(sdp->sd_logd_process);
144 kthread_stop(sdp->sd_recoverd_process);
145
146 if (!(sb->s_flags & MS_RDONLY)) {
147 error = gfs2_make_fs_ro(sdp);
148 if (error)
149 gfs2_io_error(sdp);
150 }
151 /* At this point, we're through modifying the disk */
152
153 /* Release stuff */
154
155 iput(sdp->sd_jindex);
156 iput(sdp->sd_inum_inode);
157 iput(sdp->sd_statfs_inode);
158 iput(sdp->sd_rindex);
159 iput(sdp->sd_quota_inode);
160
161 gfs2_glock_put(sdp->sd_rename_gl);
162 gfs2_glock_put(sdp->sd_trans_gl);
163
164 if (!sdp->sd_args.ar_spectator) {
165 gfs2_glock_dq_uninit(&sdp->sd_journal_gh);
166 gfs2_glock_dq_uninit(&sdp->sd_jinode_gh);
167 gfs2_glock_dq_uninit(&sdp->sd_ir_gh);
168 gfs2_glock_dq_uninit(&sdp->sd_sc_gh);
169 gfs2_glock_dq_uninit(&sdp->sd_qc_gh);
170 iput(sdp->sd_ir_inode);
171 iput(sdp->sd_sc_inode);
172 iput(sdp->sd_qc_inode);
173 }
174
175 gfs2_glock_dq_uninit(&sdp->sd_live_gh);
176 gfs2_clear_rgrpd(sdp);
177 gfs2_jindex_free(sdp);
178 /* Take apart glock structures and buffer lists */
179 gfs2_gl_hash_clear(sdp);
180 /* Unmount the locking protocol */
181 gfs2_lm_unmount(sdp);
182
183 /* At this point, we're through participating in the lockspace */
184 gfs2_sys_fs_del(sdp);
185 kfree(sdp);
186}
187
188/**
125 * gfs2_write_super 189 * gfs2_write_super
126 * @sb: the superblock 190 * @sb: the superblock
127 * 191 *
@@ -622,7 +686,7 @@ const struct super_operations gfs2_super_ops = {
622 .destroy_inode = gfs2_destroy_inode, 686 .destroy_inode = gfs2_destroy_inode,
623 .write_inode = gfs2_write_inode, 687 .write_inode = gfs2_write_inode,
624 .delete_inode = gfs2_delete_inode, 688 .delete_inode = gfs2_delete_inode,
625 .put_super = gfs2_gl_hash_clear, 689 .put_super = gfs2_put_super,
626 .write_super = gfs2_write_super, 690 .write_super = gfs2_write_super,
627 .sync_fs = gfs2_sync_fs, 691 .sync_fs = gfs2_sync_fs,
628 .write_super_lockfs = gfs2_write_super_lockfs, 692 .write_super_lockfs = gfs2_write_super_lockfs,