diff options
author | Ben Myers <bpm@sgi.com> | 2012-05-25 16:45:36 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2012-06-21 15:20:48 -0400 |
commit | 8866fc6fa55e31b2bce931b7963ff16641b39dc7 (patch) | |
tree | f86eb7377bc637f1cc4f007826ecda945525af48 /fs | |
parent | 59c84ed0ddc11f1823b4a33ace4fbcc948261bb2 (diff) |
xfs: shutdown xfs_sync_worker before the log
Revert commit 1307bbd, which uses the s_umount semaphore to provide
exclusion between xfs_sync_worker and unmount, in favor of shutting down
the sync worker before freeing the log in xfs_log_unmount. This is a
cleaner way of resolving the race between xfs_sync_worker and unmount
than using s_umount.
Signed-off-by: Ben Myers <bpm@sgi.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/xfs_log.c | 1 | ||||
-rw-r--r-- | fs/xfs/xfs_sync.c | 32 |
2 files changed, 17 insertions, 16 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index f30d9807dc48..0e1a64f0439c 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -810,6 +810,7 @@ xfs_log_unmount_write(xfs_mount_t *mp) | |||
810 | void | 810 | void |
811 | xfs_log_unmount(xfs_mount_t *mp) | 811 | xfs_log_unmount(xfs_mount_t *mp) |
812 | { | 812 | { |
813 | cancel_delayed_work_sync(&mp->m_sync_work); | ||
813 | xfs_trans_ail_destroy(mp); | 814 | xfs_trans_ail_destroy(mp); |
814 | xlog_dealloc_log(mp->m_log); | 815 | xlog_dealloc_log(mp->m_log); |
815 | } | 816 | } |
diff --git a/fs/xfs/xfs_sync.c b/fs/xfs/xfs_sync.c index c9d3409c5ca3..1e9ee064dbb2 100644 --- a/fs/xfs/xfs_sync.c +++ b/fs/xfs/xfs_sync.c | |||
@@ -386,23 +386,23 @@ xfs_sync_worker( | |||
386 | * We shouldn't write/force the log if we are in the mount/unmount | 386 | * We shouldn't write/force the log if we are in the mount/unmount |
387 | * process or on a read only filesystem. The workqueue still needs to be | 387 | * process or on a read only filesystem. The workqueue still needs to be |
388 | * active in both cases, however, because it is used for inode reclaim | 388 | * active in both cases, however, because it is used for inode reclaim |
389 | * during these times. Use the s_umount semaphore to provide exclusion | 389 | * during these times. Use the MS_ACTIVE flag to avoid doing anything |
390 | * with unmount. | 390 | * during mount. Doing work during unmount is avoided by calling |
391 | * cancel_delayed_work_sync on this work queue before tearing down | ||
392 | * the ail and the log in xfs_log_unmount. | ||
391 | */ | 393 | */ |
392 | if (down_read_trylock(&mp->m_super->s_umount)) { | 394 | if (!(mp->m_super->s_flags & MS_ACTIVE) && |
393 | if (!(mp->m_flags & XFS_MOUNT_RDONLY)) { | 395 | !(mp->m_flags & XFS_MOUNT_RDONLY)) { |
394 | /* dgc: errors ignored here */ | 396 | /* dgc: errors ignored here */ |
395 | if (mp->m_super->s_frozen == SB_UNFROZEN && | 397 | if (mp->m_super->s_frozen == SB_UNFROZEN && |
396 | xfs_log_need_covered(mp)) | 398 | xfs_log_need_covered(mp)) |
397 | error = xfs_fs_log_dummy(mp); | 399 | error = xfs_fs_log_dummy(mp); |
398 | else | 400 | else |
399 | xfs_log_force(mp, 0); | 401 | xfs_log_force(mp, 0); |
400 | 402 | ||
401 | /* start pushing all the metadata that is currently | 403 | /* start pushing all the metadata that is currently |
402 | * dirty */ | 404 | * dirty */ |
403 | xfs_ail_push_all(mp->m_ail); | 405 | xfs_ail_push_all(mp->m_ail); |
404 | } | ||
405 | up_read(&mp->m_super->s_umount); | ||
406 | } | 406 | } |
407 | 407 | ||
408 | /* queue us up again */ | 408 | /* queue us up again */ |