From 55c143a66df9023808530a765c14ba506ec1b8e1 Mon Sep 17 00:00:00 2001 From: Alexey Lyashkov Date: Tue, 26 Apr 2022 18:04:05 +0300 Subject: [PATCH] LU-15784 obdecho: don't panic with run on second mdt obdecho should correctly return errors in error situations: 1. connected to devices other than mdd due structure differences. 2. run an operations against of remote objects. HPe-bug-id: LUS-10913 Signed-off-by: Alexey Lyashkov Change-Id: I11c524f205533287a9b5724419741dfbad508d29 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/47147 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Andrew Perepechko Reviewed-by: Oleg Drokin --- lustre/obdclass/lu_object.c | 1 + lustre/obdecho/echo_client.c | 8 +++++++- lustre/tests/conf-sanity.sh | 31 +++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index 06d55c9..0d9fa5e 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -157,6 +157,7 @@ void lu_object_put(const struct lu_env *env, struct lu_object *o) struct lu_object *orig = o; const struct lu_fid *fid = lu_object_fid(o); + LASSERTF(atomic_read(&top->loh_ref) > 0, "o %p\n", o); /* * till we have full fids-on-OST implemented anonymous objects * are possible in OSP. such an object isn't listed in the site diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index 1cf1a75..6674409 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -683,7 +683,7 @@ static struct lu_device *echo_device_alloc(const struct lu_env *env, } tgt_type_name = lustre_cfg_string(cfg, 2); - if (!tgt_type_name) { + if (!tgt_type_name || strcmp(tgt_type_name, "mdd")) { CERROR("%s no type name for echo %s setup\n", lustre_cfg_string(cfg, 1), tgt->obd_type->typ_name); @@ -1795,9 +1795,15 @@ static struct lu_object *echo_resolve_path(const struct lu_env *env, } parent = child; } + if (rc) RETURN(ERR_PTR(rc)); + if (!lu_object_exists(parent)) { + lu_object_put(env, parent); + parent = ERR_PTR(-ENOENT); + } + RETURN(parent); } diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index e154feb..66b6944 100755 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -10838,6 +10838,37 @@ test_135() { } run_test 135 "check the behavior when changelog is wrapped around" +cleanup_136 () { + do_facet mds2 "$LCTL --device ec cleanup" || true + do_facet mds2 "$LCTL --device ec detach" || true + + stopall + reformat_and_config +} + +test_136() { + (( MDSCOUNT >= 2 )) || skip "needs >= 2 MDTs" + + reformat + setup_noconfig + + do_facet mds2 "$LCTL attach echo_client ec ec_uuid" || + error "echo attach fail" + + stack_trap cleanup_136 EXIT + + do_facet mds2 "$LCTL --device ec setup lustre-MDT0001 mdt" && + error "attach to MDT should fail!" + + do_facet mds2 "$LCTL --device ec setup lustre-MDT0001 mdd" || + error "attach to MDD should OK" + do_facet mds2 "$LCTL --device ec test_mkdir /tt" && + error "mkdir test should fail with remote object" + + return 0 +} +run_test 136 "don't panic with bad obdecho setup" + test_140() { (( MDS1_VERSION >= $(version_code 2.15.55) )) || skip "need MDS version at least 2.15.55" -- 1.8.3.1