Commit 461aa8a2 authored by Lachlan McIlroy's avatar Lachlan McIlroy Committed by Lachlan McIlroy

[XFS] make inode reclaim synchronise with xfs_iflush_done()

On a forced shutdown, xfs_finish_reclaim() will skip flushing the inode.
If the inode flush lock is not already held and there is an outstanding
xfs_iflush_done() then we might free the inode prematurely. By acquiring
and releasing the flush lock we will synchronise with xfs_iflush_done().

SGI-PV: 909874
SGI-Modid: xfs-linux-melb:xfs-kern:30468a
Signed-off-by: default avatarLachlan McIlroy <lachlan@sgi.com>
Signed-off-by: default avatarDavid Chinner <dgc@sgi.com>
parent e12070a5
...@@ -3694,12 +3694,12 @@ xfs_finish_reclaim( ...@@ -3694,12 +3694,12 @@ xfs_finish_reclaim(
* We get the flush lock regardless, though, just to make sure * We get the flush lock regardless, though, just to make sure
* we don't free it while it is being flushed. * we don't free it while it is being flushed.
*/ */
if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) {
if (!locked) { if (!locked) {
xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_ilock(ip, XFS_ILOCK_EXCL);
xfs_iflock(ip); xfs_iflock(ip);
} }
if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) {
if (ip->i_update_core || if (ip->i_update_core ||
((ip->i_itemp != NULL) && ((ip->i_itemp != NULL) &&
(ip->i_itemp->ili_format.ilf_fields != 0))) { (ip->i_itemp->ili_format.ilf_fields != 0))) {
...@@ -3719,16 +3719,10 @@ xfs_finish_reclaim( ...@@ -3719,16 +3719,10 @@ xfs_finish_reclaim(
ASSERT(ip->i_update_core == 0); ASSERT(ip->i_update_core == 0);
ASSERT(ip->i_itemp == NULL || ASSERT(ip->i_itemp == NULL ||
ip->i_itemp->ili_format.ilf_fields == 0); ip->i_itemp->ili_format.ilf_fields == 0);
xfs_iunlock(ip, XFS_ILOCK_EXCL); }
} else if (locked) {
/*
* We are not interested in doing an iflush if we're
* in the process of shutting down the filesystem forcibly.
* So, just reclaim the inode.
*/
xfs_ifunlock(ip); xfs_ifunlock(ip);
xfs_iunlock(ip, XFS_ILOCK_EXCL); xfs_iunlock(ip, XFS_ILOCK_EXCL);
}
reclaim: reclaim:
xfs_ireclaim(ip); xfs_ireclaim(ip);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment