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
This commit is contained in:
Linus Torvalds 2010-04-17 10:57:56 -07:00
commit 65832940eb
2 changed files with 28 additions and 14 deletions

View File

@ -820,10 +820,10 @@ xfs_reclaim_inode(
* 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
* 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.
*/
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,
"inode 0x%llx background reclaim flush failed with %d",
(long long)ip->i_ino, error);

View File

@ -745,9 +745,16 @@ xfs_log_move_tail(xfs_mount_t *mp,
/*
* 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
* nothing in the iclogs). And, we need to be in the right state indicating
* something has gone out.
* that needs to be covered. To begin the transition to the idle state
* firstly the log needs to be idle (no AIL and nothing in the iclogs).
* 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
xfs_log_need_covered(xfs_mount_t *mp)
@ -759,17 +766,24 @@ xfs_log_need_covered(xfs_mount_t *mp)
return 0;
spin_lock(&log->l_icloglock);
if (((log->l_covered_state == XLOG_STATE_COVER_NEED) ||
(log->l_covered_state == XLOG_STATE_COVER_NEED2))
&& !xfs_trans_ail_tail(log->l_ailp)
&& xlog_iclogs_empty(log)) {
if (log->l_covered_state == XLOG_STATE_COVER_NEED)
log->l_covered_state = XLOG_STATE_COVER_DONE;
else {
ASSERT(log->l_covered_state == XLOG_STATE_COVER_NEED2);
log->l_covered_state = XLOG_STATE_COVER_DONE2;
switch (log->l_covered_state) {
case XLOG_STATE_COVER_DONE:
case XLOG_STATE_COVER_DONE2:
case XLOG_STATE_COVER_IDLE:
break;
case XLOG_STATE_COVER_NEED:
case XLOG_STATE_COVER_NEED2:
if (!xfs_trans_ail_tail(log->l_ailp) &&
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;
break;
}
spin_unlock(&log->l_icloglock);
return needed;