From: Christoph Hellwig <hch@lst.de>
To: linux-xfs@vger.kernel.org
Cc: Dave Chinner <david@fromorbit.com>
Subject: [PATCH 14/14] xfs: remove XLOG_STATE_IOERROR
Date: Mon, 16 Mar 2020 15:42:33 +0100 [thread overview]
Message-ID: <20200316144233.900390-15-hch@lst.de> (raw)
In-Reply-To: <20200316144233.900390-1-hch@lst.de>
Just check the shutdown flag in struct xlog, instead of replicating the
information into each iclog and checking it there.
As the iclog state is now not overload with the shut down information
various places that check for a specific state now don't need to account
for the fake IOERROR state.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_log.c | 68 +++++++++++--------------------------------
fs/xfs/xfs_log_cil.c | 2 +-
fs/xfs/xfs_log_priv.h | 1 -
3 files changed, 18 insertions(+), 53 deletions(-)
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 761b138d97ec..07023372ccbd 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -578,7 +578,7 @@ xlog_state_release_iclog(
{
lockdep_assert_held(&log->l_icloglock);
- if (iclog->ic_state == XLOG_STATE_IOERROR)
+ if (XLOG_FORCED_SHUTDOWN(log))
return -EIO;
if (atomic_dec_and_test(&iclog->ic_refcnt) &&
@@ -599,7 +599,7 @@ xfs_log_release_iclog(
bool sync = false;
if (atomic_dec_and_lock(&iclog->ic_refcnt, &log->l_icloglock)) {
- if (iclog->ic_state != XLOG_STATE_IOERROR)
+ if (!XLOG_FORCED_SHUTDOWN(log))
sync = __xlog_state_release_iclog(log, iclog);
spin_unlock(&log->l_icloglock);
}
@@ -924,7 +924,7 @@ xfs_log_write_unmount_record(
error = xlog_write(log, &vec, tic, &lsn, NULL, flags);
/*
* At this point, we're umounting anyway, so there's no point in
- * transitioning log state to IOERROR. Just continue...
+ * transitioning log state to IO_ERROR. Just continue...
*/
out_err:
if (error)
@@ -936,8 +936,7 @@ xfs_log_write_unmount_record(
if (iclog->ic_state == XLOG_STATE_ACTIVE)
xlog_state_switch_iclogs(log, iclog, 0);
else
- ASSERT(iclog->ic_state == XLOG_STATE_WANT_SYNC ||
- iclog->ic_state == XLOG_STATE_IOERROR);
+ ASSERT(iclog->ic_state == XLOG_STATE_WANT_SYNC);
error = xlog_state_release_iclog(log, iclog);
xlog_wait_on_iclog(iclog);
@@ -1740,7 +1739,7 @@ xlog_write_iclog(
* across the log IO to archieve that.
*/
down(&iclog->ic_sema);
- if (unlikely(iclog->ic_state == XLOG_STATE_IOERROR)) {
+ if (XLOG_FORCED_SHUTDOWN(log)) {
/*
* It would seem logical to return EIO here, but we rely on
* the log state machine to propagate I/O errors instead of
@@ -2295,8 +2294,7 @@ xlog_write_copy_finish(
if (iclog->ic_state == XLOG_STATE_ACTIVE)
xlog_state_switch_iclogs(log, iclog, 0);
else
- ASSERT(iclog->ic_state == XLOG_STATE_WANT_SYNC ||
- iclog->ic_state == XLOG_STATE_IOERROR);
+ ASSERT(iclog->ic_state == XLOG_STATE_WANT_SYNC);
if (!commit_iclog)
goto release_iclog;
spin_unlock(&log->l_icloglock);
@@ -2817,8 +2815,7 @@ xlog_state_do_callback(
}
} while (cycled_icloglock);
- if (log->l_iclog->ic_state == XLOG_STATE_ACTIVE ||
- log->l_iclog->ic_state == XLOG_STATE_IOERROR)
+ if (log->l_iclog->ic_state == XLOG_STATE_ACTIVE)
wake_up_all(&log->l_flush_wait);
spin_unlock(&log->l_icloglock);
@@ -3167,7 +3164,7 @@ xfs_log_force(
spin_lock(&log->l_icloglock);
iclog = log->l_iclog;
- if (iclog->ic_state == XLOG_STATE_IOERROR)
+ if (XLOG_FORCED_SHUTDOWN(log))
goto out_error;
if (iclog->ic_state == XLOG_STATE_DIRTY ||
@@ -3240,7 +3237,7 @@ __xfs_log_force_lsn(
spin_lock(&log->l_icloglock);
iclog = log->l_iclog;
- if (iclog->ic_state == XLOG_STATE_IOERROR)
+ if (XLOG_FORCED_SHUTDOWN(log))
goto out_error;
while (be64_to_cpu(iclog->ic_header.h_lsn) != lsn) {
@@ -3691,34 +3688,6 @@ xlog_verify_iclog(
} /* xlog_verify_iclog */
#endif
-/*
- * Mark all iclogs IOERROR. l_icloglock is held by the caller.
- */
-STATIC int
-xlog_state_ioerror(
- struct xlog *log)
-{
- xlog_in_core_t *iclog, *ic;
-
- iclog = log->l_iclog;
- if (iclog->ic_state != XLOG_STATE_IOERROR) {
- /*
- * Mark all the incore logs IOERROR.
- * From now on, no log flushes will result.
- */
- ic = iclog;
- do {
- ic->ic_state = XLOG_STATE_IOERROR;
- ic = ic->ic_next;
- } while (ic != iclog);
- return 0;
- }
- /*
- * Return non-zero, if state transition has already happened.
- */
- return 1;
-}
-
/*
* This is called from xfs_force_shutdown, when we're forcibly
* shutting down the filesystem, typically because of an IO error.
@@ -3740,10 +3709,8 @@ xfs_log_force_umount(
struct xfs_mount *mp,
int logerror)
{
- struct xlog *log;
- int retval;
-
- log = mp->m_log;
+ struct xlog *log = mp->m_log;
+ int retval = 0;
/*
* If this happens during log recovery, don't worry about
@@ -3761,10 +3728,8 @@ xfs_log_force_umount(
* Somebody could've already done the hard work for us.
* No need to get locks for this.
*/
- if (logerror && log->l_iclog->ic_state == XLOG_STATE_IOERROR) {
- ASSERT(XLOG_FORCED_SHUTDOWN(log));
+ if (logerror && XLOG_FORCED_SHUTDOWN(log))
return 1;
- }
/*
* Flush all the completed transactions to disk before marking the log
@@ -3786,11 +3751,13 @@ xfs_log_force_umount(
mp->m_sb_bp->b_flags |= XBF_DONE;
/*
- * Mark the log and the iclogs with IO error flags to prevent any
- * further log IO from being issued or completed.
+ * Mark the log as shut down to prevent any further log IO from being
+ * issued or completed. Return non-zero if log IO_ERROR transition had
+ * already happened so that the caller can skip further processing.
*/
+ if (XLOG_FORCED_SHUTDOWN(log))
+ retval = 1;
log->l_flags |= XLOG_IO_ERROR;
- retval = xlog_state_ioerror(log);
spin_unlock(&log->l_icloglock);
/*
@@ -3814,7 +3781,6 @@ xfs_log_force_umount(
spin_unlock(&log->l_cilp->xc_push_lock);
xlog_state_do_callback(log);
- /* return non-zero if log IOERROR transition had already happened */
return retval;
}
diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
index adc4af336c97..a93097cf0990 100644
--- a/fs/xfs/xfs_log_cil.c
+++ b/fs/xfs/xfs_log_cil.c
@@ -845,7 +845,7 @@ xlog_cil_push_work(
goto out_abort;
spin_lock(&commit_iclog->ic_callback_lock);
- if (commit_iclog->ic_state == XLOG_STATE_IOERROR) {
+ if (XLOG_FORCED_SHUTDOWN(log)) {
spin_unlock(&commit_iclog->ic_callback_lock);
goto out_abort;
}
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index 2b0aec37e73e..f3f4a35ce153 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -47,7 +47,6 @@ enum xlog_iclog_state {
XLOG_STATE_DONE_SYNC, /* Done syncing to disk */
XLOG_STATE_CALLBACK, /* Callback functions now */
XLOG_STATE_DIRTY, /* Dirty IC log, not ready for ACTIVE status */
- XLOG_STATE_IOERROR, /* IO error happened in sync'ing log */
};
/*
--
2.24.1
next prev parent reply other threads:[~2020-03-16 14:51 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-16 14:42 cleanup log I/O error handling v2 Christoph Hellwig
2020-03-16 14:42 ` [PATCH 01/14] xfs: merge xlog_cil_push into xlog_cil_push_work Christoph Hellwig
2020-03-16 19:40 ` Darrick J. Wong
2020-03-17 0:15 ` Dave Chinner
2020-03-17 13:23 ` Brian Foster
2020-03-16 14:42 ` [PATCH 02/14] xfs: factor out a xlog_wait_on_iclog helper Christoph Hellwig
2020-03-16 20:20 ` Darrick J. Wong
2020-03-17 13:23 ` Brian Foster
2020-03-16 14:42 ` [PATCH 03/14] xfs: simplify the xfs_log_release_iclog calling convention Christoph Hellwig
2020-03-16 20:21 ` Darrick J. Wong
2020-03-17 13:23 ` Brian Foster
2020-03-16 14:42 ` [PATCH 04/14] xfs: simplify log shutdown checking in xfs_log_release_iclog Christoph Hellwig
2020-03-16 20:33 ` Darrick J. Wong
2020-03-17 13:24 ` Brian Foster
2020-03-16 14:42 ` [PATCH 05/14] xfs: remove the aborted parameter to xlog_state_done_syncing Christoph Hellwig
2020-03-16 20:50 ` Darrick J. Wong
2020-03-18 9:38 ` Christoph Hellwig
2020-03-17 13:24 ` Brian Foster
2020-03-16 14:42 ` [PATCH 06/14] xfs: refactor xlog_state_clean_iclog Christoph Hellwig
2020-03-16 20:59 ` Darrick J. Wong
2020-03-17 13:25 ` Brian Foster
2020-03-18 9:40 ` Christoph Hellwig
2020-03-16 14:42 ` [PATCH 07/14] xfs: move the ioerror check out of xlog_state_clean_iclog Christoph Hellwig
2020-03-16 21:00 ` Darrick J. Wong
2020-03-17 13:25 ` Brian Foster
2020-03-16 14:42 ` [PATCH 08/14] xfs: move xlog_state_do_iclog_callbacks up Christoph Hellwig
2020-03-16 21:00 ` Darrick J. Wong
2020-03-18 14:44 ` Brian Foster
2020-03-16 14:42 ` [PATCH 09/14] xfs: move log shut down handling out of xlog_state_iodone_process_iclog Christoph Hellwig
2020-03-16 21:02 ` Darrick J. Wong
2020-03-18 14:48 ` Brian Foster
2020-03-18 16:34 ` Christoph Hellwig
2020-03-19 11:36 ` Brian Foster
2020-03-19 13:05 ` Christoph Hellwig
2020-03-19 13:37 ` Brian Foster
2020-03-16 14:42 ` [PATCH 10/14] xfs: refactor xlog_state_iodone_process_iclog Christoph Hellwig
2020-03-16 21:07 ` Darrick J. Wong
2020-03-16 14:42 ` [PATCH 11/14] xfs: merge xlog_state_clean_iclog into xlog_state_iodone_process_iclog Christoph Hellwig
2020-03-16 21:09 ` Darrick J. Wong
2020-03-18 14:48 ` Brian Foster
2020-03-16 14:42 ` [PATCH 12/14] xfs: merge xlog_state_set_callback " Christoph Hellwig
2020-03-16 21:10 ` Darrick J. Wong
2020-03-18 14:48 ` Brian Foster
2020-03-16 14:42 ` [PATCH 13/14] xfs: remove xlog_state_want_sync Christoph Hellwig
2020-03-16 21:23 ` Darrick J. Wong
2020-03-18 14:48 ` Brian Foster
2020-03-16 14:42 ` Christoph Hellwig [this message]
2020-03-16 21:25 ` [PATCH 14/14] xfs: remove XLOG_STATE_IOERROR Darrick J. Wong
2020-03-18 9:43 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200316144233.900390-15-hch@lst.de \
--to=hch@lst.de \
--cc=david@fromorbit.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).