Patchwork e2undo: cast dptr to blk64_t to retrieve block number

login
register
mail settings
Submitter Eric Sandeen
Date Nov. 16, 2011, 11:34 p.m.
Message ID <4EC44889.7050307@redhat.com>
Download mbox | patch
Permalink /patch/126060/
State Accepted
Headers show

Comments

Eric Sandeen - Nov. 16, 2011, 11:34 p.m.
A 32-bit s390 build was failing on a 64-bit s390x host, when
make check failed e2undo tests, like this:

md5sum before mke2fs 922c8a591c882dbdd1a381d18547cfd5
using mke2fs to test e2undo
Overwriting existing filesystem; this can be undone using the command:
    e2undo /tmp/mke2fs-tmp.EM9XjmTA81.e2undo /tmp/tmp.EM9XjmTA81

md5sum after mke2fs cbf32fb6c3db45280ad013f42ac294f1
Replayed transaction of size 32768 at location 0
Replayed transaction of size 32768 at location 0
Replayed transaction of size 32768 at location 0
Replayed transaction of size 32768 at location 0
Replayed transaction of size 0 at location 0
md5sum after e2undo 31b4e14307c5b7ccce5b8d300c2ad5f1

Note the "at location 0" for the block number.

A proper cast in e2undo.c fixes this up.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

We should have a bingo game for the rest of the unsigned longs that
are surely lurking around ;)



--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o - Nov. 18, 2011, 10:45 p.m.
On Wed, Nov 16, 2011 at 05:34:33PM -0600, Eric Sandeen wrote:
> A 32-bit s390 build was failing on a 64-bit s390x host, when
> make check failed e2undo tests, like this:
> 
> md5sum before mke2fs 922c8a591c882dbdd1a381d18547cfd5
> using mke2fs to test e2undo
> Overwriting existing filesystem; this can be undone using the command:
>     e2undo /tmp/mke2fs-tmp.EM9XjmTA81.e2undo /tmp/tmp.EM9XjmTA81
> 
> md5sum after mke2fs cbf32fb6c3db45280ad013f42ac294f1
> Replayed transaction of size 32768 at location 0
> Replayed transaction of size 32768 at location 0
> Replayed transaction of size 32768 at location 0
> Replayed transaction of size 32768 at location 0
> Replayed transaction of size 0 at location 0
> md5sum after e2undo 31b4e14307c5b7ccce5b8d300c2ad5f1
> 
> Note the "at location 0" for the block number.
> 
> A proper cast in e2undo.c fixes this up.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Thanks, applied.

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/misc/e2undo.c b/misc/e2undo.c
index f97ddc2..b1cb750 100644
--- a/misc/e2undo.c
+++ b/misc/e2undo.c
@@ -206,7 +206,7 @@  int main(int argc, char *argv[])
 				_("Failed tdb_fetch %s\n"), tdb_errorstr(tdb));
 			exit(1);
 		}
-		blk_num = *(unsigned long *)key.dptr;
+		blk_num = *(blk64_t *)key.dptr;
 		printf(_("Replayed transaction of size %zd at location %llu\n"),
 							data.dsize, blk_num);
 		retval = io_channel_write_blk64(channel, blk_num,