(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);
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);
/* process records in buffer, starting where we found one */
while ((void *)rec < buf + LLOG_CHUNK_SIZE) {
if (rec->lrh_index == 0)
- GOTO(out, 0); /* no more records */
+ GOTO(out, rc = 0); /* no more records */
/* if set, process the callback on this record */
if (ext2_test_bit(index, llh->llh_bitmap)) {
loghandle->lgh_id.lgl_oid,
loghandle->lgh_id.lgl_ogen);
GOTO(out, rc);
- }
+ } else if (rc == LLOG_DEL_RECORD) {
+ llog_cancel_rec(loghandle, rec->lrh_index);
+ rc = 0;
+ }
if (rc)
GOTO(out, rc);
}
-
/* next record, still in buffer? */
++index;
if (index > last_index)