X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fobdclass%2Fllog_test.c;h=d03f0bd8d3e7b2179ad7a7fb5c3529aec28116cb;hb=313da5b87dbb6db3b8d75b039fc10474d42ee22f;hp=cc2eea0e4551a82c241ad351663bf186e7a0de48;hpb=7068276e2bf22c3e9885f366a69ac1d4cfc1974e;p=fs%2Flustre-release.git diff --git a/lustre/obdclass/llog_test.c b/lustre/obdclass/llog_test.c index cc2eea0..d03f0bd 100644 --- a/lustre/obdclass/llog_test.c +++ b/lustre/obdclass/llog_test.c @@ -26,7 +26,7 @@ * GPL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. */ /* @@ -184,7 +184,7 @@ static int llog_test_3(struct obd_device *obd, struct llog_handle *llh) struct llog_create_rec lcr; int rc, i; int num_recs = 1; /* 1 for the header */ - ENTRY; + ENTRY; lcr.lcr_hdr.lrh_len = lcr.lcr_tail.lrt_len = sizeof(lcr); lcr.lcr_hdr.lrh_type = OST_SZ_REC; @@ -258,9 +258,9 @@ static int llog_test_3(struct obd_device *obd, struct llog_handle *llh) if (rc == -ENOSPC) { break; } else { - CERROR("3c: write recs failed at #%d: %d\n", - i + 1, rc); - RETURN(rc); + CERROR("3c: write recs failed at #%d: %d\n", + i + 1, rc); + RETURN(rc); } } num_recs++; @@ -449,7 +449,7 @@ static int llog_test_5(struct obd_device *obd) } CWARN("5c: Cancel 40000 records, see one log zapped\n"); - rc = llog_cat_process(llh, llog_cancel_rec_cb, "foobar"); + rc = llog_cat_process(llh, llog_cancel_rec_cb, "foobar", 0, 0); if (rc != -4711) { CERROR("5c: process with cat_cancel_cb failed: %d\n", rc); GOTO(out, rc); @@ -471,7 +471,7 @@ static int llog_test_5(struct obd_device *obd) } CWARN("5e: print plain log entries.. expect 6\n"); - rc = llog_cat_process(llh, plain_print_cb, "foobar"); + rc = llog_cat_process(llh, plain_print_cb, "foobar", 0, 0); if (rc) { CERROR("5e: process with plain_print_cb failed: %d\n", rc); GOTO(out, rc); @@ -501,7 +501,6 @@ static int llog_test_6(struct obd_device *obd, char *name) struct obd_device *mgc_obd; struct llog_ctxt *ctxt = llog_get_context(obd, LLOG_TEST_ORIG_CTXT); struct obd_uuid *mgs_uuid = &ctxt->loc_exp->exp_obd->obd_uuid; - struct lustre_handle exph = {0, }; struct obd_export *exp; struct obd_uuid uuid = {"LLOG_TEST6_UUID"}; struct llog_handle *llh = NULL; @@ -516,13 +515,15 @@ static int llog_test_6(struct obd_device *obd, char *name) GOTO(ctxt_release, rc = -ENOENT); } - rc = obd_connect(NULL, &exph, mgc_obd, &uuid, + rc = obd_connect(NULL, &exp, mgc_obd, &uuid, NULL /* obd_connect_data */, NULL); - if (rc) { - CERROR("6: failed to connect to MGC: %s\n", mgc_obd->obd_name); - GOTO(ctxt_release, rc); + if (rc != -EALREADY) { + CERROR("6: connect on connected MDC (%s) failed to return" + " -EALREADY", mgc_obd->obd_name); + if (rc == 0) + obd_disconnect(exp); + GOTO(ctxt_release, rc = -EINVAL); } - exp = class_conn2export(&exph); nctxt = llog_get_context(mgc_obd, LLOG_CONFIG_REPL_CTXT); rc = llog_create(nctxt, &llh, NULL, name); @@ -552,7 +553,6 @@ parse_out: if (rc) { CERROR("6: llog_close failed: rc = %d\n", rc); } - rc = obd_disconnect(exp); ctxt_release: llog_ctxt_put(ctxt); RETURN(rc); @@ -658,8 +658,7 @@ static int llog_run_tests(struct obd_device *obd) static int llog_test_llog_init(struct obd_device *obd, struct obd_llog_group *olg, - struct obd_device *tgt, int count, - struct llog_catid *logid, struct obd_uuid *uuid) + struct obd_device *tgt, int *index) { int rc; ENTRY; @@ -715,6 +714,7 @@ static int llog_test_setup(struct obd_device *obd, struct lustre_cfg *lcfg) RETURN(-EINVAL); } + /* disk obd */ tgt = class_name2obd(lustre_cfg_string(lcfg, 1)); if (!tgt || !tgt->obd_attached || !tgt->obd_set_up) { CERROR("target device not attached or not set up (%s)\n", @@ -722,11 +722,11 @@ static int llog_test_setup(struct obd_device *obd, struct lustre_cfg *lcfg) RETURN(-EINVAL); } - rc = obd_llog_init(obd, OBD_LLOG_GROUP, tgt, 0, NULL, NULL); + rc = obd_llog_init(obd, NULL, tgt, NULL); if (rc) RETURN(rc); - llog_test_rand = ll_rand(); + llog_test_rand = cfs_rand(); rc = llog_run_tests(obd); if (rc)