public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 06/13] xfs_repair: add XR_DIR_TRACE to dir2.c
Date: Mon, 14 Sep 2015 15:18:25 -0400	[thread overview]
Message-ID: <20150914191825.GF34083@bfoster.bfoster> (raw)
In-Reply-To: <1441827251-13128-7-git-send-email-sandeen@sandeen.net>

On Wed, Sep 09, 2015 at 02:34:04PM -0500, Eric Sandeen wrote:
> attr_repair.c has many printf-tracepoints under
> #ifdef XR_DIR_TRACE, but the similar code in dir2.c does not.
> 
> Add these same tracepoints to remove more differences between
> these two pieces of code.
> 
> Not all messages are quite correct; those will be fixed up last.
> For now we just make the code more obviously similar.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  repair/dir2.c |   39 ++++++++++++++++++++++++++++++++++++---
>  1 files changed, 36 insertions(+), 3 deletions(-)
> 
> diff --git a/repair/dir2.c b/repair/dir2.c
> index 898b27e..d9bd5fc 100644
> --- a/repair/dir2.c
> +++ b/repair/dir2.c
> @@ -337,6 +337,11 @@ verify_final_dir2_path(xfs_mount_t	*mp,
>  	struct xfs_da_node_entry *btree;
>  	struct xfs_da3_icnode_hdr nodehdr;
>  
> +#ifdef XR_DIR_TRACE
> +	fprintf(stderr, "in verify_final_dir2_path, this_level = %d\n",
> +		this_level);
> +#endif
> +
>  	/*
>  	 * the index should point to the next "unprocessed" entry
>  	 * in the block which should be the final (rightmost) entry
> @@ -388,8 +393,17 @@ verify_final_dir2_path(xfs_mount_t	*mp,
>  	/*
>  	 * ok, now check descendant block number against this level
>  	 */
> -	if (cursor->level[p_level].bno != be32_to_cpu(btree[entry].before))
> +	if (cursor->level[p_level].bno != be32_to_cpu(btree[entry].before)) {
> +#ifdef XR_DIR_TRACE
> +		fprintf(stderr, "bad directory btree pointer, child bno should "
> +				"be %d, block bno is %d, hashval is %u\n",
> +			be16_to_cpu(btree[entry].before),
> +			cursor->level[p_level].bno,
> +			cursor->level[p_level].hashval);
> +		fprintf(stderr, "verify_final_dir2_path returns 1 (bad) #1a\n");
> +#endif
>  		return(1);
> +	}
>  
>  	if (cursor->level[p_level].hashval !=
>  				be32_to_cpu(btree[entry].hashval))  {
> @@ -431,8 +445,12 @@ _("would correct bad hashval in non-leaf dir block\n"
>  	/*
>  	 * bail out if this is the root block (top of tree)
>  	 */
> -	if (this_level >= cursor->active)
> +	if (this_level >= cursor->active) {
> +#ifdef XR_DIR_TRACE
> +		fprintf(stderr, "verify_final_dir2_path returns 0 (ok)\n");
> +#endif
>  		return(0);
> +	}
>  	/*
>  	 * set hashvalue to correctl reflect the now-validated
>  	 * last entry in this block and continue upwards validation
> @@ -600,6 +618,9 @@ _("bad level %d in block %u for directory inode %" PRIu64 "\n"),
>  			bad++;
>  		}
>  		if (bad)  {
> +#ifdef XR_DIR_TRACE
> +			fprintf(stderr, "verify_dir2_path returns 1 (bad) #4\n");
> +#endif
>  			libxfs_putbuf(bp);
>  			return(1);
>  		}
> @@ -631,8 +652,17 @@ _("bad level %d in block %u for directory inode %" PRIu64 "\n"),
>  	/*
>  	 * ditto for block numbers
>  	 */
> -	if (cursor->level[p_level].bno != be32_to_cpu(btree[entry].before))
> +	if (cursor->level[p_level].bno != be32_to_cpu(btree[entry].before)) {
> +#ifdef XR_DIR_TRACE
> +		fprintf(stderr, "bad directory btree pointer, child bno "
> +			"should be %d, block bno is %d, hashval is %u\n",
> +			be32_to_cpu(btree[entry].before),
> +			cursor->level[p_level].bno,
> +			cursor->level[p_level].hashval);
> +		fprintf(stderr, "verify_dir2_path returns 1 (bad) #1a\n");
> +#endif
>  		return(1);
> +	}
>  	/*
>  	 * ok, now validate last hashvalue in the descendant
>  	 * block against the hashval in the current entry
> @@ -659,6 +689,9 @@ _("would correct bad hashval in interior dir block\n"
>  	 * (which should point to the next descendant block)
>  	 */
>  	cursor->level[this_level].index++;
> +#ifdef XR_DIR_TRACE
> +       fprintf(stderr, "verify_dir2_path returns 0 (ok)\n");
> +#endif
>  	return(0);
>  }
>  
> -- 
> 1.7.1
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

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

  reply	other threads:[~2015-09-14 19:18 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-09 19:33 [PATCH 0/13] xfs_repair: recombine cut&waste code in dir2.c/attr_repair.c Eric Sandeen
2015-09-09 19:33 ` [PATCH 01/13] xfs_repair: remove trace-only 'n' member from da_level_state Eric Sandeen
2015-09-14 19:17   ` Brian Foster
2015-09-09 19:34 ` [PATCH 02/13] xfs_repair: remove type from da & dir2 cursors Eric Sandeen
2015-09-14 19:18   ` Brian Foster
2015-09-09 19:34 ` [PATCH 03/13] xfs_repair: make CRC checking consistent in path verification Eric Sandeen
2015-09-14 19:18   ` Brian Foster
2015-09-09 19:34 ` [PATCH 04/13] xfs_repair: use multibuffer read routines in attr_repair.c Eric Sandeen
2015-09-14 19:18   ` Brian Foster
2015-09-14 19:24     ` Eric Sandeen
2015-09-14 19:30       ` Brian Foster
2015-09-09 19:34 ` [PATCH 05/13] xfs_repair: fix use-after-free in verify_final_dir2_path Eric Sandeen
2015-09-14 19:18   ` Brian Foster
2015-09-09 19:34 ` [PATCH 06/13] xfs_repair: add XR_DIR_TRACE to dir2.c Eric Sandeen
2015-09-14 19:18   ` Brian Foster [this message]
2015-09-09 19:34 ` [PATCH 07/13] xfs_repair: Remove BUF_PTR from attr_repair.c Eric Sandeen
2015-09-14 19:44   ` Brian Foster
2015-09-09 19:34 ` [PATCH 08/13] xfs_repair: catch bad level/depth in da node Eric Sandeen
2015-09-14 19:44   ` Brian Foster
2015-09-09 19:34 ` [PATCH 09/13] xfs_repair: better checking of v5 attributes Eric Sandeen
2015-09-14 19:44   ` Brian Foster
2015-09-23 17:53     ` Eric Sandeen
2015-09-09 19:34 ` [PATCH 10/13] xfs_repair: Remove more differences between attr & dir2 Eric Sandeen
2015-09-14 19:55   ` Brian Foster
2015-09-09 19:34 ` [PATCH 11/13] xfs_repair: whitespace & comments Eric Sandeen
2015-09-14 19:56   ` Brian Foster
2015-09-09 19:34 ` [PATCH 12/13] xfs_repair: move common dir2 and attr_repair code to da_util.c Eric Sandeen
2015-09-09 19:34 ` [PATCH 13/13] xfs_repair: Fix up warning strings in da_util.c Eric Sandeen
2015-09-14 20:06   ` Brian Foster
2015-09-14 20:11     ` Eric Sandeen
2015-09-10  9:22 ` [PATCH 0/13] xfs_repair: recombine cut&waste code in dir2.c/attr_repair.c Carlos Maiolino
2015-09-10 16:51   ` Eric Sandeen
2015-09-11  8:20     ` Carlos Maiolino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150914191825.GF34083@bfoster.bfoster \
    --to=bfoster@redhat.com \
    --cc=sandeen@sandeen.net \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox