Whamcloud - gitweb
LU-15644 llog: don't replace llog error with -ENOTDIR
authorMikhail Pershin <mpershin@whamcloud.com>
Sat, 18 May 2024 19:43:05 +0000 (22:43 +0300)
committerAndreas Dilger <adilger@whamcloud.com>
Thu, 6 Jun 2024 08:05:22 +0000 (08:05 +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

Lustre-change: https://review.whamcloud.com/55151
Lustre-commit: bd9839f7dbdf59751e7cdc234602eb338c518104

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/ex/lustre-release/+/55152
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/obdclass/llog_cat.c
lustre/obdclass/llog_osd.c
lustre/osp/osp_sync.c

index 451c4c4..89d49b4 100644 (file)
@@ -726,18 +726,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);
@@ -755,7 +753,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;
 
@@ -763,16 +761,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 9f366fd..7fa25e0 100644 (file)
@@ -1237,7 +1237,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);
                }
@@ -1444,7 +1444,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 fd6c415..6a84310 100644 (file)
@@ -1075,13 +1075,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;
                }