Motivation: When fs data/metadata checksum mismatch, lower block devices may have other correct copies. e.g. If XFS successfully reads a metadata buffer off a raid1 but decides that the metadata is garbage, today it will shut down the entire filesystem without trying any of the other mirrors. This is a severe loss of service, and we propose these patches to have XFS try harder to avoid failure. This patch prototype this mirror retry idea by adding a function verifier callback to submit_bio. Filesystem can use submit_bio_verify() to pass a callback to the block layer which can then be used to verify if the data read is correct. Reused some of bio-integrity code, can be separated if necessary. Changes v3: - Total new implementation, pass down verify function to block layer as suggested by Dave. Bob Liu (3): block: introduce submit_bio_verify() block: verify data when endio fs: xfs: add read_verifier() function block/bio-integrity.c | 45 +++++++++++++++++++++++++++++++++++++++ block/bio.c | 3 +++ block/blk-core.c | 17 ++++++++++++--- block/blk.h | 8 +++++++ block/bounce.c | 1 + drivers/md/raid1.c | 1 + drivers/md/raid5-ppl.c | 1 + fs/xfs/xfs_buf.c | 23 ++++++++++++++++++-- fs/xfs/xfs_buf.h | 1 + include/linux/bio.h | 2 ++ include/linux/blk_types.h | 5 +++++ 11 files changed, 102 insertions(+), 5 deletions(-) -- 2.17.1