Whamcloud - gitweb
EX-3860 llog: extended debug for -ENOTDIR error
authorMikhail Pershin <mpershin@whamcloud.com>
Thu, 20 Jul 2023 10:27:59 +0000 (13:27 +0300)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 6 Oct 2023 23:20:27 +0000 (23:20 +0000)
Debug patch to catch trace and debug log for -ENOTDIR
error in distribute_txn_cancel_records()

Signed-off-by: Mikhail Pershin <mpershin@whamcloud.com>
Change-Id: Ie1bb7c138282bfa05a2fafcceafdb436d45f28d3
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52394
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/obdclass/dt_object.c
lustre/target/update_trans.c

index ed130cc..d79d00e 100644 (file)
@@ -190,10 +190,10 @@ int dt_try_as_dir(const struct lu_env *env, struct dt_object *obj, bool check)
 {
        if (check) {
                if (unlikely(!dt_object_exists(obj)))
-                       return 0;
+                       RETURN(0);
 
                if (unlikely(!S_ISDIR(lu_object_attr(&obj->do_lu))))
-                       return 0;
+                       RETURN(0);
 
                if (obj->do_index_ops)
                        return 1;
@@ -201,6 +201,7 @@ int dt_try_as_dir(const struct lu_env *env, struct dt_object *obj, bool check)
 
        obj->do_ops->do_index_try(env, obj, &dt_directory_features);
 
+       EXIT;
        return obj->do_index_ops != NULL;
 }
 EXPORT_SYMBOL(dt_try_as_dir);
index 16acc80..c8dae80 100644 (file)
@@ -1281,6 +1281,9 @@ static int distribute_txn_cancel_records(const struct lu_env *env,
                                         struct top_multiple_thandle *tmt)
 {
        struct sub_thandle *st;
+       unsigned int debug = 0;
+       bool debug_done = false;
+
        ENTRY;
 
        if (OBD_FAIL_CHECK(OBD_FAIL_TGT_TXN_NO_CANCEL))
@@ -1303,15 +1306,29 @@ static int distribute_txn_cancel_records(const struct lu_env *env,
                        cookie = &stc->stc_cookie;
                        if (fid_is_zero(&cookie->lgc_lgl.lgl_oi.oi_fid))
                                continue;
-
+do_debug_run:
                        rc = llog_cat_cancel_records(env, ctxt->loc_handle, 1,
                                                     cookie);
                        CDEBUG(D_HA, "%s: batchid %llu cancel update log "
                               DFID".%u: rc = %d\n", obd->obd_name,
                               tmt->tmt_batchid, PLOGID(&cookie->lgc_lgl),
                               cookie->lgc_index, rc);
+                       if (unlikely(rc == -ENOTDIR && !debug_done)) {
+                               if (!debug) {
+                                       debug = libcfs_debug;
+                                       libcfs_debug |= D_TRACE | D_INFO |
+                                                       D_OTHER | D_INODE |
+                                                       D_RPCTRACE;
+                                       goto do_debug_run;
+                               } else {
+                                       libcfs_debug = debug;
+                                       libcfs_debug_dumplog();
+                                       debug_done = true;
+                               }
+                       }
                }
-
+               if (unlikely(debug && !debug_done))
+                       libcfs_debug = debug;
                llog_ctxt_put(ctxt);
        }