From f5136e81957e4b67ae6ed7764d378b817fac5ee2 Mon Sep 17 00:00:00 2001 From: Lai Siyao Date: Tue, 19 Jan 2021 21:37:50 +0800 Subject: [PATCH] LU-14119 osd-zfs: enable LUDA_VERIFY In osd_dir_it_rec(), if dirent is successfully got, and the FID in dirent is sane, it returns right away, however if LUDA_VERIFY|LUDA_VERIFY_DRYRUN is set, the FID in dirent should be compared with the FID in LMA, and replaced with the latter one if they are differet. Signed-off-by: Lai Siyao Change-Id: I35e2a4d4606044cd37cc5847cffc577740918988 Reviewed-on: https://review.whamcloud.com/41274 Tested-by: jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- lustre/osd-zfs/osd_index.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lustre/osd-zfs/osd_index.c b/lustre/osd-zfs/osd_index.c index 9116cba..9f4ee37 100644 --- a/lustre/osd-zfs/osd_index.c +++ b/lustre/osd-zfs/osd_index.c @@ -1568,7 +1568,8 @@ static int osd_dir_it_rec(const struct lu_env *env, const struct dt_it *di, lde->lde_attrs |= LUDA_UNKNOWN; } - GOTO(pack_attr, rc = 0); + if (!(attr & (LUDA_VERIFY | LUDA_VERIFY_DRYRUN))) + GOTO(pack_attr, rc = 0); } if (OBD_FAIL_CHECK(OBD_FAIL_FID_LOOKUP)) @@ -1580,6 +1581,10 @@ static int osd_dir_it_rec(const struct lu_env *env, const struct dt_it *di, GOTO(pack_attr, rc = 0); } + if (za->za_num_integers >= 3 && fid_is_sane(&zde->lzd_fid) && + lu_fid_eq(&zde->lzd_fid, fid)) + GOTO(pack_attr, rc = 0); + if (!(attr & LUDA_VERIFY)) { fid_cpu_to_le(&lde->lde_fid, fid); lde->lde_attrs = LUDA_FID; -- 1.8.3.1