diff options
author | Lachlan McIlroy <lachlan@sgi.com> | 2008-03-05 21:43:11 -0500 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-04-17 21:34:54 -0400 |
commit | 461aa8a22595e3bd3e6f4dc2894d7c4315ea2bb9 (patch) | |
tree | 52cef56ec70610b9e0dd1fac355d646e827c0102 /fs/xfs/xfs_vnodeops.c | |
parent | e12070a5dca8bfeee352e9655ae79772a96b32f8 (diff) |
[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: Lachlan McIlroy <lachlan@sgi.com>
Signed-off-by: David Chinner <dgc@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_vnodeops.c')
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 64c5953feca4..ce82a2d0acbe 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -3694,12 +3694,12 @@ xfs_finish_reclaim( | |||
3694 | * We get the flush lock regardless, though, just to make sure | 3694 | * We get the flush lock regardless, though, just to make sure |
3695 | * we don't free it while it is being flushed. | 3695 | * we don't free it while it is being flushed. |
3696 | */ | 3696 | */ |
3697 | if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) { | 3697 | if (!locked) { |
3698 | if (!locked) { | 3698 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
3699 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 3699 | xfs_iflock(ip); |
3700 | xfs_iflock(ip); | 3700 | } |
3701 | } | ||
3702 | 3701 | ||
3702 | if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) { | ||
3703 | if (ip->i_update_core || | 3703 | if (ip->i_update_core || |
3704 | ((ip->i_itemp != NULL) && | 3704 | ((ip->i_itemp != NULL) && |
3705 | (ip->i_itemp->ili_format.ilf_fields != 0))) { | 3705 | (ip->i_itemp->ili_format.ilf_fields != 0))) { |
@@ -3719,17 +3719,11 @@ xfs_finish_reclaim( | |||
3719 | ASSERT(ip->i_update_core == 0); | 3719 | ASSERT(ip->i_update_core == 0); |
3720 | ASSERT(ip->i_itemp == NULL || | 3720 | ASSERT(ip->i_itemp == NULL || |
3721 | ip->i_itemp->ili_format.ilf_fields == 0); | 3721 | ip->i_itemp->ili_format.ilf_fields == 0); |
3722 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | ||
3723 | } else if (locked) { | ||
3724 | /* | ||
3725 | * We are not interested in doing an iflush if we're | ||
3726 | * in the process of shutting down the filesystem forcibly. | ||
3727 | * So, just reclaim the inode. | ||
3728 | */ | ||
3729 | xfs_ifunlock(ip); | ||
3730 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | ||
3731 | } | 3722 | } |
3732 | 3723 | ||
3724 | xfs_ifunlock(ip); | ||
3725 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | ||
3726 | |||
3733 | reclaim: | 3727 | reclaim: |
3734 | xfs_ireclaim(ip); | 3728 | xfs_ireclaim(ip); |
3735 | return 0; | 3729 | return 0; |