xfs: convert log tail checking to a warning

On the Power platform, the log tail debug checks fire excessively
causing the system to panic early in testing. The debug checks are
known to be racy, though on x86_64 there is no evidence that they
trigger at all.

We want to keep the checks active on debug systems to alert us to
problems with log space accounting, but we need to reduce the impact
of a racy check on testing on the Power platform.

As a result, convert the ASSERT conditions to warnings, and
allow them to fire only once per filesystem mount. This will prevent
false positives from interfering with testing, whilst still
providing us with the indication that they may be a problem with log
space accounting should that occur.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>

authored by Dave Chinner and committed by Dave Chinner da8a1a4a be65b18a

+25 -8
+24 -8
fs/xfs/xfs_log.c
··· 3407 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 3421 STATIC void 3411 3422 xlog_verify_grant_tail( 3412 3423 struct log *log) ··· 3425 3414 int tail_cycle, tail_blocks; 3426 3415 int cycle, space; 3427 3416 3428 - /* 3429 - * Check to make sure the grant write head didn't just over lap the 3430 - * tail. If the cycles are the same, we can't be overlapping. 3431 - * Otherwise, make sure that the cycles differ by exactly one and 3432 - * check the byte count. 3433 - */ 3434 3417 xlog_crack_grant_head(&log->l_grant_write_head, &cycle, &space); 3435 3418 xlog_crack_atomic_lsn(&log->l_tail_lsn, &tail_cycle, &tail_blocks); 3436 3419 if (tail_cycle != cycle) { 3437 - ASSERT(cycle - 1 == tail_cycle); 3438 - ASSERT(space <= BBTOB(tail_blocks)); 3420 + if (cycle - 1 != tail_cycle && 3421 + !(log->l_flags & XLOG_TAIL_WARN)) { 3422 + xfs_alert_tag(log->l_mp, XFS_PTAG_LOGRES, 3423 + "%s: cycle - 1 != tail_cycle", __func__); 3424 + log->l_flags |= XLOG_TAIL_WARN; 3425 + } 3426 + 3427 + if (space > BBTOB(tail_blocks) && 3428 + !(log->l_flags & XLOG_TAIL_WARN)) { 3429 + xfs_alert_tag(log->l_mp, XFS_PTAG_LOGRES, 3430 + "%s: space > BBTOB(tail_blocks)", __func__); 3431 + log->l_flags |= XLOG_TAIL_WARN; 3432 + } 3439 3433 } 3440 3434 } 3441 3435
+1
fs/xfs/xfs_log_priv.h
··· 144 144 #define XLOG_RECOVERY_NEEDED 0x4 /* log was recovered */ 145 145 #define XLOG_IO_ERROR 0x8 /* log hit an I/O error, and being 146 146 shutdown */ 147 + #define XLOG_TAIL_WARN 0x10 /* log tail verify warning issued */ 147 148 148 149 #ifdef __KERNEL__ 149 150 /*