public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs_repair: print superblock offsets and denial reasons
@ 2008-10-22 18:36 KELEMEN Peter
  2008-10-22 23:41 ` [PATCH V2] xfs_repair: print superblock offsets and why they can't be verified KELEMEN Peter
  0 siblings, 1 reply; 5+ messages in thread
From: KELEMEN Peter @ 2008-10-22 18:36 UTC (permalink / raw)
  To: xfs

Example output (without the scanning dots):

Phase 1 - find and verify superblock.
bad primary superblock - bad magic number !!!

attempting to find secondary superblock...
found candidate secondary superblock...
offset: 62498275328
reason: 16
unable to verify superblock, continuing...
found candidate secondary superblock...
offset: 156246212608
reason: 16
unable to verify superblock, continuing...
found candidate secondary superblock...
offset: 249994149888
reason: 16
unable to verify superblock, continuing...
found candidate secondary superblock...
offset: 343742087168
reason: 16
unable to verify superblock, continuing...
found candidate secondary superblock...
offset: 437490024448
reason: 16
unable to verify superblock, continuing...
found candidate secondary superblock...
offset: 531237961728
reason: 16
unable to verify superblock, continuing...
found candidate secondary superblock...
offset: 624985899008
reason: 16
unable to verify superblock, continuing...
found candidate secondary superblock...
offset: 718733836288
reason: 16
unable to verify superblock, continuing...
found candidate secondary superblock...
offset: 812481773568
reason: 16
unable to verify superblock, continuing...
found candidate secondary superblock...
offset: 906229710848
reason: 16
unable to verify superblock, continuing...
Sorry, could not find valid secondary superblock
Exiting now.

Signed-off-by: KELEMEN Peter <Peter.Kelemen@cern.ch>

Index: xfsprogs/repair/sb.c
===================================================================
RCS file: /cvs/xfs-cmds/xfsprogs/repair/sb.c,v
retrieving revision 1.22
diff -u -r1.22 sb.c
--- xfsprogs/repair/sb.c	8 Sep 2008 06:18:43 -0000	1.22
+++ xfsprogs/repair/sb.c	22 Oct 2008 18:13:26 -0000
@@ -96,6 +96,7 @@
 	int		dirty;
 	int		retval;
 	int		bsize;
+	int		reason;		/* why sb cannot be verified */
 
 	do_warn(_("\nattempting to find secondary superblock...\n"));
 
@@ -140,6 +141,7 @@
 				continue;
 
 			do_warn(_("found candidate secondary superblock...\n"));
+			do_warn("offset: %Lu\n", off);
 
 			/*
 			 * found one.  now verify it by looking
@@ -149,12 +151,13 @@
 			rsb->sb_inprogress = 0;
 			clear_sunit = 1;
 
-			if (verify_set_primary_sb(rsb, 0, &dirty) == XR_OK)  {
+			if ((reason = verify_set_primary_sb(rsb, 0, &dirty)) == XR_OK)  {
 				do_warn(
 			_("verified secondary superblock...\n"));
 				done = 1;
 				retval = 1;
 			} else  {
+				do_warn("reason: %d\n", reason);
 				do_warn(
 			_("unable to verify superblock, continuing...\n"));
 			}

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH V2] xfs_repair: print superblock offsets and why they can't be verified
  2008-10-22 18:36 [PATCH] xfs_repair: print superblock offsets and denial reasons KELEMEN Peter
@ 2008-10-22 23:41 ` KELEMEN Peter
  2008-10-23 13:53   ` Eric Sandeen
  0 siblings, 1 reply; 5+ messages in thread
From: KELEMEN Peter @ 2008-10-22 23:41 UTC (permalink / raw)
  To: xfs

Eric has pointed out that verify_set_primary_sb() will either
return 1 or XR_INSUFF_SEC_SB.  Move the check lower into
verify_set_primary_sb() by checking the return value of
verify_sb().  Example output:

found candidate secondary superblock...
verifying sb at 31249334272: bad magic number (1)
verifying sb at 62498668544: bad magic number (1)
verifying sb at 93748002816: bad magic number (1)
verifying sb at 124997337088: bad magic number (1)
unable to verify superblock, continuing...


Signed-off-by: KELEMEN Peter <Peter.Kelemen@cern.ch>

Index: xfsprogs/repair/sb.c
===================================================================
RCS file: /cvs/xfs-cmds/xfsprogs/repair/sb.c,v
retrieving revision 1.22
diff -u -u -r1.22 sb.c
--- xfsprogs/repair/sb.c	8 Sep 2008 06:18:43 -0000	1.22
+++ xfsprogs/repair/sb.c	22 Oct 2008 23:17:27 -0000
@@ -683,6 +683,7 @@
 	int		num_ok;
 	int		retval;
 	int		round;
+	int		reason;	/* why the sb check failed */
 
 	/*
 	 * select the number of secondaries to try for
@@ -727,7 +728,7 @@
 				goto out;
 			}
 
-			if (verify_sb(sb, 0) == XR_OK)  {
+			if ((reason = verify_sb(sb, 0)) == XR_OK)  {
 				/*
 				 * save away geometry info.
 				 * don't bother checking the sb
@@ -740,6 +741,9 @@
 				get_sb_geometry(&geo, sb);
 				list = add_geo(list, &geo, agno);
 				num_ok++;
+			} else {
+				do_warn("verifying sb at %Lu: %s (%d)\n",
+					off, err_string(reason), reason);
 			}
 		}
 	}

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH V2] xfs_repair: print superblock offsets and why they can't be verified
  2008-10-22 23:41 ` [PATCH V2] xfs_repair: print superblock offsets and why they can't be verified KELEMEN Peter
