Skip to contentSkip to conversation

xfs: fix kbuild regression due to log recovery crc verification

PATCH New Brian Foster 1 participant 1 message Jan 4, 2016 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: fix kbuild regression due to log recovery crc verification

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':

Quoted 1 line
Quoted 1 line

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.

---

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(-)
fs/xfs/xfs_log_recover.c +4 -3
index 5bf8076..26e67b4 100644
@@ -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;
Signature · 6 lines
2.4.3

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs