Whamcloud - gitweb
LU-9983 llog: skip non-exist log cancellation 18/29218/4
authorDi Wang <di.wang@intel.com>
Tue, 26 Sep 2017 05:33:50 +0000 (01:33 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 22 Nov 2017 03:54:35 +0000 (03:54 +0000)
Let's skip the record cancellation if the llog does
not exist at all, which usually happens when remote
log creation failed.

Signed-off-by: Di Wang <di.wang@intel.com>
Change-Id: If76d29d8fd72f3c5b619b72a899b18459c608dbb
Reviewed-on: https://review.whamcloud.com/29218
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
lustre/obdclass/llog_cat.c

index 8771d68..084edea 100644 (file)
@@ -754,16 +754,38 @@ int llog_cat_cancel_records(const struct lu_env *env,
                        continue;
                }
 
+               if ((cathandle->lgh_ctxt->loc_flags &
+                    LLOG_CTXT_FLAG_NORMAL_FID) && !llog_exist(loghandle)) {
+                       /* For update log, some of loghandles of cathandle
+                        * might not exist because remote llog creation might
+                        * be failed, so let's skip the record cancellation
+                        * for these non-exist llogs.
+                        */
+                       lrc = -ENOENT;
+                       CDEBUG(D_HA, "%s: llog "DFID":%x does not exist"
+                              ": rc = %d\n",
+                              cathandle->lgh_ctxt->loc_obd->obd_name,
+                              PFID(&lgl->lgl_oi.oi_fid), lgl->lgl_ogen, lrc);
+                       failed++;
+                       if (rc == 0)
+                               rc = lrc;
+                       continue;
+               }
+
                lrc = llog_cancel_rec(env, loghandle, cookies->lgc_index);
                if (lrc == LLOG_DEL_PLAIN) { /* log has been destroyed */
                        index = loghandle->u.phd.phd_cookie.lgc_index;
-                       rc = llog_cat_cleanup(env, cathandle, loghandle, index);
+                       lrc = llog_cat_cleanup(env, cathandle, loghandle,
+                                              index);
+                       if (rc == 0)
+                               rc = lrc;
                } else if (lrc == -ENOENT) {
                        if (rc == 0) /* ENOENT shouldn't rewrite any error */
                                rc = lrc;
                } else if (lrc < 0) {
                        failed++;
-                       rc = lrc;
+                       if (rc == 0)
+                               rc = lrc;
                }
                llog_handle_put(loghandle);
        }