xfs
[Top] [All Lists]

[PATCH] xfs: fix kbuild regression due to log recovery crc verification

To: xfs@xxxxxxxxxxx
Subject: [PATCH] xfs: fix kbuild regression due to log recovery crc verification
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Mon, 4 Jan 2016 10:52:55 -0500
Delivered-to: xfs@xxxxxxxxxxx
The auto kbuild infrastructure reports several failures on
non-standard arches (i386, sh, arm) due to a regression in the
recent log recovery crc verification (short write detection)
patches:

   fs/built-in.o: In function `xlog_find_tail':
>> xfs_log_recover.c:(.text+0x1c5db5): undefined reference to `__moddi3'
   xfs_log_recover.c:(.text+0x1c5e9d): undefined reference to `__moddi3'

This is due to the introduction of 64-bit modulus operations that
were 32-bit operations prior to the change. xlog_find_tail() used an
int to store the record header start block for the head of the log.
This was converted to an xfs_daddr_t as this is how the value is
represented in the callee functions that handle record
detection/verification, etc.

This was included as a minor cleanup as there wasn't an obvious
reason for using an int for this value in xlog_find_tail(). The
previously implicit cast was likely safe as this value represents a
log relative block number and the log can only be so big (2G). That
said, since all of the surrounding functionality uses xfs_daddr_t,
including the log buffer I/O helpers, update these calculations to
use do_mod() and handle the 64-bit modulus correctly regardless of
architecture.

Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx>
---

Compile tested with ARCH=i386 and spot tested with xfstests on x86-64.

Brian

 fs/xfs/xfs_log_recover.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 5bf8076..26e67b4 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -1330,12 +1330,13 @@ xlog_find_tail(
        } else {
                hblks = 1;
        }
-       after_umount_blk = (rhead_blk + hblks + (int)
-               BTOBB(be32_to_cpu(rhead->h_len))) % log->l_logBBsize;
+       after_umount_blk = rhead_blk + hblks + BTOBB(be32_to_cpu(rhead->h_len));
+       after_umount_blk = do_mod(after_umount_blk, log->l_logBBsize);
        tail_lsn = atomic64_read(&log->l_tail_lsn);
        if (*head_blk == after_umount_blk &&
            be32_to_cpu(rhead->h_num_logops) == 1) {
-               umount_data_blk = (rhead_blk + hblks) % log->l_logBBsize;
+               umount_data_blk = rhead_blk + hblks;
+               umount_data_blk = do_mod(umount_data_blk, log->l_logBBsize);
                error = xlog_bread(log, umount_data_blk, 1, bp, &offset);
                if (error)
                        goto done;
-- 
2.4.3

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] xfs: fix kbuild regression due to log recovery crc verification, Brian Foster <=