public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Tinguely <tinguely@sgi.com>
To: xfs@oss.sgi.com
Subject: [PATCH v3] xfs: free the efi AIL entry on log recovery failure
Date: Sat, 07 Dec 2013 18:52:12 -0600	[thread overview]
Message-ID: <20131208005224.696001432@sgi.com> (raw)
In-Reply-To: 20131206212037.560711585@sgi.com

[-- Attachment #1: v3-xfs-remove-efi-entry-before-log-unmount.patch --]
[-- Type: text/plain, Size: 2892 bytes --]

If an extent free fails during recovery, the filesystem will be
forced down. The efi entry is still on the AIL and the log
shutdown function xfs_ail_push_all_sync() will hang.

This patch is similar to the patches that removed the dquot and
inode in commits 32ce90a and dea9609 but removes all the EFI
entries from the AIL.

Signed-off-by: Mark Tinguely <tinguely@sgi.com>
---
v3 (Augh - where is my head?) only remove efi items on error.
v2 remove all the EFIs from the AIL rather than the current entry
   per Dave's suggestion.
   move the cleaning routine to caller.

 fs/xfs/xfs_log_recover.c |   36 ++++++++++++++++++++++++------------
 1 file changed, 24 insertions(+), 12 deletions(-)

Index: b/fs/xfs/xfs_log_recover.c
===================================================================
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -3635,11 +3635,11 @@ xlog_recover_process_data(
  */
 STATIC int
 xlog_recover_process_efi(
-	xfs_mount_t		*mp,
-	xfs_efi_log_item_t	*efip)
+	struct xfs_mount	*mp,
+	struct xfs_efi_log_item	*efip)
 {
-	xfs_efd_log_item_t	*efdp;
-	xfs_trans_t		*tp;
+	struct xfs_efd_log_item	*efdp;
+	struct xfs_trans	*tp;
 	int			i;
 	int			error = 0;
 	xfs_extent_t		*extp;
@@ -3660,12 +3660,7 @@ xlog_recover_process_efi(
 		    (extp->ext_len == 0) ||
 		    (startblock_fsb >= mp->m_sb.sb_dblocks) ||
 		    (extp->ext_len >= mp->m_sb.sb_agblocks)) {
-			/*
-			 * This will pull the EFI from the AIL and
-			 * free the memory associated with it.
-			 */
-			set_bit(XFS_EFI_RECOVERED, &efip->efi_flags);
-			xfs_efi_release(efip, efip->efi_format.efi_nextents);
+			/* The caller will free all efi entries on error. */
 			return XFS_ERROR(EIO);
 		}
 	}
@@ -3691,6 +3686,7 @@ xlog_recover_process_efi(
 
 abort_error:
 	xfs_trans_cancel(tp, XFS_TRANS_ABORT);
+	/* The caller will free all efi entries on error. */
 	return error;
 }
 
@@ -3716,8 +3712,8 @@ STATIC int
 xlog_recover_process_efis(
 	struct xlog	*log)
 {
-	xfs_log_item_t		*lip;
-	xfs_efi_log_item_t	*efip;
+	struct xfs_log_item	*lip;
+	struct xfs_efi_log_item	*efip;
 	int			error = 0;
 	struct xfs_ail_cursor	cur;
 	struct xfs_ail		*ailp;
@@ -3756,7 +3752,23 @@ xlog_recover_process_efis(
 	}
 out:
 	xfs_trans_ail_cursor_done(ailp, &cur);
+	lip = xfs_ail_min(ailp);
 	spin_unlock(&ailp->xa_lock);
+	if (!error)
+		return 0;
+
+	/* Free all the EFI from the AIL upon error */
+	while (lip) {
+		if (lip->li_type == XFS_LI_EFI) {
+			efip = (xfs_efi_log_item_t *)lip;
+			if (!test_bit(XFS_EFI_RECOVERED, &efip->efi_flags))
+				set_bit(XFS_EFI_RECOVERED, &efip->efi_flags);
+			xfs_efi_release(efip, efip->efi_format.efi_nextents);
+		}
+		spin_lock(&ailp->xa_lock);
+		lip = xfs_ail_min(ailp);
+		spin_unlock(&ailp->xa_lock);
+	}
 	return error;
 }
 


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

  reply	other threads:[~2013-12-08  1:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-06 21:20 [PATCH 0/2] misc log recovery patches Mark Tinguely
2013-12-06 21:20 ` [PATCH 1/2] xfs: fix double free on error when cleaning log items Mark Tinguely
2013-12-09  0:29   ` Dave Chinner
2013-12-06 21:20 ` [PATCH 2/2] xfs: free the efi AIL entry on log recovery failure Mark Tinguely
2013-12-08  0:52   ` Mark Tinguely [this message]
2013-12-09  1:00     ` [PATCH v3] " Dave Chinner
2013-12-11 11:31     ` Christoph Hellwig
2013-12-11 17:25       ` Mark Tinguely
2013-12-23 16:42       ` Mark Tinguely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131208005224.696001432@sgi.com \
    --to=tinguely@sgi.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox