Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs
Browse files Browse the repository at this point in the history
* '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
  • Loading branch information
Linus Torvalds committed Apr 17, 2010
2 parents 1c1ec9c + f1d486a commit 6583294
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
4 changes: 2 additions & 2 deletions fs/xfs/linux-2.6/xfs_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
38 changes: 26 additions & 12 deletions fs/xfs/xfs_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down

0 comments on commit 6583294

Please sign in to comment.