xfs
[Top] [All Lists]

Re: [PATCH 3/6] xfs: inode unlinked list needs to recalculate the inode

To: Brian Foster <bfoster@xxxxxxxxxx>
Subject: Re: [PATCH 3/6] xfs: inode unlinked list needs to recalculate the inode CRC
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Tue, 4 Jun 2013 13:06:20 +1000
Cc: xfs@xxxxxxxxxxx, bpm@xxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <51ACDE03.4090501@xxxxxxxxxx>
References: <1370237332-24757-1-git-send-email-david@xxxxxxxxxxxxx> <1370237332-24757-4-git-send-email-david@xxxxxxxxxxxxx> <51ACDE03.4090501@xxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Mon, Jun 03, 2013 at 02:18:43PM -0400, Brian Foster wrote:
> On 06/03/2013 01:28 AM, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@xxxxxxxxxx>
> > 
> > The inode unlinked list manipulations operate directly on the inode
> > buffer, and so bypass the inode CRC calculation mechanisms. Hence an
> > inode on the unlinked list has an invalid CRC. Fix this by
> > recalculating the CRC whenever we modify an unlinked list pointer in
> > an inode, ncluding during log recovery. This is trivial to do and
> > results in  unlinked list operations always leaving a consistent
> > inode in the buffer.
> > 
> > Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
.....
> > @@ -1809,6 +1821,10 @@ xfs_iunlink_remove(
> >             last_dip->di_next_unlinked = cpu_to_be32(next_agino);
> >             ASSERT(next_agino != 0);
> >             offset = last_offset + offsetof(xfs_dinode_t, di_next_unlinked);
> > +
> > +           /* need to recalc the inode CRC if appropriate */
> > +           xfs_dinode_calc_crc(mp, dip);
> > +
> 
> Ugh, sorry I didn't notice this last time around, but this one looks
> like it should recalculate the crc on last_dip instead of dip.

Yup, it should - good catch. This just highlights how hard it is to
actaully catch a filesystem in the state with a corrupt CRC on the
unlinked list...

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>