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] [Patch 17/44] fsck.gfs2: Don't stop invalidating blocks if an invalid one is found
Date: Fri, 12 Aug 2011 10:34:56 +0100	[thread overview]
Message-ID: <1313141696.2704.36.camel@menhir> (raw)
In-Reply-To: <1997991277.544733.1313096744247.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com>

ACK,

Steve.

On Thu, 2011-08-11 at 17:05 -0400, Bob Peterson wrote:
> >From 0f424f6c6a2b4fda8c5b9b2bc1cb246d868d3fec Mon Sep 17 00:00:00 2001
> From: Bob Peterson <rpeterso@redhat.com>
> Date: Mon, 8 Aug 2011 16:20:14 -0500
> Subject: [PATCH 17/44] fsck.gfs2: Don't stop invalidating blocks if an
>  invalid one is found
> 
> When fsck found a duplicate reference to a block it invalidated the dinode's
> metadata.  But if it encountered an invalid block, for example, out of range,
> the invalidating would stop.  If we encounter a block that isn't valid, we
> obviously can't invalidate it.  However, if we return an error, all future
> invalidating will stop for that dinode.  That's wrong because we need it to
> continue to invalidate the other valid blocks.  If we don't do this, block
> references that follow the bad one that are also referenced elsewhere
> (duplicates) won't be flagged as such.  As a result, they'll be freed when
> this corrupt dinode is deleted, despite being used by another dinode as a
> valid block.  This patch makes it return a good return code so the invalidating
> continues.
> 
> rhbz#675723
> ---
>  gfs2/fsck/pass1.c |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
> index b9aa165..2b04227 100644
> --- a/gfs2/fsck/pass1.c
> +++ b/gfs2/fsck/pass1.c
> @@ -827,8 +827,15 @@ static int mark_block_invalid(struct gfs2_inode *ip, uint64_t block,
>  {
>  	uint8_t q;
>  
> -	if (!valid_block(ip->i_sbd, block) != 0)
> -		return -EFAULT;
> +	/* If the block isn't valid, we obviously can't invalidate it.
> +	 * However, if we return an error, invalidating will stop, and
> +	 * we want it to continue to invalidate the valid blocks.  If we
> +	 * don't do this, block references that follow that are also
> +	 * referenced elsewhere (duplicates) won't be flagged as such,
> +	 * and as a result, they'll be freed when this dinode is deleted,
> +	 * despite being used by another dinode as a valid block. */
> +	if (!valid_block(ip->i_sbd, block))
> +		return 0;
>  
>  	q = block_type(block);
>  	if (q != gfs2_block_free) {




      reply	other threads:[~2011-08-12  9:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-11 21:05 [Cluster-devel] [Patch 17/44] fsck.gfs2: Don't stop invalidating blocks if an invalid one is found Bob Peterson
2011-08-12  9:34 ` 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=1313141696.2704.36.camel@menhir \
    --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).