From f960c41d1ca0a106f36f7e773cc3349e84226118 Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Sat, 3 Dec 2016 08:08:25 +0800 Subject: [PATCH] LU-9294 mgs: ignore stale barrier locks Currently, when MDT umount/crash, it may not notify the MGS to cleanup related barrier lock and bitmap. Then subsequent barrier operation may find some stale barrier locks. It is unnecessary to return failure by mgs_barrier_glimpse_lock() for such case, the caller will handle that properly. Signed-off-by: Fan Yong Change-Id: I341fd648da2eebbaab729145d1f06c420fce6455 Reviewed-on: https://review.whamcloud.com/26455 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Niu Yawei Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin --- lustre/mgs/mgs_barrier.c | 8 +++++++- lustre/tests/sanity.sh | 7 +------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lustre/mgs/mgs_barrier.c b/lustre/mgs/mgs_barrier.c index 13841b1..e661063 100644 --- a/lustre/mgs/mgs_barrier.c +++ b/lustre/mgs/mgs_barrier.c @@ -62,9 +62,11 @@ static int mgs_barrier_gl_interpret_reply(const struct lu_env *env, ENTRY; if (rc) { - if (rc == -ENODEV) + if (rc == -ENODEV) { /* The lock is useless, cancel it. */ ldlm_lock_cancel(ca->ca_lock); + rc = 0; + } GOTO(out, rc); } @@ -718,6 +720,10 @@ int mgs_iocontrol_barrier(const struct lu_env *env, strnlen(bc->bc_name, sizeof(bc->bc_name)) > 8)) RETURN(-EINVAL); + /* NOT allow barrier operations during recovery. */ + if (unlikely(mgs->mgs_obd->obd_recovering)) + RETURN(-EBUSY); + switch (bc->bc_cmd) { case BC_FREEZE: rc = mgs_barrier_freeze(env, mgs, bc); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 87fe6a8..46dae9c 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -16114,15 +16114,10 @@ test_409() run_test 409 "Large amount of cross-MDTs hard links on the same file" prep_801() { - start_full_debug_logging - # cleanup unused barrier locks before test - [[ $(lustre_version_code mds1) -lt $(version_code 2.9.55) ]] || [[ $(lustre_version_code ost1) -lt $(version_code 2.9.55) ]] && skip "Need server version at least 2.9.55" & exit 0 - - do_facet mgs $LCTL barrier_rescan $FSNAME || - error "Fail to prep barrier test env" + start_full_debug_logging } post_801() { -- 1.8.3.1