linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vincent Fazio <vfazio@xes-inc.com>
To: linux-xfs@vger.kernel.org
Cc: Vincent Fazio <vfazio@xes-inc.com>, Aaron Sierra <asierra@xes-inc.com>
Subject: [PATCH 1/1] xfs: fallback to readonly during recovery
Date: Mon, 10 Feb 2020 15:10:37 -0600	[thread overview]
Message-ID: <20200210211037.1930-1-vfazio@xes-inc.com> (raw)

Previously, XFS would fail to mount if there was an error during log
recovery. This can occur as a result of inevitable I/O errors when
trying to apply the log on read-only ATA devices since the ATA layer
does not support reporting a device as read-only.

Now, if there's an error during log recovery, fall back to norecovery
mode and mark the filesystem as read-only in the XFS and VFS layers.

This roughly approximates the 'errors=remount-ro' mount option in ext4
but is implicit and the scope only covers errors during log recovery.
Since XFS is the default filesystem for some distributions, this change
allows users to continue to use XFS on these read-only ATA devices.

Reviewed-by: Aaron Sierra <asierra@xes-inc.com>
Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
---
 fs/xfs/xfs_log.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index f6006d94a581..f5b3528ee028 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -739,7 +739,6 @@ xfs_log_mount(
 			xfs_warn(mp, "log mount/recovery failed: error %d",
 				error);
 			xlog_recover_cancel(mp->m_log);
-			goto out_destroy_ail;
 		}
 	}
 
@@ -3873,10 +3872,17 @@ xfs_log_force_umount(
 	/*
 	 * If this happens during log recovery, don't worry about
 	 * locking; the log isn't open for business yet.
+	 *
+	 * Attempt a read-only, norecovery mount. Ensure the VFS layer is updated.
 	 */
 	if (!log ||
 	    log->l_flags & XLOG_ACTIVE_RECOVERY) {
-		mp->m_flags |= XFS_MOUNT_FS_SHUTDOWN;
+
+		xfs_notice(mp,
+"Falling back to no-recovery mode. Filesystem will be inconsistent.");
+		mp->m_flags |= (XFS_MOUNT_RDONLY | XFS_MOUNT_NORECOVERY);
+		mp->m_super->s_flags |= SB_RDONLY;
+
 		if (mp->m_sb_bp)
 			mp->m_sb_bp->b_flags |= XBF_DONE;
 		return 0;
-- 
2.25.0


             reply	other threads:[~2020-02-10 21:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-10 21:10 Vincent Fazio [this message]
2020-02-10 21:43 ` [PATCH 1/1] xfs: fallback to readonly during recovery Eric Sandeen
2020-02-10 22:31   ` Aaron Sierra
2020-02-10 23:40     ` Eric Sandeen
2020-02-11 12:55       ` Brian Foster
2020-02-11 14:04         ` Vincent Fazio
2020-02-11 14:29           ` Eric Sandeen
2020-02-11 15:10             ` Darrick J. Wong
2020-02-11 20:04           ` Dave Chinner

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=20200210211037.1930-1-vfazio@xes-inc.com \
    --to=vfazio@xes-inc.com \
    --cc=asierra@xes-inc.com \
    --cc=linux-xfs@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).