cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [GFS2 PATCH] gfs2: improve debug information when lvb mismatches are found
Date: Thu, 16 Aug 2018 16:16:58 +0100	[thread overview]
Message-ID: <e8c372a3-2b56-911c-c30e-6ebd76e84dcd@redhat.com> (raw)
In-Reply-To: <781307088.2795084.1534353235430.JavaMail.zimbra@redhat.com>

Hi,


On 15/08/18 18:13, Bob Peterson wrote:
> Hi,
>
> Before this patch, gfs2_rgrp_bh_get would check for lvb mismatches,
> but it wouldn't tell you what was actually wrong. This patch adds
> more information to help us debug it. It also makes rgrp consistency
> checks dump any bad rgrps, and the rgrp dump code dump any lvbs
> as well as the rgrp itself.
Yes, that is a good plan.
Acked-by: Steven Whitehouse <swhiteho@redhat.com>

Steve.

> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
> ---
>   fs/gfs2/rgrp.c | 41 ++++++++++++++++++++++++++++++++++++-----
>   fs/gfs2/util.c |  3 +++
>   2 files changed, 39 insertions(+), 5 deletions(-)
>
> diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
> index 6eec634eae2d..4bb846af04e7 100644
> --- a/fs/gfs2/rgrp.c
> +++ b/fs/gfs2/rgrp.c
> @@ -1103,12 +1103,35 @@ static int gfs2_rgrp_lvb_valid(struct gfs2_rgrpd *rgd)
>   {
>   	struct gfs2_rgrp_lvb *rgl = rgd->rd_rgl;
>   	struct gfs2_rgrp *str = (struct gfs2_rgrp *)rgd->rd_bits[0].bi_bh->b_data;
> +	int valid = 1;
>   
> -	if (rgl->rl_flags != str->rg_flags || rgl->rl_free != str->rg_free ||
> -	    rgl->rl_dinodes != str->rg_dinodes ||
> -	    rgl->rl_igeneration != str->rg_igeneration)
> -		return 0;
> -	return 1;
> +	if (rgl->rl_flags != str->rg_flags) {
> +		printk(KERN_WARNING "GFS2: rgd: %llu lvb flag mismatch %u/%u",
> +		       (unsigned long long)rgd->rd_addr,
> +		       be32_to_cpu(rgl->rl_flags), be32_to_cpu(str->rg_flags));
> +		valid = 0;
> +	}
> +	if (rgl->rl_free != str->rg_free) {
> +		printk(KERN_WARNING "GFS2: rgd: %llu lvb free mismatch %u/%u",
> +		       (unsigned long long)rgd->rd_addr,
> +		       be32_to_cpu(rgl->rl_free), be32_to_cpu(str->rg_free));
> +		valid = 0;
> +	}
> +	if (rgl->rl_dinodes != str->rg_dinodes) {
> +		printk(KERN_WARNING "GFS2: rgd: %llu lvb dinode mismatch %u/%u",
> +		       (unsigned long long)rgd->rd_addr,
> +		       be32_to_cpu(rgl->rl_dinodes),
> +		       be32_to_cpu(str->rg_dinodes));
> +		valid = 0;
> +	}
> +	if (rgl->rl_igeneration != str->rg_igeneration) {
> +		printk(KERN_WARNING "GFS2: rgd: %llu lvb igen mismatch "
> +		       "%llu/%llu", (unsigned long long)rgd->rd_addr,
> +		       (unsigned long long)be64_to_cpu(rgl->rl_igeneration),
> +		       (unsigned long long)be64_to_cpu(str->rg_igeneration));
> +		valid = 0;
> +	}
> +	return valid;
>   }
>   
>   static u32 count_unlinked(struct gfs2_rgrpd *rgd)
> @@ -2243,6 +2266,14 @@ void gfs2_rgrp_dump(struct seq_file *seq, const struct gfs2_glock *gl)
>   		       (unsigned long long)rgd->rd_addr, rgd->rd_flags,
>   		       rgd->rd_free, rgd->rd_free_clone, rgd->rd_dinodes,
>   		       rgd->rd_reserved, rgd->rd_extfail_pt);
> +	if (rgd->rd_sbd->sd_args.ar_rgrplvb) {
> +		struct gfs2_rgrp_lvb *rgl = rgd->rd_rgl;
> +
> +		gfs2_print_dbg(seq, "  L: f:%02x b:%u i:%u\n",
> +			       be32_to_cpu(rgl->rl_flags),
> +			       be32_to_cpu(rgl->rl_free),
> +			       be32_to_cpu(rgl->rl_dinodes));
> +	}
>   	spin_lock(&rgd->rd_rsspin);
>   	for (n = rb_first(&rgd->rd_rstree); n; n = rb_next(&trs->rs_node)) {
>   		trs = rb_entry(n, struct gfs2_blkreserv, rs_node);
> diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
> index 59c811de0dc7..b072b10fb635 100644
> --- a/fs/gfs2/util.c
> +++ b/fs/gfs2/util.c
> @@ -19,6 +19,7 @@
>   #include "gfs2.h"
>   #include "incore.h"
>   #include "glock.h"
> +#include "rgrp.h"
>   #include "util.h"
>   
>   struct kmem_cache *gfs2_glock_cachep __read_mostly;
> @@ -181,6 +182,8 @@ int gfs2_consist_rgrpd_i(struct gfs2_rgrpd *rgd, int cluster_wide,
>   {
>   	struct gfs2_sbd *sdp = rgd->rd_sbd;
>   	int rv;
> +
> +	gfs2_rgrp_dump(NULL, rgd->rd_gl);
>   	rv = gfs2_lm_withdraw(sdp,
>   			      "fatal: filesystem consistency error\n"
>   			      "  RG = %llu\n"
>



      reply	other threads:[~2018-08-16 15:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <908911105.2795053.1534353208618.JavaMail.zimbra@redhat.com>
2018-08-15 17:13 ` [Cluster-devel] [GFS2 PATCH] gfs2: improve debug information when lvb mismatches are found Bob Peterson
2018-08-16 15:16   ` Steven Whitehouse [this message]

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=e8c372a3-2b56-911c-c30e-6ebd76e84dcd@redhat.com \
    --to=swhiteho@redhat.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;
as well as URLs for NNTP newsgroup(s).