Commit 65832940 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs

* 'for-linus' of git://oss.sgi.com/xfs/xfs:
  xfs: don't warn on EAGAIN in inode reclaim
  xfs: ensure that sync updates the log tail correctly
parents 1c1ec9c0 f1d486a3
...@@ -820,10 +820,10 @@ xfs_reclaim_inode( ...@@ -820,10 +820,10 @@ xfs_reclaim_inode(
* call into reclaim to find it in a clean state instead of waiting for * call into reclaim to find it in a clean state instead of waiting for
* it now. We also don't return errors here - if the error is transient * it now. We also don't return errors here - if the error is transient
* then the next reclaim pass will flush the inode, and if the error * then the next reclaim pass will flush the inode, and if the error
* is permanent then the next sync reclaim will relcaim the inode and * is permanent then the next sync reclaim will reclaim the inode and
* pass on the error. * pass on the error.
*/ */
if (error && !XFS_FORCED_SHUTDOWN(ip->i_mount)) { if (error && error != EAGAIN && !XFS_FORCED_SHUTDOWN(ip->i_mount)) {
xfs_fs_cmn_err(CE_WARN, ip->i_mount, xfs_fs_cmn_err(CE_WARN, ip->i_mount,
"inode 0x%llx background reclaim flush failed with %d", "inode 0x%llx background reclaim flush failed with %d",
(long long)ip->i_ino, error); (long long)ip->i_ino, error);
......
...@@ -745,9 +745,16 @@ xfs_log_move_tail(xfs_mount_t *mp, ...@@ -745,9 +745,16 @@ xfs_log_move_tail(xfs_mount_t *mp,
/* /*
* Determine if we have a transaction that has gone to disk * Determine if we have a transaction that has gone to disk
* that needs to be covered. Log activity needs to be idle (no AIL and * that needs to be covered. To begin the transition to the idle state
* nothing in the iclogs). And, we need to be in the right state indicating * firstly the log needs to be idle (no AIL and nothing in the iclogs).
* something has gone out. * If we are then in a state where covering is needed, the caller is informed
* that dummy transactions are required to move the log into the idle state.
*
* Because this is called as part of the sync process, we should also indicate
* that dummy transactions should be issued in anything but the covered or
* idle states. This ensures that the log tail is accurately reflected in
* the log at the end of the sync, hence if a crash occurrs avoids replay
* of transactions where the metadata is already on disk.
*/ */
int int
xfs_log_need_covered(xfs_mount_t *mp) xfs_log_need_covered(xfs_mount_t *mp)
...@@ -759,17 +766,24 @@ xfs_log_need_covered(xfs_mount_t *mp) ...@@ -759,17 +766,24 @@ xfs_log_need_covered(xfs_mount_t *mp)
return 0; return 0;
spin_lock(&log->l_icloglock); spin_lock(&log->l_icloglock);
if (((log->l_covered_state == XLOG_STATE_COVER_NEED) || switch (log->l_covered_state) {
(log->l_covered_state == XLOG_STATE_COVER_NEED2)) case XLOG_STATE_COVER_DONE:
&& !xfs_trans_ail_tail(log->l_ailp) case XLOG_STATE_COVER_DONE2:
&& xlog_iclogs_empty(log)) { case XLOG_STATE_COVER_IDLE:
if (log->l_covered_state == XLOG_STATE_COVER_NEED) break;
log->l_covered_state = XLOG_STATE_COVER_DONE; case XLOG_STATE_COVER_NEED:
else { case XLOG_STATE_COVER_NEED2:
ASSERT(log->l_covered_state == XLOG_STATE_COVER_NEED2); if (!xfs_trans_ail_tail(log->l_ailp) &&
log->l_covered_state = XLOG_STATE_COVER_DONE2; xlog_iclogs_empty(log)) {
if (log->l_covered_state == XLOG_STATE_COVER_NEED)
log->l_covered_state = XLOG_STATE_COVER_DONE;
else
log->l_covered_state = XLOG_STATE_COVER_DONE2;
} }
/* FALLTHRU */
default:
needed = 1; needed = 1;
break;
} }
spin_unlock(&log->l_icloglock); spin_unlock(&log->l_icloglock);
return needed; return needed;
......
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