]> www.infradead.org Git - users/jedix/linux-maple.git/commit
xfs: write unmount record for ro mounts
authorEric Sandeen <sandeen@sandeen.net>
Fri, 21 Jul 2017 15:24:28 +0000 (10:24 -0500)
committerShan Hai <shan.hai@oracle.com>
Tue, 15 Aug 2017 12:17:21 +0000 (20:17 +0800)
commit59215929e9b12f43ef37b0863d0b42e05b4ab2ce
treebf68c9a86ec4cb4004ec12bac93aa3736d1f1db9
parent821f365e299e69a267815139d2d88b11be8efa33
xfs: write unmount record for ro mounts

There are dueling comments in the xfs code about intent
for log writes when unmounting a readonly filesystem.

In xfs_mountfs, we see the intent:

/*
 * Now the log is fully replayed, we can transition to full read-only
 * mode for read-only mounts. This will sync all the metadata and clean
 * the log so that the recovery we just performed does not have to be
 * replayed again on the next mount.
 */

and it calls xfs_quiesce_attr(), but by the time we get to
xfs_log_unmount_write(), it returns early for a RDONLY mount:

 * Don't write out unmount record on read-only mounts.

Because of this, sequential ro mounts of a filesystem with
a dirty log will replay the log each time, which seems odd.

Fix this by writing an unmount record even for RO mounts, as long
as norecovery wasn't specified (don't write a clean log record
if a dirty log may still be there!) and the log device is
writable.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Orabug: 26630113

Link: https://patchwork.kernel.org/patch/9857169
Signed-off-by: Shan Hai <shan.hai@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
fs/xfs/xfs_log.c