@ 2008-10-23 13:53   ` Eric Sandeen
  2008-10-23 14:24     ` Eric Sandeen
  2008-11-21  1:03     ` Barry Naujok
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Sandeen @ 2008-10-23 13:53 UTC (permalink / raw)
  To: xfs

KELEMEN Peter wrote:
> Eric has pointed out that verify_set_primary_sb() will either
> return 1 or XR_INSUFF_SEC_SB.  Move the check lower into
> verify_set_primary_sb() by checking the return value of
> verify_sb().  Example output:
> 
> found candidate secondary superblock...
> verifying sb at 31249334272: bad magic number (1)
> verifying sb at 62498668544: bad magic number (1)
> verifying sb at 93748002816: bad magic number (1)
> verifying sb at 124997337088: bad magic number (1)
> unable to verify superblock, continuing...
> 

This looks better :)  You may want to add even more info...

while it's just searching block by block, if it finds a candidate, I'd
print the sector offset for that candidate (your first output line).

And rather than "verifying sb at..." you might do something like
"comparing to sb N at offset X":

+	} else {
+		do_warn("comparing with sb %d at sector %Lu failed: %s (%d)\n",
+			agno, off, err_string(reason), reason);

because at this point it's using the geometry of the candidate sb to see
if it can be used to find enough other valid sb's....

-Eric


> Signed-off-by: KELEMEN Peter <Peter.Kelemen@cern.ch>
> 
> Index: xfsprogs/repair/sb.c
> ===================================================================
> RCS file: /cvs/xfs-cmds/xfsprogs/repair/sb.c,v
> retrieving revision 1.22
> diff -u -u -r1.22 sb.c
> --- xfsprogs/repair/sb.c	8 Sep 2008 06:18:43 -0000	1.22
> +++ xfsprogs/repair/sb.c	22 Oct 2008 23:17:27 -0000
> @@ -683,6 +683,7 @@
>  	int		num_ok;
>  	int		retval;
>  	int		round;
> +	int		reason;	/* why the sb check failed */
>  
>  	/*
>  	 * select the number of secondaries to try for
> @@ -727,7 +728,7 @@
>  				goto out;
>  			}
>  
> -			if (verify_sb(sb, 0) == XR_OK)  {
> +			if ((reason = verify_sb(sb, 0)) == XR_OK)  {
>  				/*
>  				 * save away geometry info.
>  				 * don't bother checking the sb
> @@ -740,6 +741,9 @@
>  				get_sb_geometry(&geo, sb);
>  				list = add_geo(list, &geo, agno);
>  				num_ok++;
> +			} else {
> +				do_warn("verifying sb at %Lu: %s (%d)\n",
> +					off, err_string(reason), reason);
>  			}
>  		}
>  	}
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH V2] xfs_repair: print superblock offsets and why they can't be verified
  2008-10-23 13:53   ` Eric Sandeen
