Skip to contentSkip to conversation

xfs: fix endianness error when checking log block crc on big endian platforms

PATCH Superseded Darrick J. Wong 2 participants 2 messages Jan 26, 2016 XFS filesystem

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: fix endianness error when checking log block crc on big endian platforms

Since the checksum function and the field are both __le32, don't perform endian conversion when comparing the two. This fixes mount failures on ppc64 in 4.5-rc1.

---
 fs/xfs/xfs_log_recover.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_log_recover.c +1 -1
index ac80f39..52dd946 100644
@@ -4502,7 +4502,7 @@ xlog_recover_process(
 	 * know precisely what failed.
 	 */
 	if (pass == XLOG_RECOVER_CRCPASS) {
-		if (rhead->h_crc && crc != le32_to_cpu(rhead->h_crc))
+		if (rhead->h_crc && crc != rhead->h_crc)
 			return -EFSBADCRC;
 		return 0;
 	}

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

#1 lore raw
Quoted 6 lines · Darrick J. Wong

Since the checksum function and the field are both __le32, don't perform endian conversion when comparing the two. This fixes mount failures on ppc64 in 4.5-rc1.

---

So somehow this first got munged in commit:

b94fb2d1 xfs: refactor and open code log record crc check

... which was intended to only be a refactoring patch. Instead, it removes the following line:

- if (crc != rhead->h_crc) {

... and replaces it with:

+ if (crc != le32_to_cpu(rhead->h_crc)) {

No idea how that happened. Maybe I was just looking at the log message code and had a thinko. Anyways, it was followed up with commit:

6528250b xfs: support a crc verification only log record pass

... which adds the code you've fixed here and probably just copied the busted check.

Quoted 8 lines
 fs/xfs/xfs_log_recover.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_log_recover.c +0 -0
index ac80f39..52dd946 100644

fs/xfs/xfs_log_recover.c xlog_recover_process( · line 4508

Quoted 8 lines
fs/xfs/xfs_log_recover.c +1 -1
@@ -4502,7 +4502,7 @@ xlog_recover_process(
 	 * know precisely what failed.
 	 */
 	if (pass == XLOG_RECOVER_CRCPASS) {
-		if (rhead->h_crc && crc != le32_to_cpu(rhead->h_crc))
+		if (rhead->h_crc && crc != rhead->h_crc)
 			return -EFSBADCRC;
 		return 0;
 	}

There's another check a few lines after this that is also broken, based on the first commit referenced above. Do you want me to send a v2 patch or would you like to? I'll run some ppc64 testing either way...

Brian

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