Message ID | 20140501231302.31890.45397.stgit@birch.djwong.org |
---|---|
State | Superseded, archived |
Headers | show |
On Thu, 1 May 2014, Darrick J. Wong wrote: > Date: Thu, 01 May 2014 16:13:02 -0700 > From: Darrick J. Wong <darrick.wong@oracle.com> > To: tytso@mit.edu, darrick.wong@oracle.com > Cc: linux-ext4@vger.kernel.org > Subject: [PATCH 06/37] debugfs: force logdump to display (old) journal > contents > > If the user passes -a more than once to logdump, try to dump old log > contents. This can be used to try to track down journal problems even > after recovery. You need to update man page as well for this. Also I wonder what's the behaviour if '-a' and '-b' or '-c' are specified simultaneously and '-a' is specified multiple times ? Thanks! -Lukas > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > debugfs/logdump.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > > diff --git a/debugfs/logdump.c b/debugfs/logdump.c > index 8b9dc5b..bf4bef5 100644 > --- a/debugfs/logdump.c > +++ b/debugfs/logdump.c > @@ -393,9 +393,13 @@ static void dump_journal(char *cmdname, FILE *out_file, > fprintf(out_file, "Journal starts at block %u, transaction %u\n", > blocknr, transaction); > > - if (!blocknr) > + if (!blocknr) { > /* Empty journal, nothing to do. */ > - return; > + if (dump_all < 2) > + return; > + else > + blocknr = 1; > + } > > while (1) { > retval = read_journal_block(cmdname, source, > @@ -420,7 +424,8 @@ static void dump_journal(char *cmdname, FILE *out_file, > fprintf (out_file, "Found sequence %u (not %u) at " > "block %u: end of journal.\n", > sequence, transaction, blocknr); > - return; > + if (dump_all < 2) > + return; > } > > if (dump_descriptors) { > > -- > 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 > -- 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
On Fri, May 02, 2014 at 01:49:37PM +0200, Lukáš Czerner wrote: > On Thu, 1 May 2014, Darrick J. Wong wrote: > > > Date: Thu, 01 May 2014 16:13:02 -0700 > > From: Darrick J. Wong <darrick.wong@oracle.com> > > To: tytso@mit.edu, darrick.wong@oracle.com > > Cc: linux-ext4@vger.kernel.org > > Subject: [PATCH 06/37] debugfs: force logdump to display (old) journal > > contents > > > > If the user passes -a more than once to logdump, try to dump old log > > contents. This can be used to try to track down journal problems even > > after recovery. > > You need to update man page as well for this. Also I wonder what's > the behaviour if '-a' and '-b' or '-c' are specified simultaneously > and '-a' is specified multiple times ? I'll update the manpage. -c seems to hexdump the contents of any block that we find while iterating the journal. -b would seem to allow you to dump an arbitrary block #, but I could never get it to do that. In any case, specifying -a even once will make logdump dump every block and ignore -b. --D > > Thanks! > -Lukas > > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > > --- > > debugfs/logdump.c | 11 ++++++++--- > > 1 file changed, 8 insertions(+), 3 deletions(-) > > > > > > diff --git a/debugfs/logdump.c b/debugfs/logdump.c > > index 8b9dc5b..bf4bef5 100644 > > --- a/debugfs/logdump.c > > +++ b/debugfs/logdump.c > > @@ -393,9 +393,13 @@ static void dump_journal(char *cmdname, FILE *out_file, > > fprintf(out_file, "Journal starts at block %u, transaction %u\n", > > blocknr, transaction); > > > > - if (!blocknr) > > + if (!blocknr) { > > /* Empty journal, nothing to do. */ > > - return; > > + if (dump_all < 2) > > + return; > > + else > > + blocknr = 1; > > + } > > > > while (1) { > > retval = read_journal_block(cmdname, source, > > @@ -420,7 +424,8 @@ static void dump_journal(char *cmdname, FILE *out_file, > > fprintf (out_file, "Found sequence %u (not %u) at " > > "block %u: end of journal.\n", > > sequence, transaction, blocknr); > > - return; > > + if (dump_all < 2) > > + return; > > } > > > > if (dump_descriptors) { > > > > -- > > 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 > > > -- > 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 -- 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
On Mon, May 05, 2014 at 05:24:53PM -0700, Darrick J. Wong wrote: > I'll update the manpage. -c seems to hexdump the contents of any block that we > find while iterating the journal. -b would seem to allow you to dump an > arbitrary block #, but I could never get it to do that. It's used to dump information _about_ an arbitrary block. Here's an example of some of the cool things you can do with logdump: <tytso@closure> {/usr/projects/e2fsprogs/e2fsprogs} (next) 1742% gunzip < tests/f_jnl_32bit/image.gz > /tmp/image <tytso@closure> {/usr/projects/e2fsprogs/e2fsprogs} (next) 1743% debugfs /tmp/image debugfs 1.42.9 (4-Feb-2014) debugfs: logdump -b 680 Journal starts at block 1, transaction 2 FS block 66 logged at sequence 3, journal block 8 (flags 0x2) (block bitmap for block 680: block is SET) FS block 680 logged at sequence 3, journal block 205 (flags 0x2) FS block 66 logged at sequence 4, journal block 231 (flags 0x2) (block bitmap for block 680: block is SET) FS block 680 logged at sequence 4, journal block 234 (flags 0x2) FS block 66 logged at sequence 5, journal block 339 (flags 0x2) (block bitmap for block 680: block is SET) FS block 680 logged at sequence 5, journal block 450 (flags 0x2) No magic number at block 464: end of journal. debugfs: icheck 680 Block Inode number 680 2132 debugfs: logdump -i <2132> Inode 2132 is at group 1, block 364, offset 384 Journal starts at block 1, transaction 2 FS block 364 logged at sequence 3, journal block 197 (flags 0x2) (inode block for inode 2132): Inode: 2132 Type: directory Mode: 0755 Flags: 0x80000 Generation: 3167953082 Version: 0x00000008 User: 0 Group: 0 Size: 1024 File ACL: 0 Directory ACL: 0 Links: 9 Blockcount: 2 Fragment: Address: 0 Number: 0 Size: 0 ctime: 0x4fa1639e -- Wed May 2 12:41:02 2012 atime: 0x4fa1639e -- Wed May 2 12:41:02 2012 mtime: 0x4fa1639e -- Wed May 2 12:41:02 2012 Blocks: (0+1): 127754 (1+1): 4 (5+1): 680 FS block 364 logged at sequence 4, journal block 233 (flags 0x2) (inode block for inode 2132): Inode: 2132 Type: directory Mode: 0755 Flags: 0x80000 Generation: 3167953082 Version: 0x0000000c User: 0 Group: 0 Size: 1024 File ACL: 0 Directory ACL: 0 Links: 13 Blockcount: 2 Fragment: Address: 0 Number: 0 Size: 0 ctime: 0x4fa1639e -- Wed May 2 12:41:02 2012 atime: 0x4fa1639e -- Wed May 2 12:41:02 2012 mtime: 0x4fa1639e -- Wed May 2 12:41:02 2012 Blocks: (0+1): 127754 (1+1): 4 (5+1): 680 FS block 364 logged at sequence 5, journal block 434 (flags 0x2) (inode block for inode 2132): Inode: 2132 Type: directory Mode: 0755 Flags: 0x80000 Generation: 3167953082 Version: 0x00000015 User: 0 Group: 0 Size: 1024 File ACL: 0 Directory ACL: 0 Links: 4 Blockcount: 2 Fragment: Address: 0 Number: 0 Size: 0 ctime: 0x4fa163a7 -- Wed May 2 12:41:11 2012 atime: 0x4fa163a7 -- Wed May 2 12:41:11 2012 mtime: 0x4fa163a7 -- Wed May 2 12:41:11 2012 Blocks: (0+1): 127754 (1+1): 4 (5+1): 680 No magic number at block 464: end of journal. debugfs: quit The idea is that this can be useful when debugging a potentially corrupted journal, or for advanced file system recovery. Note that logdump -c is most useful in combination with -b, for example: "logdump -b 680 -c". - 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
On Sun, May 11, 2014 at 09:41:19PM -0400, Theodore Ts'o wrote: > On Mon, May 05, 2014 at 05:24:53PM -0700, Darrick J. Wong wrote: > > I'll update the manpage. -c seems to hexdump the contents of any block that we > > find while iterating the journal. -b would seem to allow you to dump an > > arbitrary block #, but I could never get it to do that. > > It's used to dump information _about_ an arbitrary block. Here's an > example of some of the cool things you can do with logdump: Oh, -b is for FS physical blocks, not for logical blocks in the journal itself, I get it! Thanks for pointing that out! :) The patch (in the other email) looks fine. --D > > <tytso@closure> {/usr/projects/e2fsprogs/e2fsprogs} (next) > 1742% gunzip < tests/f_jnl_32bit/image.gz > /tmp/image > <tytso@closure> {/usr/projects/e2fsprogs/e2fsprogs} (next) > 1743% debugfs /tmp/image > debugfs 1.42.9 (4-Feb-2014) > debugfs: logdump -b 680 > Journal starts at block 1, transaction 2 > FS block 66 logged at sequence 3, journal block 8 (flags 0x2) > (block bitmap for block 680: block is SET) > FS block 680 logged at sequence 3, journal block 205 (flags 0x2) > FS block 66 logged at sequence 4, journal block 231 (flags 0x2) > (block bitmap for block 680: block is SET) > FS block 680 logged at sequence 4, journal block 234 (flags 0x2) > FS block 66 logged at sequence 5, journal block 339 (flags 0x2) > (block bitmap for block 680: block is SET) > FS block 680 logged at sequence 5, journal block 450 (flags 0x2) > No magic number at block 464: end of journal. > debugfs: icheck 680 > Block Inode number > 680 2132 > debugfs: logdump -i <2132> > Inode 2132 is at group 1, block 364, offset 384 > Journal starts at block 1, transaction 2 > FS block 364 logged at sequence 3, journal block 197 (flags 0x2) > (inode block for inode 2132): > Inode: 2132 Type: directory Mode: 0755 Flags: 0x80000 > Generation: 3167953082 Version: 0x00000008 > User: 0 Group: 0 Size: 1024 > File ACL: 0 Directory ACL: 0 > Links: 9 Blockcount: 2 > Fragment: Address: 0 Number: 0 Size: 0 > ctime: 0x4fa1639e -- Wed May 2 12:41:02 2012 > atime: 0x4fa1639e -- Wed May 2 12:41:02 2012 > mtime: 0x4fa1639e -- Wed May 2 12:41:02 2012 > Blocks: (0+1): 127754 (1+1): 4 (5+1): 680 > FS block 364 logged at sequence 4, journal block 233 (flags 0x2) > (inode block for inode 2132): > Inode: 2132 Type: directory Mode: 0755 Flags: 0x80000 > Generation: 3167953082 Version: 0x0000000c > User: 0 Group: 0 Size: 1024 > File ACL: 0 Directory ACL: 0 > Links: 13 Blockcount: 2 > Fragment: Address: 0 Number: 0 Size: 0 > ctime: 0x4fa1639e -- Wed May 2 12:41:02 2012 > atime: 0x4fa1639e -- Wed May 2 12:41:02 2012 > mtime: 0x4fa1639e -- Wed May 2 12:41:02 2012 > Blocks: (0+1): 127754 (1+1): 4 (5+1): 680 > FS block 364 logged at sequence 5, journal block 434 (flags 0x2) > (inode block for inode 2132): > Inode: 2132 Type: directory Mode: 0755 Flags: 0x80000 > Generation: 3167953082 Version: 0x00000015 > User: 0 Group: 0 Size: 1024 > File ACL: 0 Directory ACL: 0 > Links: 4 Blockcount: 2 > Fragment: Address: 0 Number: 0 Size: 0 > ctime: 0x4fa163a7 -- Wed May 2 12:41:11 2012 > atime: 0x4fa163a7 -- Wed May 2 12:41:11 2012 > mtime: 0x4fa163a7 -- Wed May 2 12:41:11 2012 > Blocks: (0+1): 127754 (1+1): 4 (5+1): 680 > No magic number at block 464: end of journal. > debugfs: quit > > The idea is that this can be useful when debugging a potentially > corrupted journal, or for advanced file system recovery. > > Note that logdump -c is most useful in combination with -b, for > example: "logdump -b 680 -c". > > - 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
diff --git a/debugfs/logdump.c b/debugfs/logdump.c index 8b9dc5b..bf4bef5 100644 --- a/debugfs/logdump.c +++ b/debugfs/logdump.c @@ -393,9 +393,13 @@ static void dump_journal(char *cmdname, FILE *out_file, fprintf(out_file, "Journal starts at block %u, transaction %u\n", blocknr, transaction); - if (!blocknr) + if (!blocknr) { /* Empty journal, nothing to do. */ - return; + if (dump_all < 2) + return; + else + blocknr = 1; + } while (1) { retval = read_journal_block(cmdname, source, @@ -420,7 +424,8 @@ static void dump_journal(char *cmdname, FILE *out_file, fprintf (out_file, "Found sequence %u (not %u) at " "block %u: end of journal.\n", sequence, transaction, blocknr); - return; + if (dump_all < 2) + return; } if (dump_descriptors) {
If the user passes -a more than once to logdump, try to dump old log contents. This can be used to try to track down journal problems even after recovery. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- debugfs/logdump.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) -- 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