@ 2008-10-23 14:24     ` Eric Sandeen
  2008-11-21  1:03     ` Barry Naujok
  1 sibling, 0 replies; 5+ messages in thread
From: Eric Sandeen @ 2008-10-23 14:24 UTC (permalink / raw)
  To: xfs

Eric Sandeen wrote:
> KELEMEN Peter wrote:
>> Eric has pointed out that verify_set_primary_sb() will either
>> return 1 or XR_INSUFF_SEC_SB.  Move the check lower into
>> verify_set_primary_sb() by checking the return value of
>> verify_sb().  Example output:
>>
>> found candidate secondary superblock...
>> verifying sb at 31249334272: bad magic number (1)
>> verifying sb at 62498668544: bad magic number (1)
>> verifying sb at 93748002816: bad magic number (1)
>> verifying sb at 124997337088: bad magic number (1)
>> unable to verify superblock, continuing...
>>
> 
> This looks better :)  You may want to add even more info...
> 
> while it's just searching block by block, if it finds a candidate, I'd
> print the sector offset for that candidate (your first output line).
> 
> And rather than "verifying sb at..." you might do something like
> "comparing to sb N at offset X":
> 
> +	} else {
> +		do_warn("comparing with sb %d at sector %Lu failed: %s (%d)\n",
> +			agno, off, err_string(reason), reason);

Sorry, that was a pre-coffee email :)  The units are bytes, not sectors,
aren't they... in any case, printing the (proper) units for the values
would be helpful.

-Eric

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH V2] xfs_repair: print superblock offsets and why they can't be verified
  2008-10-23 13:53   ` Eric Sandeen
  2008-10-23 14:24     ` Eric Sandeen
@ 2008-11-21  1:03     ` Barry Naujok
  1 sibling, 0 replies; 5+ messages in thread
From: Barry Naujok @ 2008-11-21  1:03 UTC (permalink / raw)
  To: xfs

On Fri, 24 Oct 2008 00:53:10 +1100, Eric Sandeen <sandeen@sandeen.net>  
wrote:

> KELEMEN Peter wrote:
>> Eric has pointed out that verify_set_primary_sb() will either
>> return 1 or XR_INSUFF_SEC_SB.  Move the check lower into
>> verify_set_primary_sb() by checking the return value of
>> verify_sb().  Example output:
>>
>> found candidate secondary superblock...
>> verifying sb at 31249334272: bad magic number (1)
>> verifying sb at 62498668544: bad magic number (1)
>> verifying sb at 93748002816: bad magic number (1)
>> verifying sb at 124997337088: bad magic number (1)
>> unable to verify superblock, continuing...
>>
>
> This looks better :)  You may want to add even more info...
>
> while it's just searching block by block, if it finds a candidate, I'd
> print the sector offset for that candidate (your first output line).
>
> And rather than "verifying sb at..." you might do something like
> "comparing to sb N at offset X":
>
> +	} else {
> +		do_warn("comparing with sb %d at sector %Lu failed: %s (%d)\n",
> +			agno, off, err_string(reason), reason);
>
> because at this point it's using the geometry of the candidate sb to see
> if it can be used to find enough other valid sb's....

Do I check in the patch as is or will there be an update?

Regards,
Barry.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-11-21  0:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-22 18:36 [PATCH] xfs_repair: print superblock offsets and denial reasons KELEMEN Peter
2008-10-22 23:41 ` [PATCH V2] xfs_repair: print superblock offsets and why they can't be verified KELEMEN Peter
2008-10-23 13:53   ` Eric Sandeen
2008-10-23 14:24     ` Eric Sandeen
2008-11-21  1:03     ` Barry Naujok

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox