From eba1b49172259ece89ab604a2ed2285e4770baa2 Mon Sep 17 00:00:00 2001 From: Lai Siyao Date: Sat, 23 Oct 2021 10:44:36 -0400 Subject: [PATCH] LU-14448 lod: verify LOV early in lod_get_default_striping lod_get_default_striping() will get both default LOV and default LMV, and parse them to struct lod_default_striping one by one, however the LOV and LMV data are both stored in lod_thread_info.lti_ea_store, so lod_verify_striping() should verify LOV upon getting LOV, otherwise if both exists, it's LMV that's verified, which will return -EINVAL. Fixes: 6a08df2d0effc7a ("LU-14448 lod: verify LOV before set/inherit") Signed-off-by: Lai Siyao Change-Id: I9763d35bdbc74101fa8515d5096ec457a4cb3524 Reviewed-on: https://review.whamcloud.com/45370 Reviewed-by: Andreas Dilger Tested-by: Maloo Tested-by: jenkins Reviewed-by: Hongchao Zhang Reviewed-by: Oleg Drokin --- lustre/lod/lod_object.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index 95319e5..e4147b8 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -5312,6 +5312,15 @@ static int lod_get_default_striping(const struct lu_env *env, int rc, rc1; rc = lod_get_default_lov_striping(env, lo, lds, NULL); + if (lds->lds_def_striping_set) { + struct lod_thread_info *info = lod_env_info(env); + struct lod_device *d = lu2lod_dev(lo->ldo_obj.do_lu.lo_dev); + + rc = lod_verify_striping(env, d, lo, &info->lti_buf, false); + if (rc) + lds->lds_def_striping_set = 0; + } + rc1 = lod_get_default_lmv_striping(env, lo, lds); if (rc == 0 && rc1 < 0) rc = rc1; @@ -5516,12 +5525,6 @@ static void lod_ah_init(const struct lu_env *env, */ if (likely(lp != NULL)) { lod_get_default_striping(env, lp, lds); - if (lds->lds_def_striping_set) { - rc = lod_verify_striping(env, d, lp, - &info->lti_buf, false); - if (rc) - lds->lds_def_striping_set = 0; - } /* inherit default striping except ROOT */ if ((lds->lds_def_striping_set || lds->lds_dir_def_striping_set) && -- 1.8.3.1