Re: [PATCH 2/2 V2] xfs: toggle readonly state around xfs_log_mount_finish
From: Darrick J. Wong <hidden>
Date: 2017-08-11 19:47:19
On Fri, Aug 11, 2017 at 12:45:05PM -0700, Eric Sandeen wrote:
When we do log recovery on a readonly mount, unlinked inode processing does not happen due to the readonly checks in xfs_inactive(), which are trying to prevent any I/O on a readonly mount. This is misguided - we do I/O on readonly mounts all the time, for consistency; for example, log recovery. So do the same RDONLY flag twiddling around xfs_log_mount_finish() as we do around xfs_log_mount(), for the same reason. This all cries out for a big rework but for now this is a simple fix to an obvious problem. Signed-off-by: Eric Sandeen <redacted> Reviewed-by: Brian Foster <redacted> Reviewed-by: Darrick J. Wong <redacted> --- V2: bool "readonly" per Christoph's request
Looks good, will test... Reviewed-by: Darrick J. Wong <redacted>
quoted hunk ↗ jump to hunk
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 0bd1341..ca56d85 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c@@ -743,16 +743,23 @@ struct xfs_mount *mp) { int error = 0; + bool readonly = (mp->m_flags & XFS_MOUNT_RDONLY); if (mp->m_flags & XFS_MOUNT_NORECOVERY) { ASSERT(mp->m_flags & XFS_MOUNT_RDONLY); return 0; + } else if (readonly) { + /* Allow unlinked processing to proceed */ + mp->m_flags &= ~XFS_MOUNT_RDONLY; } error = xlog_recover_finish(mp->m_log); if (!error) xfs_log_work_queue(mp); + if (readonly) + mp->m_flags |= XFS_MOUNT_RDONLY; + return error; } --To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html