From bd9839f7dbdf59751e7cdc234602eb338c518104 Mon Sep 17 00:00:00 2001 From: Mikhail Pershin Date: Sat, 18 May 2024 22:43:05 +0300 Subject: [PATCH] LU-15644 llog: don't replace llog error with -ENOTDIR The dt_try_as_dir() contains check for object existence which is reported as -ENOTDIR after all. In case of llog that goes to upper level and cause error reporting to console. It is not relevant neither by error code nor by debug level Patch skips check for object existence in case of llog, it is excessive anyway. Debug level is reduced as well to don't spawn console messages in case of -ENOENT, -ESTALE or -EIO errors Fixes: 1ebc9ed460 ("LU-15902 obdclass: dt_try_as_dir() check dir exists") Signed-off-by: Mikhail Pershin Change-Id: Id404204566898a6ac2e258b7824491effc5fc92e Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55151 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- lustre/obdclass/llog_cat.c | 26 ++++++++++---------------- lustre/obdclass/llog_osd.c | 4 ++-- lustre/osp/osp_sync.c | 10 +++------- 3 files changed, 15 insertions(+), 25 deletions(-) diff --git a/lustre/obdclass/llog_cat.c b/lustre/obdclass/llog_cat.c index 3d9cceb..85ebfba 100644 --- a/lustre/obdclass/llog_cat.c +++ b/lustre/obdclass/llog_cat.c @@ -725,17 +725,16 @@ int llog_cat_cancel_arr_rec(const struct lu_env *env, cat_index = loghandle->u.phd.phd_cookie.lgc_index; rc = llog_cat_cleanup(env, cathandle, loghandle, cat_index); if (rc) - CERROR("%s: fail to cancel catalog record: rc = %d\n", + CDEBUG(D_HA, + "%s: fail to cancel catalog record: rc = %d\n", loghandle2name(cathandle), rc); rc = 0; } llog_handle_put(env, loghandle); - - if (rc) - CERROR("%s: fail to cancel %d llog-records: rc = %d\n", - loghandle2name(cathandle), count, rc); - + if (rc != -ENOENT && rc != -ESTALE && rc != -EIO) + CWARN("%s: fail to cancel %d records in "DFID": rc = %d\n", + loghandle2name(cathandle), count, PLOGID(lgl), rc); RETURN(rc); } EXPORT_SYMBOL(llog_cat_cancel_arr_rec); @@ -753,7 +752,7 @@ int llog_cat_cancel_records(const struct lu_env *env, struct llog_handle *cathandle, int count, struct llog_cookie *cookies) { - int i, rc = 0, failed = 0; + int i, rc = 0; ENTRY; @@ -761,16 +760,11 @@ int llog_cat_cancel_records(const struct lu_env *env, int lrc; lrc = llog_cat_cancel_arr_rec(env, cathandle, &cookies->lgc_lgl, - 1, &cookies->lgc_index); - if (lrc) { - failed++; - if (!rc) - rc = lrc; - } + 1, &cookies->lgc_index); + if (lrc && !rc) + rc = lrc; } - if (failed) - CERROR("%s: fail to cancel %d of %d llog-records: rc = %d\n", - loghandle2name(cathandle), failed, count, rc); + RETURN(rc); } EXPORT_SYMBOL(llog_cat_cancel_records); diff --git a/lustre/obdclass/llog_osd.c b/lustre/obdclass/llog_osd.c index 3df71d1..e56483b 100644 --- a/lustre/obdclass/llog_osd.c +++ b/lustre/obdclass/llog_osd.c @@ -1235,7 +1235,7 @@ static struct dt_object *llog_osd_dir_get(const struct lu_env *env, return ERR_PTR(rc); dir = dt_locate(env, dt, &dti->dti_fid); - if (!IS_ERR(dir) && !dt_try_as_dir(env, dir, true)) { + if (!IS_ERR(dir) && !dt_try_as_dir(env, dir, false)) { dt_object_put(env, dir); return ERR_PTR(-ENOTDIR); } @@ -1442,7 +1442,7 @@ static struct dt_object *llog_osd_get_regular_fid_dir(const struct lu_env *env, if (IS_ERR(dir)) RETURN(dir); - if (!dt_try_as_dir(env, dir, true)) { + if (!dt_try_as_dir(env, dir, false)) { dt_object_put(env, dir); RETURN(ERR_PTR(-ENOTDIR)); } diff --git a/lustre/osp/osp_sync.c b/lustre/osp/osp_sync.c index 5c5fb7a..aa993d2 100644 --- a/lustre/osp/osp_sync.c +++ b/lustre/osp/osp_sync.c @@ -1077,13 +1077,9 @@ static void osp_sync_process_committed(const struct lu_env *env, ((i * sizeof(int)) == arr_size || (list_empty(&list) && i > 0))) { rc = llog_cat_cancel_arr_rec(env, llh, &lgid, i, arr); - - if (rc) - CERROR("%s: can't cancel %d records: rc = %d\n", - obd->obd_name, i, rc); - else - CDEBUG(D_OTHER, "%s: massive records cancel id "DFID" num %d\n", - obd->obd_name, PLOGID(&lgid), i); + CDEBUG(D_OTHER, + "%s: cancel %d records in "DFID": rc = %d\n", + obd->obd_name, i, PLOGID(&lgid), rc); i = 0; } -- 1.8.3.1