From: Michael Meffie Date: Fri, 6 Jul 2018 19:22:36 +0000 (-0400) Subject: vldb_check: write mh entry header flags in network order X-Git-Tag: openafs-devel-1_9_0~510 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=483cad0121d848836b4155817b86231ef21be27a;hp=7523397333c0f8c6a08312434968d84b8ff56306 vldb_check: write mh entry header flags in network order Commit 6b93ad695e53a86dbe9eea13bd0ff651e1d8c9b7 fixed a false error reported when the vldb contained more than one mh extent blocks. That fix changed the readMH() function to convert the flags field to host byte order of all the mh blocks, not just the first block, in order to check the value of those flags. Unfortunately, that commit missed converting non-zero blocks back to network byte order in the complementary writeMH() function, which is used to write the data back to disk when vldb_check is run with the -fix option. FIXES 134589 Change-Id: I4cdbd57b3336e78a9eb1e543ee6d09b33f5e6153 Reviewed-on: https://gerrit.openafs.org/13245 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- diff --git a/src/vlserver/vldb_check.c b/src/vlserver/vldb_check.c index ed857f9..5e454d2 100644 --- a/src/vlserver/vldb_check.c +++ b/src/vlserver/vldb_check.c @@ -479,9 +479,13 @@ writeMH(afs_int32 addr, int block, struct extentaddr *mhblockP) if (verbose) { quiet_println("Writing back MH block % at addr %u\n", block, addr); } + mhblockP->ex_hdrflags = htonl(mhblockP->ex_hdrflags); if (block == 0) { + /* + * These header fields are only used in the first mh block, so were + * converted to host byte order only when the first mh block was read. + */ mhblockP->ex_count = htonl(mhblockP->ex_count); - mhblockP->ex_hdrflags = htonl(mhblockP->ex_hdrflags); for (i = 0; i < VL_MAX_ADDREXTBLKS; i++) { mhblockP->ex_contaddrs[i] = htonl(mhblockP->ex_contaddrs[i]); }