All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: Aaron Sierra <asierra@xes-inc.com>
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 17:40:03 -0600	[thread overview]
Message-ID: <400031d2-dbcb-a0de-338d-9a11f97c795c@sandeen.net> (raw)
In-Reply-To: <829353330.403167.1581373892759.JavaMail.zimbra@xes-inc.com>

On 2/10/20 4:31 PM, Aaron Sierra wrote:
>> 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).

There should be no log recovery if it's clean ...

And I don't see that here - a clean log on a readonly device simply mounts
RO for me by default, with no muss, no fuss.

# mkfs.xfs -f fsfile
...
# losetup /dev/loop0 fsfile
# mount /dev/loop0 mnt
# touch mnt/blah
# umount mnt
# blockdev --setro /dev/loop0
# dd if=/dev/zero of=/dev/loop0 bs=4k count=1
dd: error writing ‘/dev/loop0’: Operation not permitted
# mount /dev/loop0 mnt
mount: /dev/loop0 is write-protected, mounting read-only
# dmesg
[  419.941649] /dev/loop0: Can't open blockdev
[  419.947106] XFS (loop0): Mounting V5 Filesystem
[  419.952895] XFS (loop0): Ending clean mount
# uname -r
5.5.0

> 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.

I think that you may be making too many assumptions here, i.e. that "log
recovery failure leaves the filesystem in a consistent state" - and that
may not be true in all cases.

IOWS, transitioning to a new RO state for your particular case may be safe,
but I'm not sure that's universally true for all log replay failures.

> 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.

From my example above, I'd like to understand more why/how you have a
clean log that fails to mount by default on a readonly block device...
in my testing, no writes get sent to the device when mounting a clean
log.

-Eric

  reply	other threads:[~2020-02-10 23:40 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
2020-02-10 23:40     ` Eric Sandeen [this message]
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=400031d2-dbcb-a0de-338d-9a11f97c795c@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=asierra@xes-inc.com \
    --cc=linux-xfs@vger.kernel.org \
    --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 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.