Sorry, I have been distracted away from this regression. This was previously
titled "xfs: synchronously write the superblock on unmount".
xfs_wait_buftarg() does not wait for the completion of the write of the
uncached superblock. This write can race with the shutdown of the log and
causes a panic if the write does not win the race.
The log write of the superblock is important for possible recovery, but a
second syncronous write of the same superblock seems redundant. Would just
waiting for the iodone() of the log write before tearing down the log be
enough?
Signed-off-by: Mark Tinguely <tinguely@xxxxxxx>
---
fs/xfs/xfs_mount.c | 8 ++++++++
1 file changed, 8 insertions(+)
Index: b/fs/xfs/xfs_mount.c
===================================================================
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -1457,6 +1457,7 @@ void
xfs_unmountfs(
struct xfs_mount *mp)
{
+ struct xfs_buf *bp = mp->m_sb_bp;
__uint64_t resblks;
int error;
@@ -1529,6 +1530,13 @@ xfs_unmountfs(
xfs_ail_push_all_sync(mp->m_ail);
xfs_wait_buftarg(mp->m_ddev_targp);
+ /*
+ * Wait for the superblock to be written out. The superblock buffer
+ * will remain locked until the iodone().
+ */
+ xfs_buf_lock(bp);
+ xfs_buf_unlock(bp);
+
xfs_log_unmount_write(mp);
xfs_log_unmount(mp);
xfs_uuid_unmount(mp);
|