]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: fix buffer state management in xrep_findroot_block
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 18 Oct 2018 06:20:35 +0000 (17:20 +1100)
committerDave Chinner <david@fromorbit.com>
Thu, 18 Oct 2018 06:20:35 +0000 (17:20 +1100)
commitf201680a4cc7936a3fe630ba6c555c3e8362b10d
treee1a442af0be3fdc594477db77eeedeb5b857f9fe
parenta1bbd069a8e053f0c401361a0b514d6a44f252a3
xfs: fix buffer state management in xrep_findroot_block

We don't handle buffer state properly in online repair's findroot
routine.  If a buffer already has b_ops set, we don't ever want to touch
that, and we don't want to call the read verifiers on a buffer that
could be dirty (CRCs are only recomputed during log checkpoints).

Therefore, be more careful about what we do with a buffer -- if someone
else already attached ops that are not the ones for this btree type,
just ignore the buffer.  We only attach our btree type's buf ops if it
matches the magic/uuid and structure checks.

We also modify xfs_buf_read_map to allow callers to set buffer ops on a
DONE buffer with NULL ops so that repair doesn't leave behind buffers
which won't have buffers attached to them.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/scrub/repair.c
fs/xfs/xfs_trans.h
fs/xfs/xfs_trans_buf.c