public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Check if AIL has been started before stopping it
@ 2009-02-10  1:27 Lachlan McIlroy
  2009-02-10 10:12 ` Christoph Hellwig
  2009-02-10 10:12 ` Dave Chinner
  0 siblings, 2 replies; 3+ messages in thread
From: Lachlan McIlroy @ 2009-02-10  1:27 UTC (permalink / raw)
  To: xfs

A failure during mount can result in shutting down the AIL when
it may not have been started up yet.

Index: xfs-patch/fs/xfs/linux-2.6/xfs_super.c
===================================================================
--- xfs-patch.orig/fs/xfs/linux-2.6/xfs_super.c
+++ xfs-patch/fs/xfs/linux-2.6/xfs_super.c
@@ -913,7 +913,8 @@ void
  xfsaild_stop(
  	struct xfs_ail	*ailp)
  {
-	kthread_stop(ailp->xa_task);
+	if (ailp->xa_task)
+		kthread_stop(ailp->xa_task);
  }


Index: xfs-patch/fs/xfs/xfs_trans_ail.c
===================================================================
--- xfs-patch.orig/fs/xfs/xfs_trans_ail.c
+++ xfs-patch/fs/xfs/xfs_trans_ail.c
@@ -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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Check if AIL has been started before stopping it
  2009-02-10  1:27 [PATCH] Check if AIL has been started before stopping it Lachlan McIlroy
@ 2009-02-10 10:12 ` Christoph Hellwig
  2009-02-10 10:12 ` Dave Chinner
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2009-02-10 10:12 UTC (permalink / raw)
  To: Lachlan McIlroy; +Cc: xfs

On Tue, Feb 10, 2009 at 12:27:06PM +1100, Lachlan McIlroy wrote:
> 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:


Index: xfs/fs/xfs/xfs_log.c
===================================================================
--- xfs.orig/fs/xfs/xfs_log.c	2009-02-10 11:10:41.804069754 +0100
+++ xfs/fs/xfs/xfs_log.c	2009-02-10 11:10:58.339943990 +0100
@@ -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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Check if AIL has been started before stopping it
  2009-02-10  1:27 [PATCH] Check if AIL has been started before stopping it Lachlan McIlroy
  2009-02-10 10:12 ` Christoph Hellwig
@ 2009-02-10 10:12 ` Dave Chinner
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Chinner @ 2009-02-10 10:12 UTC (permalink / raw)
  To: Lachlan McIlroy; +Cc: xfs

On Tue, Feb 10, 2009 at 12:27:06PM +1100, Lachlan McIlroy wrote:
> 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.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-02-10 10:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-10  1:27 [PATCH] Check if AIL has been started before stopping it Lachlan McIlroy
2009-02-10 10:12 ` Christoph Hellwig
2009-02-10 10:12 ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox