Whamcloud - gitweb
LU-15644 llog: don't replace llog error with -ENOTDIR 51/55151/2
authorMikhail Pershin <mpershin@whamcloud.com>
Sat, 18 May 2024 19:43:05 +0000 (22:43 +0300)
committerOleg Drokin <green@whamcloud.com>
Wed, 5 Jun 2024 04:52:04 +0000 (04:52 +0000)
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 <mpershin@whamcloud.com>
Change-Id: Id404204566898a6ac2e258b7824491effc5fc92e
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55151
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/obdclass/llog_cat.c
lustre/obdclass/llog_osd.c
lustre/osp/osp_sync.c

index 3d9cceb..85ebfba 100644 (file)
@@ -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);
index 3df71d1..e56483b 100644 (file)
@@ -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));
        }
index 5c5fb7a..aa993d2 100644 (file)
@@ -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;
                }