linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@nokia.com>
To: Artem Bityutskiy <dedekind1@gmail.com>
Cc: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	Matthieu CASTET <matthieu.castet@parrot.com>
Subject: Re: [PATCH 5/7] UBIFS: do not look up junk nodes
Date: Sat, 07 Aug 2010 15:06:53 +0300	[thread overview]
Message-ID: <4C5D4C5D.3090204@nokia.com> (raw)
In-Reply-To: <1281169577-18664-6-git-send-email-dedekind1@gmail.com>

Artem Bityutskiy wrote:
> From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
> 
> When moving nodes, do not try to look up truncation and padding nodes in TNC,
> because they do not exist there. This bug was most probably harmless, because
> the TNC look-up probably failed for all padding and truncation nodes, but it

The scan does not return padding nodes.

> could also succeed and lead to various "interesting" errors.

Why would it succeed?

> 
> This patch fixes the issue.
> 
> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
> ---
>  fs/ubifs/gc.c |   23 ++++++++++++++++++++---
>  1 files changed, 20 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c
> index fbb9272..f68e58d 100644
> --- a/fs/ubifs/gc.c
> +++ b/fs/ubifs/gc.c
> @@ -227,9 +227,26 @@ static int sort_nodes(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
>  	list_for_each_entry_safe(snod, tmp, &sleb->nodes, list) {
>  		int err;
>  
> -		ubifs_assert(snod->type != UBIFS_IDX_NODE);
> -		ubifs_assert(snod->type != UBIFS_REF_NODE);
> -		ubifs_assert(snod->type != UBIFS_CS_NODE);
> +		ubifs_assert(snod->type == UBIFS_INO_NODE  ||
> +			     snod->type == UBIFS_DATA_NODE ||
> +			     snod->type == UBIFS_DENT_NODE ||
> +			     snod->type == UBIFS_XENT_NODE ||
> +			     snod->type == UBIFS_TRUN_NODE ||
> +			     snod->type == UBIFS_PAD_NODE);
> +		ubifs_assert(key_type(c, &snod->key) == UBIFS_DATA_KEY ||
> +			     key_type(c, &snod->key) == UBIFS_INO_KEY  ||
> +			     key_type(c, &snod->key) == UBIFS_DENT_KEY ||
> +			     key_type(c, &snod->key) == UBIFS_XENT_KEY);
> +
> +		if (snod->type != UBIFS_INO_NODE  &&
> +		    snod->type != UBIFS_DATA_NODE &&
> +		    snod->type != UBIFS_DENT_NODE &&
> +		    snod->type != UBIFS_XENT_NODE) {
> +			/* Truncation or padding node, zap it */
> +			list_del(&snod->list);
> +			kfree(snod);
> +			continue;
> +		}
>  
>  		err = ubifs_tnc_has_node(c, &snod->key, 0, sleb->lnum,
>  					 snod->offs, 0);

  reply	other threads:[~2010-08-07 12:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-07  8:26 [PATCH 0/7] UBIFS: recent patches Artem Bityutskiy
2010-08-07  8:26 ` [PATCH 1/7] UBIFS: switch to RO mode after synchronizing Artem Bityutskiy
2010-08-07  8:26 ` [PATCH 2/7] UBIFS: do not treat ENOSPC specially Artem Bityutskiy
2010-08-08 17:51   ` Vitaly Wool
2010-08-09  5:56     ` Artem Bityutskiy
2010-08-07  8:26 ` [PATCH 3/7] UBIFS: fix assertion warning Artem Bityutskiy
2010-08-07  8:26 ` [PATCH 4/7] UBIFS: fix GC sroting Artem Bityutskiy
2010-08-07 12:11   ` Adrian Hunter
2010-08-07 12:51     ` Artem Bityutskiy
2010-08-07  8:26 ` [PATCH 5/7] UBIFS: do not look up junk nodes Artem Bityutskiy
2010-08-07 12:06   ` Adrian Hunter [this message]
2010-08-07 12:45     ` Artem Bityutskiy
2010-08-07  8:26 ` [PATCH 6/7] UBIFS: do not use key type in list_sort compariosn fuction Artem Bityutskiy
2010-08-07  8:26 ` [PATCH 7/7] UBIFS: introduce list sorting debugging checks Artem Bityutskiy
2010-08-09 13:18 ` [PATCH 0/7] UBIFS: recent patches Matthieu CASTET

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=4C5D4C5D.3090204@nokia.com \
    --to=adrian.hunter@nokia.com \
    --cc=dedekind1@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=matthieu.castet@parrot.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).