All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] xfs: fallback to readonly during recovery
@ 2020-02-10 21:10 Vincent Fazio
  2020-02-10 21:43 ` Eric Sandeen
  0 siblings, 1 reply; 9+ messages in thread
From: Vincent Fazio @ 2020-02-10 21:10 UTC (permalink / raw)
  To: linux-xfs; +Cc: Vincent Fazio, Aaron Sierra

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


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

end of thread, other threads:[~2020-02-11 20:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-10 21:10 [PATCH 1/1] xfs: fallback to readonly during recovery Vincent Fazio
2020-02-10 21:43 ` 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.