From: Yang Sheng Date: Fri, 6 Jan 2023 13:10:35 +0000 (+0800) Subject: LU-15934 lod: renew the update llog X-Git-Tag: 2.15.56~86 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=814691bcffab0a19240121740fb85a1912886a3c;p=fs%2Flustre-release.git LU-15934 lod: renew the update llog Skip and renew the update llog file while it was corrupted. Signed-off-by: Yang Sheng Change-Id: I3491858dce42b4a8ed11db55ebbf8a12ef5f521d Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49569 Reviewed-by: Andreas Dilger Reviewed-by: Lai Siyao Reviewed-by: Mikhail Pershin Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- diff --git a/lustre/lod/lod_sub_object.c b/lustre/lod/lod_sub_object.c index c7f3cc7..b9820ce 100644 --- a/lustre/lod/lod_sub_object.c +++ b/lustre/lod/lod_sub_object.c @@ -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); diff --git a/lustre/obdclass/llog_osd.c b/lustre/obdclass/llog_osd.c index 90aa6e9..4f9d774 100644 --- a/lustre/obdclass/llog_osd.c +++ b/lustre/obdclass/llog_osd.c @@ -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); }