Whamcloud - gitweb
LU-11116 llog: error handling cleanup 80/32780/2
authorAlexander Boyko <c17825@cray.com>
Wed, 4 Jul 2018 10:41:52 +0000 (06:41 -0400)
committerOleg Drokin <green@whamcloud.com>
Sat, 18 Aug 2018 02:22:33 +0000 (02:22 +0000)
llog_cat_new_log() needs some error handling cleanup.
Save and restore thread lgi_cookie when using, to prevent
conflict/corruptions with llog_process_thread().

Signed-off-by: Alexander Boyko <c17825@cray.com>
Change-Id: I12fdfe1a72e77cfeb5ad464b8582db68a7bcfe16
Cray-bug-id: LUS-4780
Reviewed-on: https://review.whamcloud.com/32780
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andriy Skulysh <c17819@cray.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/obdclass/llog.c
lustre/obdclass/llog_cat.c

index 274ba97..53887ae 100644 (file)
@@ -198,6 +198,7 @@ int llog_cancel_rec(const struct lu_env *env, struct llog_handle *loghandle,
        struct dt_device        *dt;
        struct llog_log_hdr     *llh;
        struct thandle          *th;
+       __u32                    tmp_lgc_index;
        int                      rc;
        int rc1;
        bool subtract_count = false;
@@ -249,12 +250,19 @@ int llog_cancel_rec(const struct lu_env *env, struct llog_handle *loghandle,
 
        loghandle->lgh_hdr->llh_count--;
        subtract_count = true;
+
+       /* Since llog_process_thread use lgi_cookie, it`s better to save them
+        * and restore after using
+        */
+       tmp_lgc_index = lgi->lgi_cookie.lgc_index;
        /* Pass this index to llog_osd_write_rec(), which will use the index
         * to only update the necesary bitmap. */
        lgi->lgi_cookie.lgc_index = index;
        /* update header */
        rc = llog_write_rec(env, loghandle, &llh->llh_hdr, &lgi->lgi_cookie,
                            LLOG_HEADER_IDX, th);
+       lgi->lgi_cookie.lgc_index = tmp_lgc_index;
+
        if (rc != 0)
                GOTO(out_unlock, rc);
 
index ec28fa8..59a0950 100644 (file)
@@ -213,8 +213,10 @@ out_destroy:
        loghandle->lgh_hdr->llh_flags &= ~LLOG_F_ZAP_WHEN_EMPTY;
        /* this is to mimic full log, so another llog_cat_current_log()
         * can skip it and ask for another onet */
-       loghandle->lgh_last_idx = LLOG_HDR_BITMAP_SIZE(llh) + 1;
+       loghandle->lgh_last_idx = LLOG_HDR_BITMAP_SIZE(loghandle->lgh_hdr) + 1;
        llog_trans_destroy(env, loghandle, th);
+       if (handle != NULL)
+               dt_trans_stop(env, dt, handle);
        RETURN(rc);
 }