aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2012-04-23 01:58:32 -0400
committerBen Myers <bpm@sgi.com>2012-05-14 17:20:25 -0400
commit32ce90a4b79155a155de2b284d8b69023e5e8fea (patch)
tree1280a85dea9061a8089a39fccc8a5ce0fc222e62 /fs/xfs/xfs_inode.c
parentdea9609527a55b65638a6323894269334dfe6ec5 (diff)
xfs: remove log item from AIL in xfs_iflush after a shutdown
If a filesystem has been forced shutdown we are never going to write inodes to disk, which means the inode items will stay in the AIL until we free the inode. Currently that is not a problem, but a pending change requires us to empty the AIL before shutting down the filesystem. In that case leaving the inode in the AIL is lethal. Make sure to remove the log item from the AIL to allow emptying the AIL on shutdown filesystems. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r--fs/xfs/xfs_inode.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index bc46c0a133d3..00f9c2f34e1f 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2397,7 +2397,6 @@ xfs_iflush(
2397 xfs_inode_t *ip, 2397 xfs_inode_t *ip,
2398 uint flags) 2398 uint flags)
2399{ 2399{
2400 xfs_inode_log_item_t *iip;
2401 xfs_buf_t *bp; 2400 xfs_buf_t *bp;
2402 xfs_dinode_t *dip; 2401 xfs_dinode_t *dip;
2403 xfs_mount_t *mp; 2402 xfs_mount_t *mp;
@@ -2410,7 +2409,6 @@ xfs_iflush(
2410 ASSERT(ip->i_d.di_format != XFS_DINODE_FMT_BTREE || 2409 ASSERT(ip->i_d.di_format != XFS_DINODE_FMT_BTREE ||
2411 ip->i_d.di_nextents > XFS_IFORK_MAXEXT(ip, XFS_DATA_FORK)); 2410 ip->i_d.di_nextents > XFS_IFORK_MAXEXT(ip, XFS_DATA_FORK));
2412 2411
2413 iip = ip->i_itemp;
2414 mp = ip->i_mount; 2412 mp = ip->i_mount;
2415 2413
2416 /* 2414 /*
@@ -2447,13 +2445,14 @@ xfs_iflush(
2447 /* 2445 /*
2448 * This may have been unpinned because the filesystem is shutting 2446 * This may have been unpinned because the filesystem is shutting
2449 * down forcibly. If that's the case we must not write this inode 2447 * down forcibly. If that's the case we must not write this inode
2450 * to disk, because the log record didn't make it to disk! 2448 * to disk, because the log record didn't make it to disk.
2449 *
2450 * We also have to remove the log item from the AIL in this case,
2451 * as we wait for an empty AIL as part of the unmount process.
2451 */ 2452 */
2452 if (XFS_FORCED_SHUTDOWN(mp)) { 2453 if (XFS_FORCED_SHUTDOWN(mp)) {
2453 if (iip) 2454 error = XFS_ERROR(EIO);
2454 iip->ili_fields = 0; 2455 goto abort_out;
2455 xfs_ifunlock(ip);
2456 return XFS_ERROR(EIO);
2457 } 2456 }
2458 2457
2459 /* 2458 /*
@@ -2500,11 +2499,13 @@ corrupt_out:
2500 xfs_buf_relse(bp); 2499 xfs_buf_relse(bp);
2501 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); 2500 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
2502cluster_corrupt_out: 2501cluster_corrupt_out:
2502 error = XFS_ERROR(EFSCORRUPTED);
2503abort_out:
2503 /* 2504 /*
2504 * Unlocks the flush lock 2505 * Unlocks the flush lock
2505 */ 2506 */
2506 xfs_iflush_abort(ip); 2507 xfs_iflush_abort(ip);
2507 return XFS_ERROR(EFSCORRUPTED); 2508 return error;
2508} 2509}
2509 2510
2510 2511