Skip to content

Commit 76e5890

Browse files
author
Darrick J. Wong
committed
xfs: allow inode inactivation during a ro mount log recovery
In the next patch, we're going to prohibit log recovery if the primary superblock contains an unrecognized rocompat feature bit even on readonly mounts. This requires removing all the code in the log mounting process that temporarily disables the readonly state. Unfortunately, inode inactivation disables itself on readonly mounts. Clearing the iunlinked lists after log recovery needs inactivation to run to free the unreferenced inodes, which (AFAICT) is the only reason why log mounting plays games with the readonly state in the first place. Therefore, change the inactivation predicates to allow inactivation during log recovery of a readonly mount. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Dave Chinner <[email protected]>
1 parent ef7d959 commit 76e5890

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

fs/xfs/xfs_inode.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,8 +1642,11 @@ xfs_inode_needs_inactive(
16421642
if (VFS_I(ip)->i_mode == 0)
16431643
return false;
16441644

1645-
/* If this is a read-only mount, don't do this (would generate I/O) */
1646-
if (xfs_is_readonly(mp))
1645+
/*
1646+
* If this is a read-only mount, don't do this (would generate I/O)
1647+
* unless we're in log recovery and cleaning the iunlinked list.
1648+
*/
1649+
if (xfs_is_readonly(mp) && !xlog_recovery_needed(mp->m_log))
16471650
return false;
16481651

16491652
/* If the log isn't running, push inodes straight to reclaim. */
@@ -1703,8 +1706,11 @@ xfs_inactive(
17031706
mp = ip->i_mount;
17041707
ASSERT(!xfs_iflags_test(ip, XFS_IRECOVERY));
17051708

1706-
/* If this is a read-only mount, don't do this (would generate I/O) */
1707-
if (xfs_is_readonly(mp))
1709+
/*
1710+
* If this is a read-only mount, don't do this (would generate I/O)
1711+
* unless we're in log recovery and cleaning the iunlinked list.
1712+
*/
1713+
if (xfs_is_readonly(mp) && !xlog_recovery_needed(mp->m_log))
17081714
goto out;
17091715

17101716
/* Metadata inodes require explicit resource cleanup. */

0 commit comments

Comments
 (0)