aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_log.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_log.c')
-rw-r--r--fs/xfs/xfs_log.c59
1 files changed, 19 insertions, 40 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index ca4fd5bd8522..fe88ef67f93a 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1678,7 +1678,7 @@ xlog_bdstrat(
1678 if (iclog->ic_state & XLOG_STATE_IOERROR) { 1678 if (iclog->ic_state & XLOG_STATE_IOERROR) {
1679 xfs_buf_ioerror(bp, -EIO); 1679 xfs_buf_ioerror(bp, -EIO);
1680 xfs_buf_stale(bp); 1680 xfs_buf_stale(bp);
1681 xfs_buf_ioend(bp, 0); 1681 xfs_buf_ioend(bp);
1682 /* 1682 /*
1683 * It would seem logical to return EIO here, but we rely on 1683 * It would seem logical to return EIO here, but we rely on
1684 * the log state machine to propagate I/O errors instead of 1684 * the log state machine to propagate I/O errors instead of
@@ -1688,7 +1688,7 @@ xlog_bdstrat(
1688 return 0; 1688 return 0;
1689 } 1689 }
1690 1690
1691 xfs_buf_iorequest(bp); 1691 xfs_buf_submit(bp);
1692 return 0; 1692 return 0;
1693} 1693}
1694 1694
@@ -3867,18 +3867,17 @@ xlog_state_ioerror(
3867 * This is called from xfs_force_shutdown, when we're forcibly 3867 * This is called from xfs_force_shutdown, when we're forcibly
3868 * shutting down the filesystem, typically because of an IO error. 3868 * shutting down the filesystem, typically because of an IO error.
3869 * Our main objectives here are to make sure that: 3869 * Our main objectives here are to make sure that:
3870 * a. the filesystem gets marked 'SHUTDOWN' for all interested 3870 * a. if !logerror, flush the logs to disk. Anything modified
3871 * after this is ignored.
3872 * b. the filesystem gets marked 'SHUTDOWN' for all interested
3871 * parties to find out, 'atomically'. 3873 * parties to find out, 'atomically'.
3872 * b. those who're sleeping on log reservations, pinned objects and 3874 * c. those who're sleeping on log reservations, pinned objects and
3873 * other resources get woken up, and be told the bad news. 3875 * other resources get woken up, and be told the bad news.
3874 * c. nothing new gets queued up after (a) and (b) are done. 3876 * d. nothing new gets queued up after (b) and (c) are done.
3875 * d. if !logerror, flush the iclogs to disk, then seal them off
3876 * for business.
3877 * 3877 *
3878 * Note: for delayed logging the !logerror case needs to flush the regions 3878 * Note: for the !logerror case we need to flush the regions held in memory out
3879 * held in memory out to the iclogs before flushing them to disk. This needs 3879 * to disk first. This needs to be done before the log is marked as shutdown,
3880 * to be done before the log is marked as shutdown, otherwise the flush to the 3880 * otherwise the iclog writes will fail.
3881 * iclogs will fail.
3882 */ 3881 */
3883int 3882int
3884xfs_log_force_umount( 3883xfs_log_force_umount(
@@ -3910,16 +3909,16 @@ xfs_log_force_umount(
3910 ASSERT(XLOG_FORCED_SHUTDOWN(log)); 3909 ASSERT(XLOG_FORCED_SHUTDOWN(log));
3911 return 1; 3910 return 1;
3912 } 3911 }
3913 retval = 0;
3914 3912
3915 /* 3913 /*
3916 * Flush the in memory commit item list before marking the log as 3914 * Flush all the completed transactions to disk before marking the log
3917 * being shut down. We need to do it in this order to ensure all the 3915 * being shut down. We need to do it in this order to ensure that
3918 * completed transactions are flushed to disk with the xfs_log_force() 3916 * completed operations are safely on disk before we shut down, and that
3919 * call below. 3917 * we don't have to issue any buffer IO after the shutdown flags are set
3918 * to guarantee this.
3920 */ 3919 */
3921 if (!logerror) 3920 if (!logerror)
3922 xlog_cil_force(log); 3921 _xfs_log_force(mp, XFS_LOG_SYNC, NULL);
3923 3922
3924 /* 3923 /*
3925 * mark the filesystem and the as in a shutdown state and wake 3924 * mark the filesystem and the as in a shutdown state and wake
@@ -3931,18 +3930,11 @@ xfs_log_force_umount(
3931 XFS_BUF_DONE(mp->m_sb_bp); 3930 XFS_BUF_DONE(mp->m_sb_bp);
3932 3931
3933 /* 3932 /*
3934 * This flag is sort of redundant because of the mount flag, but 3933 * Mark the log and the iclogs with IO error flags to prevent any
3935 * it's good to maintain the separation between the log and the rest 3934 * further log IO from being issued or completed.
3936 * of XFS.
3937 */ 3935 */
3938 log->l_flags |= XLOG_IO_ERROR; 3936 log->l_flags |= XLOG_IO_ERROR;
3939 3937 retval = xlog_state_ioerror(log);
3940 /*
3941 * If we hit a log error, we want to mark all the iclogs IOERROR
3942 * while we're still holding the loglock.
3943 */
3944 if (logerror)
3945 retval = xlog_state_ioerror(log);
3946 spin_unlock(&log->l_icloglock); 3938 spin_unlock(&log->l_icloglock);
3947 3939
3948 /* 3940 /*
@@ -3955,19 +3947,6 @@ xfs_log_force_umount(
3955 xlog_grant_head_wake_all(&log->l_reserve_head); 3947 xlog_grant_head_wake_all(&log->l_reserve_head);
3956 xlog_grant_head_wake_all(&log->l_write_head); 3948 xlog_grant_head_wake_all(&log->l_write_head);
3957 3949
3958 if (!(log->l_iclog->ic_state & XLOG_STATE_IOERROR)) {
3959 ASSERT(!logerror);
3960 /*
3961 * Force the incore logs to disk before shutting the
3962 * log down completely.
3963 */
3964 _xfs_log_force(mp, XFS_LOG_SYNC, NULL);
3965
3966 spin_lock(&log->l_icloglock);
3967 retval = xlog_state_ioerror(log);
3968 spin_unlock(&log->l_icloglock);
3969 }
3970
3971 /* 3950 /*
3972 * Wake up everybody waiting on xfs_log_force. Wake the CIL push first 3951 * Wake up everybody waiting on xfs_log_force. Wake the CIL push first
3973 * as if the log writes were completed. The abort handling in the log 3952 * as if the log writes were completed. The abort handling in the log