diff options
Diffstat (limited to 'fs/xfs/xfs_log.c')
| -rw-r--r-- | fs/xfs/xfs_log.c | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 25efa9b8a602..b612ce4520ae 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
| @@ -761,7 +761,7 @@ xfs_log_need_covered(xfs_mount_t *mp) | |||
| 761 | break; | 761 | break; |
| 762 | case XLOG_STATE_COVER_NEED: | 762 | case XLOG_STATE_COVER_NEED: |
| 763 | case XLOG_STATE_COVER_NEED2: | 763 | case XLOG_STATE_COVER_NEED2: |
| 764 | if (!xfs_trans_ail_tail(log->l_ailp) && | 764 | if (!xfs_ail_min_lsn(log->l_ailp) && |
| 765 | xlog_iclogs_empty(log)) { | 765 | xlog_iclogs_empty(log)) { |
| 766 | if (log->l_covered_state == XLOG_STATE_COVER_NEED) | 766 | if (log->l_covered_state == XLOG_STATE_COVER_NEED) |
| 767 | log->l_covered_state = XLOG_STATE_COVER_DONE; | 767 | log->l_covered_state = XLOG_STATE_COVER_DONE; |
| @@ -801,7 +801,7 @@ xlog_assign_tail_lsn( | |||
| 801 | xfs_lsn_t tail_lsn; | 801 | xfs_lsn_t tail_lsn; |
| 802 | struct log *log = mp->m_log; | 802 | struct log *log = mp->m_log; |
| 803 | 803 | ||
| 804 | tail_lsn = xfs_trans_ail_tail(mp->m_ail); | 804 | tail_lsn = xfs_ail_min_lsn(mp->m_ail); |
| 805 | if (!tail_lsn) | 805 | if (!tail_lsn) |
| 806 | tail_lsn = atomic64_read(&log->l_last_sync_lsn); | 806 | tail_lsn = atomic64_read(&log->l_last_sync_lsn); |
| 807 | 807 | ||
| @@ -1239,7 +1239,7 @@ xlog_grant_push_ail( | |||
| 1239 | * the filesystem is shutting down. | 1239 | * the filesystem is shutting down. |
| 1240 | */ | 1240 | */ |
| 1241 | if (!XLOG_FORCED_SHUTDOWN(log)) | 1241 | if (!XLOG_FORCED_SHUTDOWN(log)) |
| 1242 | xfs_trans_ail_push(log->l_ailp, threshold_lsn); | 1242 | xfs_ail_push(log->l_ailp, threshold_lsn); |
| 1243 | } | 1243 | } |
| 1244 | 1244 | ||
| 1245 | /* | 1245 | /* |
| @@ -3407,6 +3407,17 @@ xlog_verify_dest_ptr( | |||
| 3407 | xfs_emerg(log->l_mp, "%s: invalid ptr", __func__); | 3407 | xfs_emerg(log->l_mp, "%s: invalid ptr", __func__); |
| 3408 | } | 3408 | } |
| 3409 | 3409 | ||
| 3410 | /* | ||
| 3411 | * Check to make sure the grant write head didn't just over lap the tail. If | ||
| 3412 | * the cycles are the same, we can't be overlapping. Otherwise, make sure that | ||
| 3413 | * the cycles differ by exactly one and check the byte count. | ||
| 3414 | * | ||
| 3415 | * This check is run unlocked, so can give false positives. Rather than assert | ||
| 3416 | * on failures, use a warn-once flag and a panic tag to allow the admin to | ||
| 3417 | * determine if they want to panic the machine when such an error occurs. For | ||
| 3418 | * debug kernels this will have the same effect as using an assert but, unlinke | ||
| 3419 | * an assert, it can be turned off at runtime. | ||
| 3420 | */ | ||
| 3410 | STATIC void | 3421 | STATIC void |
| 3411 | xlog_verify_grant_tail( | 3422 | xlog_verify_grant_tail( |
| 3412 | struct log *log) | 3423 | struct log *log) |
| @@ -3414,17 +3425,22 @@ xlog_verify_grant_tail( | |||
| 3414 | int tail_cycle, tail_blocks; | 3425 | int tail_cycle, tail_blocks; |
| 3415 | int cycle, space; | 3426 | int cycle, space; |
| 3416 | 3427 | ||
| 3417 | /* | ||
| 3418 | * Check to make sure the grant write head didn't just over lap the | ||
| 3419 | * tail. If the cycles are the same, we can't be overlapping. | ||
| 3420 | * Otherwise, make sure that the cycles differ by exactly one and | ||
| 3421 | * check the byte count. | ||
| 3422 | */ | ||
| 3423 | xlog_crack_grant_head(&log->l_grant_write_head, &cycle, &space); | 3428 | xlog_crack_grant_head(&log->l_grant_write_head, &cycle, &space); |
| 3424 | xlog_crack_atomic_lsn(&log->l_tail_lsn, &tail_cycle, &tail_blocks); | 3429 | xlog_crack_atomic_lsn(&log->l_tail_lsn, &tail_cycle, &tail_blocks); |
| 3425 | if (tail_cycle != cycle) { | 3430 | if (tail_cycle != cycle) { |
| 3426 | ASSERT(cycle - 1 == tail_cycle); | 3431 | if (cycle - 1 != tail_cycle && |
| 3427 | ASSERT(space <= BBTOB(tail_blocks)); | 3432 | !(log->l_flags & XLOG_TAIL_WARN)) { |
| 3433 | xfs_alert_tag(log->l_mp, XFS_PTAG_LOGRES, | ||
| 3434 | "%s: cycle - 1 != tail_cycle", __func__); | ||
| 3435 | log->l_flags |= XLOG_TAIL_WARN; | ||
| 3436 | } | ||
| 3437 | |||
| 3438 | if (space > BBTOB(tail_blocks) && | ||
| 3439 | !(log->l_flags & XLOG_TAIL_WARN)) { | ||
| 3440 | xfs_alert_tag(log->l_mp, XFS_PTAG_LOGRES, | ||
| 3441 | "%s: space > BBTOB(tail_blocks)", __func__); | ||
| 3442 | log->l_flags |= XLOG_TAIL_WARN; | ||
| 3443 | } | ||
| 3428 | } | 3444 | } |
| 3429 | } | 3445 | } |
| 3430 | 3446 | ||
