[PATCH 3/6] xfs: inode unlinked list needs to recalculate the inode CRC
Dave Chinner
david at fromorbit.com
Mon Jun 3 22:06:20 CDT 2013
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 at redhat.com>
> >
> > 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 at redhat.com>
.....
> > @@ -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 at fromorbit.com
More information about the xfs
mailing list