From: phil Date: Tue, 9 Sep 2003 00:39:06 +0000 (+0000) Subject: - clear 'rc' if rc == LLOG_EMPTY in llog_init_handle, so we don't free X-Git-Tag: v1_7_0_51~2^7~570 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=60a38bb7033d3302f16a2baa569e60c96c21b6cb;p=fs%2Flustre-release.git - clear 'rc' if rc == LLOG_EMPTY in llog_init_handle, so we don't free the header and return an error that our caller doesn't expect - don't call llog_lvfs_pad if left == reclen, only if 0 < left < reclen - fix the uuid magic in llog_test - call llog_init_handle in the right places, and don't forget to close the log if one of the 1a checks fail --- diff --git a/lustre/obdclass/llog_test.c b/lustre/obdclass/llog_test.c index 172aebf..de9c055 100644 --- a/lustre/obdclass/llog_test.c +++ b/lustre/obdclass/llog_test.c @@ -34,6 +34,7 @@ #include static int llog_test_rand; +static struct obd_uuid uuid = { .uuid = "test_uuid" }; /* Test named-log create/open, close */ static int llog_test_1(struct obd_device *obd) @@ -50,19 +51,20 @@ static int llog_test_1(struct obd_device *obd) CERROR("1a: llog_create with name %s failed: %d\n", name, rc); RETURN(rc); } - llog_init_handle(llh, LLOG_F_IS_PLAIN, "test"); + llog_init_handle(llh, LLOG_F_IS_PLAIN, &uuid); if (llh->lgh_last_idx != 0) { CERROR("1a: handle->last_idx is %d, expected 0 after create\n", llh->lgh_last_idx); - RETURN(-ERANGE); + GOTO(out, rc = -ERANGE); } if (llh->lgh_hdr->llh_count != 0) { CERROR("1a: header->count is %d, expected 0 after create\n", llh->lgh_hdr->llh_count); - RETURN(-ERANGE); + GOTO(out, rc = -ERANGE); } + out: CERROR("1b: close newly-created log\n"); rc = llog_close(llh); if (rc) @@ -84,6 +86,7 @@ static int llog_test_2(struct obd_device *obd, struct llog_handle **llh) CERROR("2: re-open log with name %s failed: %d\n", name, rc); RETURN(rc); } + llog_init_handle(*llh, LLOG_F_IS_PLAIN, &uuid); if ((*llh)->lgh_last_idx != 0) { CERROR("2: handle->last_idx is %d, expected 0 after reopen\n",