Whamcloud - gitweb
LU-15784 obdecho: don't panic with run on second mdt 47/47147/25
authorAlexey Lyashkov <alexey.lyashkov@hpe.com>
Tue, 26 Apr 2022 15:04:05 +0000 (18:04 +0300)
committerOleg Drokin <green@whamcloud.com>
Fri, 23 Feb 2024 07:09:38 +0000 (07:09 +0000)
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 <alexey.lyashkov@hpe.com>
Change-Id: I11c524f205533287a9b5724419741dfbad508d29
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/47147
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Andrew Perepechko <andrew.perepechko@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/obdclass/lu_object.c
lustre/obdecho/echo_client.c
lustre/tests/conf-sanity.sh

index 06d55c9..0d9fa5e 100644 (file)
@@ -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
index 1cf1a75..6674409 100644 (file)
@@ -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);
 }
 
index e154feb..66b6944 100755 (executable)
@@ -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"