linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aaron Sierra <asierra@xes-inc.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Vincent Fazio <vfazio@xes-inc.com>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/1] xfs: fallback to readonly during recovery
Date: Mon, 10 Feb 2020 16:31:32 -0600 (CST)	[thread overview]
Message-ID: <829353330.403167.1581373892759.JavaMail.zimbra@xes-inc.com> (raw)
In-Reply-To: <99259ceb-2d0d-1054-4335-017f1854ba14@sandeen.net>

> From: "Eric Sandeen" <sandeen@sandeen.net>
> Sent: Monday, February 10, 2020 3:43:50 PM

> On 2/10/20 3:10 PM, Vincent Fazio wrote:
>> 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.
> 
> What is the workload or scenario where you need this behavior?
> 
> I'm not a big fan of ~silently mounting a filesystem with latent errors,
> tbh, but maybe you can explain a bit more about the problem you're solving
> here?

Hi Eric,

We use SSDs from multiple vendors that can be configured at power-on (via
GPIO) to be read-write or write-protected. When write-protected we get I/O
errors for any writes that reach the device. We believe that behavior is
correct.

We have found that XFS fails during log recovery even when the log is clean
(apparently due to metadata writes immediately before actual recovery).
Vincent and I believe that mounting read-only without recovery should be
fine even when the log is not clean, since the filesystem will be consistent,
even if out-of-date.

Our customers' use often requires nonvolatile memory to be write-protected
or not based on the device being installed in a development or deployed
system. It is ideal for them to be able to mount their filesystems read-
write when possible and read-only when not without having to alter mount
options.

Aaron

> Thanks,
> -Eric
> 
>> 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;

  reply	other threads:[~2020-02-10 22:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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=829353330.403167.1581373892759.JavaMail.zimbra@xes-inc.com \
    --to=asierra@xes-inc.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    --cc=vfazio@xes-inc.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;
as well as URLs for NNTP newsgroup(s).