linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@clusterfs.com>
To: Alex Tomas <alex@clusterfs.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH] more sanity check in extents
Date: Wed, 17 Jan 2007 15:23:31 -0700	[thread overview]
Message-ID: <20070117222331.GL5236@schatzie.adilger.int> (raw)
In-Reply-To: <m364bd85cm.fsf@bzzz.home.net>

On Jan 12, 2007  03:18 +0300, Alex Tomas wrote:
> +/*
> + * the routine checks that every block start with key value specified
> + * in the pointed at the upper layer
> + */
> +static int __ext4_ext_check_interlevel(const char *function, struct inode *inode,
> +					struct ext4_ext_path *path, int depth)
> +{
> +	unsigned long key, first;
> +
> +	if (ext_depth(inode) == 0)
> +		return 0;
> +
> +	/* nothing to check at the top */
> +	if (depth == ext_depth(inode))
> +		return 0;
> +
> +	/* after split, a leaf can get zero entries
> +	 * thus there is nothing to check */
> +	if (le16_to_cpu(path->p_hdr->eh_entries) == 0)
> +		return 0;
> +
> +	if (depth == 0)
> +		first = le32_to_cpu(EXT_FIRST_EXTENT(path->p_hdr)->ee_block);
> +	else
> +		first = le32_to_cpu(EXT_FIRST_INDEX(path->p_hdr)->ei_block);
> +	path--;
> +	key = le32_to_cpu(path->p_idx->ei_block);
> +	
> +	if (likely(first == key))
> +		return 0;

What happens if, say, a leaf is split and then the first part of the split
is removed?  This could only happen with punch() on a running filesystem,
but in e2fsck a corrupt extent will be removed from the leaf without
updating the parent index's range.

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

  reply	other threads:[~2007-01-17 22:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-12  0:18 [PATCH] more sanity check in extents Alex Tomas
2007-01-17 22:23 ` Andreas Dilger [this message]
2007-01-17 22:31   ` Alex Tomas

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=20070117222331.GL5236@schatzie.adilger.int \
    --to=adilger@clusterfs.com \
    --cc=alex@clusterfs.com \
    --cc=linux-ext4@vger.kernel.org \
    /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).