From aa6a6227435cb06cfba29166b25140a4d46207c6 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Fri, 21 Jul 2017 10:25:35 -0500 Subject: [PATCH] xfs: toggle readonly state around xfs_log_mount_finish 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 Reviewed-by: Brian Foster Reviewed-by: Darrick J. Wong Orabug: 26630113 Link: https://patchwork.kernel.org/patch/9857173/ move readonly checking into the if statement to apply to the current kernel Signed-off-by: Shan Hai Reviewed-by: Jack Vogel --- fs/xfs/xfs_log.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 39d91a9d0dda2..f5520ea397668 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c @@ -746,8 +746,13 @@ int xfs_log_mount_finish(xfs_mount_t *mp) { int error = 0; + int readonly = (mp->m_flags & XFS_MOUNT_RDONLY); if (!(mp->m_flags & XFS_MOUNT_NORECOVERY)) { + 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); @@ -756,6 +761,9 @@ xfs_log_mount_finish(xfs_mount_t *mp) } + if (readonly) + mp->m_flags |= XFS_MOUNT_RDONLY; + return error; } -- 2.50.1