Whamcloud - gitweb
- landing of b_hd_cleanup_merge to HEAD.
[fs/lustre-release.git] / lustre / lvfs / llog.c
index ae06d64..99bb653 100644 (file)
@@ -100,17 +100,23 @@ int llog_cancel_rec(struct llog_handle *loghandle, int index)
             (le32_to_cpu(llh->llh_count) == 1) &&
             (loghandle->lgh_last_idx == (LLOG_BITMAP_BYTES * 8) - 1)) {
                 rc = llog_destroy(loghandle);
-                if (rc)
+                if (rc) {
                         CERROR("failure destroying log after last cancel: %d\n",
                                rc);
-                LASSERT(rc == 0);
-                RETURN(1);
+                        ext2_set_bit(index, llh->llh_bitmap);
+                        llh->llh_count++;
+                } else {
+                        rc = 1;
+                }
+                RETURN(rc);
         }
 
         rc = llog_write_rec(loghandle, &llh->llh_hdr, NULL, 0, NULL, 0);
-        if (rc)
+        if (rc) {
                 CERROR("failure re-writing header %d\n", rc);
-        LASSERT(rc == 0);
+                ext2_set_bit(index, llh->llh_bitmap);
+                llh->llh_count++;
+        }
         RETURN(rc);
 }
 EXPORT_SYMBOL(llog_cancel_rec);
@@ -182,7 +188,7 @@ int llog_close(struct llog_handle *loghandle)
         if (rc)
                 GOTO(out, rc);
         if (lop->lop_close == NULL)
-                GOTO(out, -EOPNOTSUPP);
+                GOTO(out, rc = -EOPNOTSUPP);
         rc = lop->lop_close(loghandle);
  out:
         llog_free_handle(loghandle);