xfs: clear MS_ACTIVE after finishing log recovery
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 10 Aug 2017 21:20:28 +0000 (14:20 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Thu, 17 Aug 2017 19:40:33 +0000 (12:40 -0700)
commit8204f8ddaafafcae074746fcf2a05a45e6827603
tree9313a82a31be8acdbc07a403981a3636a900d608
parente28ae8e428fefe2facd72cea9f29906ecb9c861d
xfs: clear MS_ACTIVE after finishing log recovery

Way back when we established inode block-map redo log items, it was
discovered that we needed to prevent the VFS from evicting inodes during
log recovery because any given inode might be have bmap redo items to
replay even if the inode has no link count and is ultimately deleted,
and any eviction of an unlinked inode causes the inode to be truncated
and freed too early.

To make this possible, we set MS_ACTIVE so that inodes would not be torn
down immediately upon release.  Unfortunately, this also results in the
quota inodes not being released at all if a later part of the mount
process should fail, because we never reclaim the inodes.  So, set
MS_ACTIVE right before we do the last part of log recovery and clear it
immediately after we finish the log recovery so that everything
will be torn down properly if we abort the mount.

Fixes: 17c12bcd30 ("xfs: when replaying bmap operations, don't let unlinked inodes get reaped")
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
fs/xfs/xfs_log.c
fs/xfs/xfs_mount.c