/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=8:tabstop=8:
*
- * Copyright (C) 2001, 2002 Cluster File Systems, Inc.
- * Authors: Isaac Huang <isaac@clusterfs.com>
- * Liang Zhen <liangzhen@clusterfs.com>
+ * GPL HEADER START
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Use is subject to license terms.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
+ *
+ * lnet/selftest/framework.c
+ *
+ * Author: Isaac Huang <isaac@clusterfs.com>
+ * Author: Liang Zhen <liangzhen@clusterfs.com>
*/
#define DEBUG_SUBSYSTEM S_LNET
-#include <libcfs/kp30.h>
-#include <libcfs/libcfs.h>
-#include <lnet/lib-lnet.h>
-
#include "selftest.h"
+int brw_inject_errors = 0;
+CFS_MODULE_PARM(brw_inject_errors, "i", int, 0644,
+ "# data errors to inject randomly, zero by default");
static int session_timeout = 100;
CFS_MODULE_PARM(session_timeout, "i", int, 0444,
#define sfw_unpack_fw_counters(fc) \
do { \
__swab32s(&(fc).brw_errors); \
+ __swab32s(&(fc).ping_errors); \
__swab32s(&(fc).active_tests); \
__swab32s(&(fc).active_batches); \
__swab32s(&(fc).zombie_sessions); \
int nactive = 0;
sfw_batch_t *tsb;
- if (sn == NULL)
- return;
+ if (sn == NULL) return;
LASSERT (!sn->sn_timer_active);
CFS_INIT_LIST_HEAD(&sn->sn_list);
CFS_INIT_LIST_HEAD(&sn->sn_batches);
atomic_set(&sn->sn_brw_errors, 0);
+ atomic_set(&sn->sn_ping_errors, 0);
strncpy(&sn->sn_name[0], name, LST_NAME_SIZE);
sn->sn_timer_active = 0;
srpc_get_counters(&reply->str_rpc);
cnt->brw_errors = atomic_read(&sn->sn_brw_errors);
+ cnt->ping_errors = atomic_read(&sn->sn_ping_errors);
cnt->zombie_sessions = atomic_read(&sfw_data.fw_nzombies);
cnt->active_tests = cnt->active_batches = 0;
srpc_client_rpc_t *rpc;
sfw_test_unit_t *tsu;
- if (!tsi->tsi_is_client)
- goto clean;
+ if (!tsi->tsi_is_client) goto clean;
tsi->tsi_ops->tso_fini(tsi);
CFS_INIT_LIST_HEAD(&tsi->tsi_free_rpcs);
CFS_INIT_LIST_HEAD(&tsi->tsi_active_rpcs);
- tsi->tsi_stopping = 0;
- tsi->tsi_batch = tsb;
- tsi->tsi_loop = req->tsr_loop;
- tsi->tsi_concur = req->tsr_concur;
- tsi->tsi_service = req->tsr_service;
- tsi->tsi_is_client = !!(req->tsr_is_client);
- tsi->tsi_stop_onerr = !!(req->tsr_stop_onerr);
+ tsi->tsi_stopping = 0;
+ tsi->tsi_batch = tsb;
+ tsi->tsi_loop = req->tsr_loop;
+ tsi->tsi_concur = req->tsr_concur;
+ tsi->tsi_service = req->tsr_service;
+ tsi->tsi_is_client = !!(req->tsr_is_client);
+ tsi->tsi_stoptsu_onerr = !!(req->tsr_stop_onerr);
rc = sfw_load_test(tsi);
if (rc != 0) {
sfw_test_instance_t *tsi = tsu->tsu_instance;
int done = 0;
- if (rpc->crpc_status != 0 && tsu->tsu_error == 0 &&
- (rpc->crpc_status != -EINTR || !tsi->tsi_stopping))
- tsu->tsu_error = rpc->crpc_status;
-
tsi->tsi_ops->tso_done_rpc(tsu, rpc);
spin_lock(&tsi->tsi_lock);
/* batch is stopping or loop is done or get error */
if (tsi->tsi_stopping ||
tsu->tsu_loop == 0 ||
- (tsu->tsu_error != 0 && tsi->tsi_stop_onerr))
+ (rpc->crpc_status != 0 && tsi->tsi_stoptsu_onerr))
done = 1;
/* dec ref for poster */
LASSERT (wi == &tsu->tsu_worker);
- tsu->tsu_error = tsi->tsi_ops->tso_prep_rpc(tsu, tsu->tsu_dest, &rpc);
- if (tsu->tsu_error != 0) {
+ if (tsi->tsi_ops->tso_prep_rpc(tsu, tsu->tsu_dest, &rpc) != 0) {
LASSERT (rpc == NULL);
goto test_done;
}
list_for_each_entry (tsu, &tsi->tsi_units, tsu_list) {
atomic_inc(&tsi->tsi_nactive);
-
- tsu->tsu_error = 0;
- tsu->tsu_loop = tsi->tsi_loop;
-
+ tsu->tsu_loop = tsi->tsi_loop;
wi = &tsu->tsu_worker;
swi_init_workitem(wi, tsu, sfw_run_test);
swi_schedule_workitem(wi);
srpc_service_t *sv;
sfw_test_case_t *tsc;
+#ifndef __KERNEL__
+ char *s;
+
+ s = getenv("SESSION_TIMEOUT");
+ session_timeout = s != NULL ? atoi(s) : session_timeout;
+
+ s = getenv("BRW_INJECT_ERRORS");
+ brw_inject_errors = s != NULL ? atoi(s) : brw_inject_errors;
+#endif
+
if (session_timeout < 0) {
CERROR ("Session timeout must be non-negative: %d\n",
session_timeout);
if (session_timeout == 0)
CWARN ("Zero session_timeout specified "
- "- test sessions never timeout.\n");
+ "- test sessions never expire.\n");
memset(&sfw_data, 0, sizeof(struct smoketest_framework));