diff options
Diffstat (limited to 'fs/ocfs2/super.c')
-rw-r--r-- | fs/ocfs2/super.c | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index fad37af2af9c..1a4c7c7850f2 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -1224,15 +1224,6 @@ leave: | |||
1224 | return status; | 1224 | return status; |
1225 | } | 1225 | } |
1226 | 1226 | ||
1227 | /* we can't grab the goofy sem lock from inside wait_event, so we use | ||
1228 | * memory barriers to make sure that we'll see the null task before | ||
1229 | * being woken up */ | ||
1230 | static int ocfs2_recovery_thread_running(struct ocfs2_super *osb) | ||
1231 | { | ||
1232 | mb(); | ||
1233 | return osb->recovery_thread_task != NULL; | ||
1234 | } | ||
1235 | |||
1236 | static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err) | 1227 | static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err) |
1237 | { | 1228 | { |
1238 | int tmp; | 1229 | int tmp; |
@@ -1249,17 +1240,8 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err) | |||
1249 | 1240 | ||
1250 | ocfs2_truncate_log_shutdown(osb); | 1241 | ocfs2_truncate_log_shutdown(osb); |
1251 | 1242 | ||
1252 | /* disable any new recovery threads and wait for any currently | 1243 | /* This will disable recovery and flush any recovery work. */ |
1253 | * running ones to exit. Do this before setting the vol_state. */ | 1244 | ocfs2_recovery_exit(osb); |
1254 | mutex_lock(&osb->recovery_lock); | ||
1255 | osb->disable_recovery = 1; | ||
1256 | mutex_unlock(&osb->recovery_lock); | ||
1257 | wait_event(osb->recovery_event, !ocfs2_recovery_thread_running(osb)); | ||
1258 | |||
1259 | /* At this point, we know that no more recovery threads can be | ||
1260 | * launched, so wait for any recovery completion work to | ||
1261 | * complete. */ | ||
1262 | flush_workqueue(ocfs2_wq); | ||
1263 | 1245 | ||
1264 | ocfs2_journal_shutdown(osb); | 1246 | ocfs2_journal_shutdown(osb); |
1265 | 1247 | ||
@@ -1368,7 +1350,6 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
1368 | osb->s_sectsize_bits = blksize_bits(sector_size); | 1350 | osb->s_sectsize_bits = blksize_bits(sector_size); |
1369 | BUG_ON(!osb->s_sectsize_bits); | 1351 | BUG_ON(!osb->s_sectsize_bits); |
1370 | 1352 | ||
1371 | init_waitqueue_head(&osb->recovery_event); | ||
1372 | spin_lock_init(&osb->dc_task_lock); | 1353 | spin_lock_init(&osb->dc_task_lock); |
1373 | init_waitqueue_head(&osb->dc_event); | 1354 | init_waitqueue_head(&osb->dc_event); |
1374 | osb->dc_work_sequence = 0; | 1355 | osb->dc_work_sequence = 0; |
@@ -1388,10 +1369,12 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
1388 | snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u", | 1369 | snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u", |
1389 | MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev)); | 1370 | MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev)); |
1390 | 1371 | ||
1391 | mutex_init(&osb->recovery_lock); | 1372 | status = ocfs2_recovery_init(osb); |
1392 | 1373 | if (status) { | |
1393 | osb->disable_recovery = 0; | 1374 | mlog(ML_ERROR, "Unable to initialize recovery state\n"); |
1394 | osb->recovery_thread_task = NULL; | 1375 | mlog_errno(status); |
1376 | goto bail; | ||
1377 | } | ||
1395 | 1378 | ||
1396 | init_waitqueue_head(&osb->checkpoint_event); | 1379 | init_waitqueue_head(&osb->checkpoint_event); |
1397 | atomic_set(&osb->needs_checkpoint, 0); | 1380 | atomic_set(&osb->needs_checkpoint, 0); |