diff options
author | Dave Chinner <david@fromorbit.com> | 2012-04-13 08:10:44 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2012-04-17 12:19:47 -0400 |
commit | 8a00ebe4cfc90eda9ecb575ba97e22021cd8cf70 (patch) | |
tree | 06e97168b62fb7acdf44f6610c1e6ea268822f3d /fs/xfs/xfs_sync.c | |
parent | da5bf95e3cdca348327c82568c2860229c0daaa2 (diff) |
xfs: Ensure inode reclaim can run during quotacheck
Because the mount process can run a quotacheck and consume lots of
inodes, we need to be able to run periodic inode reclaim during the
mount process. This will prevent running the system out of memory
during quota checks.
This essentially reverts 2bcf6e97, but that is safe to do now that
the quota sync code that was causing problems during long quotacheck
executions is now gone.
The reclaim work is currently protected from running during the
unmount process by a check against MS_ACTIVE. Unfortunately, this
also means that the reclaim work cannot run during mount. The
unmount process should stop the reclaim cleanly before freeing
anything that the reclaim work depends on, so there is no need to
have this guard in place.
Also, the inode reclaim work is demand driven, so there is no need
to start it immediately during mount. It will be started the moment
an inode is queued for reclaim, so qutoacheck will trigger it just
fine.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_sync.c')
-rw-r--r-- | fs/xfs/xfs_sync.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/fs/xfs/xfs_sync.c b/fs/xfs/xfs_sync.c index 205ebcb34d9e..c318d8a4a631 100644 --- a/fs/xfs/xfs_sync.c +++ b/fs/xfs/xfs_sync.c | |||
@@ -460,7 +460,15 @@ xfs_sync_worker( | |||
460 | struct xfs_mount, m_sync_work); | 460 | struct xfs_mount, m_sync_work); |
461 | int error; | 461 | int error; |
462 | 462 | ||
463 | if (!(mp->m_flags & XFS_MOUNT_RDONLY)) { | 463 | /* |
464 | * We shouldn't write/force the log if we are in the mount/unmount | ||
465 | * process or on a read only filesystem. The workqueue still needs to be | ||
466 | * active in both cases, however, because it is used for inode reclaim | ||
467 | * during these times. hence use the MS_ACTIVE flag to avoid doing | ||
468 | * anything in these periods. | ||
469 | */ | ||
470 | if (!(mp->m_super->s_flags & MS_ACTIVE) && | ||
471 | !(mp->m_flags & XFS_MOUNT_RDONLY)) { | ||
464 | /* dgc: errors ignored here */ | 472 | /* dgc: errors ignored here */ |
465 | if (mp->m_super->s_frozen == SB_UNFROZEN && | 473 | if (mp->m_super->s_frozen == SB_UNFROZEN && |
466 | xfs_log_need_covered(mp)) | 474 | xfs_log_need_covered(mp)) |
@@ -488,14 +496,6 @@ xfs_syncd_queue_reclaim( | |||
488 | struct xfs_mount *mp) | 496 | struct xfs_mount *mp) |
489 | { | 497 | { |
490 | 498 | ||
491 | /* | ||
492 | * We can have inodes enter reclaim after we've shut down the syncd | ||
493 | * workqueue during unmount, so don't allow reclaim work to be queued | ||
494 | * during unmount. | ||
495 | */ | ||
496 | if (!(mp->m_super->s_flags & MS_ACTIVE)) | ||
497 | return; | ||
498 | |||
499 | rcu_read_lock(); | 499 | rcu_read_lock(); |
500 | if (radix_tree_tagged(&mp->m_perag_tree, XFS_ICI_RECLAIM_TAG)) { | 500 | if (radix_tree_tagged(&mp->m_perag_tree, XFS_ICI_RECLAIM_TAG)) { |
501 | queue_delayed_work(xfs_syncd_wq, &mp->m_reclaim_work, | 501 | queue_delayed_work(xfs_syncd_wq, &mp->m_reclaim_work, |
@@ -564,7 +564,6 @@ xfs_syncd_init( | |||
564 | INIT_DELAYED_WORK(&mp->m_reclaim_work, xfs_reclaim_worker); | 564 | INIT_DELAYED_WORK(&mp->m_reclaim_work, xfs_reclaim_worker); |
565 | 565 | ||
566 | xfs_syncd_queue_sync(mp); | 566 | xfs_syncd_queue_sync(mp); |
567 | xfs_syncd_queue_reclaim(mp); | ||
568 | 567 | ||
569 | return 0; | 568 | return 0; |
570 | } | 569 | } |