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

+28 -14
+2 -2
fs/xfs/linux-2.6/xfs_sync.c
··· 820 820 * call into reclaim to find it in a clean state instead of waiting for 821 821 * it now. We also don't return errors here - if the error is transient 822 822 * then the next reclaim pass will flush the inode, and if the error 823 - * is permanent then the next sync reclaim will relcaim the inode and 823 + * is permanent then the next sync reclaim will reclaim the inode and 824 824 * pass on the error. 825 825 */ 826 - if (error && !XFS_FORCED_SHUTDOWN(ip->i_mount)) { 826 + if (error && error != EAGAIN && !XFS_FORCED_SHUTDOWN(ip->i_mount)) { 827 827 xfs_fs_cmn_err(CE_WARN, ip->i_mount, 828 828 "inode 0x%llx background reclaim flush failed with %d", 829 829 (long long)ip->i_ino, error);
+26 -12
fs/xfs/xfs_log.c
··· 745 745 746 746 /* 747 747 * Determine if we have a transaction that has gone to disk 748 - * that needs to be covered. Log activity needs to be idle (no AIL and 749 - * nothing in the iclogs). And, we need to be in the right state indicating 750 - * something has gone out. 748 + * that needs to be covered. To begin the transition to the idle state 749 + * firstly the log needs to be idle (no AIL and nothing in the iclogs). 750 + * If we are then in a state where covering is needed, the caller is informed 751 + * that dummy transactions are required to move the log into the idle state. 752 + * 753 + * Because this is called as part of the sync process, we should also indicate 754 + * that dummy transactions should be issued in anything but the covered or 755 + * idle states. This ensures that the log tail is accurately reflected in 756 + * the log at the end of the sync, hence if a crash occurrs avoids replay 757 + * of transactions where the metadata is already on disk. 751 758 */ 752 759 int 753 760 xfs_log_need_covered(xfs_mount_t *mp) ··· 766 759 return 0; 767 760 768 761 spin_lock(&log->l_icloglock); 769 - if (((log->l_covered_state == XLOG_STATE_COVER_NEED) || 770 - (log->l_covered_state == XLOG_STATE_COVER_NEED2)) 771 - && !xfs_trans_ail_tail(log->l_ailp) 772 - && xlog_iclogs_empty(log)) { 773 - if (log->l_covered_state == XLOG_STATE_COVER_NEED) 774 - log->l_covered_state = XLOG_STATE_COVER_DONE; 775 - else { 776 - ASSERT(log->l_covered_state == XLOG_STATE_COVER_NEED2); 777 - log->l_covered_state = XLOG_STATE_COVER_DONE2; 762 + switch (log->l_covered_state) { 763 + case XLOG_STATE_COVER_DONE: 764 + case XLOG_STATE_COVER_DONE2: 765 + case XLOG_STATE_COVER_IDLE: 766 + break; 767 + case XLOG_STATE_COVER_NEED: 768 + case XLOG_STATE_COVER_NEED2: 769 + if (!xfs_trans_ail_tail(log->l_ailp) && 770 + xlog_iclogs_empty(log)) { 771 + if (log->l_covered_state == XLOG_STATE_COVER_NEED) 772 + log->l_covered_state = XLOG_STATE_COVER_DONE; 773 + else 774 + log->l_covered_state = XLOG_STATE_COVER_DONE2; 778 775 } 776 + /* FALLTHRU */ 777 + default: 779 778 needed = 1; 779 + break; 780 780 } 781 781 spin_unlock(&log->l_icloglock); 782 782 return needed;