xfs
[Top] [All Lists]

Re: [PATCH 05/12] repair: update extent count after zapping duplicate bl

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 05/12] repair: update extent count after zapping duplicate blocks
From: Mark Tinguely <tinguely@xxxxxxx>
Date: Fri, 13 Jan 2012 11:18:03 -0600
Cc: xfs@xxxxxxxxxxx
In-reply-to: <20111202174741.904845954@xxxxxxxxxxxxxxxxxxxxxx>
References: <20111202174619.179530033@xxxxxxxxxxxxxxxxxxxxxx> <20111202174741.904845954@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.24) Gecko/20111206 Thunderbird/3.1.16
On 01/-10/63 13:59, Christoph Hellwig wrote:
When we find a duplicate extent in an extern format inode we do not zap
the whole inode, but just truncate it to the point where the duplicate
extent was found.  But the current code only updates di_nblocks for the
new size, but no di_nextents/di_anextents.  In most cases this isn't noticed,
but when moving such an inode to the lost+found directoy the consistency
check in xfs_iformat trips over it.  Fix this by updating the on-disk
extent count as part of the inode repair.

Note that we zap btree format inodes with duplicate block completely
at this point, so this fix doesn't apply to them.

Reported-by: Arkadiusz Mi??kiewicz<arekm@xxxxxxxx>
Tested-by: Arkadiusz Mi??kiewicz<arekm@xxxxxxxx>
Signed-off-by: Christoph Hellwig<hch@xxxxxx>

Index: xfsprogs-dev/repair/dinode.c
===================================================================
--- xfsprogs-dev.orig/repair/dinode.c   2011-11-08 12:15:40.000000000 +0000
+++ xfsprogs-dev/repair/dinode.c        2011-11-14 12:09:54.000000000 +0000

@@ -2003,6 +2016,12 @@ process_inode_blocks_and_extents(
        xfs_ino_t       lino,
        int             *dirty)
  {
+       if (nblocks<  nextents + anextents) {
+               do_warn(
+_("nblocks (%" PRIu64 ") smaller than nextents for inode %" PRIu64 "\n"), 
nblocks, lino);
+               return 1;
+       }
+

I agree with David on an inserted comment and relocation. I would not have figured out this test without David's observation.

Reviewed-by: Mark Tinguely <tinguely@xxxxxxx>

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [PATCH 05/12] repair: update extent count after zapping duplicate blocks, Mark Tinguely <=