Whamcloud - gitweb
LU-15934 lod: renew the update llog 69/49569/3
authorYang Sheng <ys@whamcloud.com>
Fri, 6 Jan 2023 13:10:35 +0000 (21:10 +0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 19 May 2023 07:00:23 +0000 (07:00 +0000)
Skip and renew the update llog file while it was
corrupted.

Signed-off-by: Yang Sheng <ys@whamcloud.com>
Change-Id: I3491858dce42b4a8ed11db55ebbf8a12ef5f521d
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49569
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-by: Mikhail Pershin <mpershin@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/lod/lod_sub_object.c
lustre/obdclass/llog_osd.c

index c7f3cc7..b9820ce 100644 (file)
@@ -956,6 +956,7 @@ int lod_sub_prep_llog(const struct lu_env *env, struct lod_device *lod,
        }
 
        if (unlikely(logid_id(&cid->lci_logid) == 0)) {
+renew:
                rc = llog_open_create(env, ctxt, &lgh, NULL, NULL);
                if (rc < 0)
                        GOTO(out_put, rc);
@@ -966,8 +967,14 @@ int lod_sub_prep_llog(const struct lu_env *env, struct lod_device *lod,
        LASSERT(lgh != NULL);
 
        rc = llog_init_handle(env, lgh, LLOG_F_IS_CAT, NULL);
-       if (rc != 0)
+       if (rc) {
+               /* Update llog is corruption, renew it */
+               if (rc == -EIO && need_put == false) {
+                       llog_cat_close(env, lgh);
+                       GOTO(renew, 0);
+               }
                GOTO(out_close, rc);
+       }
 
        if (need_put) {
                rc = llog_osd_put_cat_list(env, dt, index, 1, cid, fid);
index 90aa6e9..4f9d774 100644 (file)
@@ -245,10 +245,10 @@ static int llog_osd_read_header(const struct lu_env *env,
                CERROR("%s: error reading "DFID" log header size %d: rc = %d\n",
                       o->do_lu.lo_dev->ld_obd->obd_name,
                       PFID(lu_object_fid(&o->do_lu)), rc < 0 ? 0 : rc,
-                      -EFAULT);
+                      -EIO);
 
                if (rc >= 0)
-                       rc = -EFAULT;
+                       rc = -EIO;
 
                GOTO(unlock, rc);
        }