]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
libxfs: clear buffer state flags in libxfs_getbuf and variants
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 2 Sep 2015 22:42:01 +0000 (08:42 +1000)
committerDave Chinner <david@fromorbit.com>
Wed, 2 Sep 2015 22:42:01 +0000 (08:42 +1000)
commite8ecd76016dc3c6ba5565ecd7b38ff11da2ace5b
treea362fd3606f7a70f2121bf17c1e75a71e23d6360
parent1f2ace68e624c61e99ce6c85898003628fa480a7
libxfs: clear buffer state flags in libxfs_getbuf and variants

When we're running xfs_repair with prefetch enabled, it's possible
that repair will decide to clear an inode without examining all
metadata blocks owned by that inode.  This leaves the unreferenced
prefetched buffers marked UNCHECKED, which will cause a subsequent CRC
error if the block is reallocated to a different structure and read
more than once.  Typically this happens when a large directory is
corrupted and lost+found has to grow to accomodate all the
disconnected inodes.

In libxfs_getbuf*(), we're supposed to return an unused buffer which
has a clean state.  Unfortunately, things like UNCHECKED can hang
around to cause incorrect verifier errors later, so change those
functions to launder the state bits clean.

v2: Change the function name to reset_buf_state() to reflect what
the function is trying to accomplish.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
libxfs/rdwr.c