From e9bac5fa455eab5371cdfb141b73a3beb0cc8d9c Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Tue, 9 Mar 2021 17:15:20 +0800 Subject: [PATCH] LU-14502 lov: fault page update cp_lov_index In fault IO, vvp_io_fault_start() could find an existing cl_page associated with the vmpage covering the fault index, and the page may still refer to another mirror of an old IO. This patch update the fault page's cp_lov_index in lov_io_fault_start Signed-off-by: Bobi Jam Change-Id: I50639700159a76061437fd2f1a09dadf25cfd33f Reviewed-on: https://review.whamcloud.com/41954 Reviewed-by: Wang Shilong Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/lov/lov_io.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/lustre/lov/lov_io.c b/lustre/lov/lov_io.c index 3a13802..4cd93fa 100644 --- a/lustre/lov/lov_io.c +++ b/lustre/lov/lov_io.c @@ -1371,11 +1371,50 @@ static int lov_io_fault_start(const struct lu_env *env, struct cl_fault_io *fio; struct lov_io *lio; struct lov_io_sub *sub; + loff_t offset; + int entry; + int stripe; ENTRY; fio = &ios->cis_io->u.ci_fault; lio = cl2lov_io(env, ios); + + /** + * LU-14502: ft_page could be an existing cl_page associated with + * the vmpage covering the fault index, and the page may still + * refer to another mirror of an old IO. + */ + if (lov_is_flr(lio->lis_object)) { + offset = cl_offset(ios->cis_obj, fio->ft_index); + entry = lov_io_layout_at(lio, offset); + if (entry < 0) { + CERROR(DFID": page fault index %lu invalid component: " + "%d, mirror: %d\n", + PFID(lu_object_fid(&ios->cis_obj->co_lu)), + fio->ft_index, entry, + lio->lis_mirror_index); + RETURN(-EIO); + } + stripe = lov_stripe_number(lio->lis_object->lo_lsm, + entry, offset); + + if (fio->ft_page->cp_lov_index != + lov_comp_index(entry, stripe)) { + CDEBUG(D_INFO, DFID": page fault at index %lu, " + "at mirror %u comp entry %u stripe %u, " + "been used with comp entry %u stripe %u\n", + PFID(lu_object_fid(&ios->cis_obj->co_lu)), + fio->ft_index, lio->lis_mirror_index, + entry, stripe, + lov_comp_entry(fio->ft_page->cp_lov_index), + lov_comp_stripe(fio->ft_page->cp_lov_index)); + + fio->ft_page->cp_lov_index = + lov_comp_index(entry, stripe); + } + } + sub = lov_sub_get(env, lio, fio->ft_page->cp_lov_index); sub->sub_io.u.ci_fault.ft_nob = fio->ft_nob; -- 1.8.3.1