Check if AIL has been started before stopping it
PATCH 1/1 Check if AIL has been started before stopping it
A failure during mount can result in shutting down the AIL when it may not have been started up yet.
fs/xfs/linux-2.6/xfs_super.c +2 -1
@@ -913,7 +913,8 @@ voidxfsaild_stop ( struct xfs_ail *ailp) { -kthread_stop (ailp->xa_task); +if (ailp->xa_task) +kthread_stop (ailp->xa_task); }
fs/xfs/xfs_trans_ail.c +4 -2
@@ -598,8 +598,10 @@ xfs_trans_ail_destroy( {struct xfs_ail *ailp = mp->m_ail; -xfsaild_stop (ailp); -kmem_free (ailp); +if (ailp) { +xfsaild_stop (ailp); +kmem_free (ailp); + } }/*
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 2 lines · Lachlan McIlroy
A failure during mount can result in shutting down the AIL when it may not have been started up yet.
The right fix is to not call xfsaild_stop in that case.
Something like this should fix your problem:
fs/xfs/xfs_log.c +8 -6
@@ -575,7 +575,7 @@ xfs_log_mount( error =xfs_trans_ail_init (mp);if (error) {cmn_err (CE_WARN ,"XFS: AIL initialisation failed: error %d" , error); - goto error; + goto out_free_log; } mp->m_log->l_ailp = mp->m_ail;
@@ -595,20 +595,22 @@ xfs_log_mount( mp->m_flags |=XFS_MOUNT_RDONLY ;if (error) {cmn_err (CE_WARN ,"XFS: log mount/recovery failed: error %d" , error); - goto error; + goto out_destroy_ail; } }/* Normal transactions can now occur */ mp->m_log->l_flags &= ~XLOG_ACTIVE_RECOVERY ; -/* End mounting message in xfs_log_mount_finish */ return 0 ; -error: -xfs_log_unmount_dealloc (mp); + +out_destroy_ail: +xfs_trans_ail_destroy (mp); +out_free_log: +xlog_dealloc_log (mp->m_log); out:return error; -}/* xfs_log_mount */ +}/* * Finish the recovery of the file system. This is separate from
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 2 lines · Lachlan McIlroy
A failure during mount can result in shutting down the AIL when it may not have been started up yet.
The ail init/destroy are supposed to be called symmetrically. if the destroy is being called when the init has not been run or completed, then the bug is at the caller.
Reading between the lines of your brief description of the problem, xfs_trans_ail_init() has failed with ENOMEM, and that has called xfs_trans_ail_destroy() erroneously. The correct fix is to call xlog_dealloc_log() when xfs_trans_ail_init() fails, not xfs_log_unmount_dealloc() which calls xfs_trans_ail_destroy() before calling xlog_dealloc_log().
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs