Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-8056 llite: use inode_lock to access i_mutex
[fs/lustre-release.git]
/
lnet
/
selftest
/
console.c
diff --git
a/lnet/selftest/console.c
b/lnet/selftest/console.c
index
34cf28f
..
f951c17
100644
(file)
--- a/
lnet/selftest/console.c
+++ b/
lnet/selftest/console.c
@@
-27,7
+27,7
@@
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012,
2014,
Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
*/
/*
* This file is part of Lustre, http://www.lustre.org/
@@
-40,7
+40,6
@@
* Author: Liang Zhen <liangzhen@clusterfs.com>
*/
* Author: Liang Zhen <liangzhen@clusterfs.com>
*/
-#ifdef __KERNEL__
#include <libcfs/libcfs.h>
#include <lnet/lib-lnet.h>
#include <libcfs/libcfs.h>
#include <lnet/lib-lnet.h>
@@
-62,7
+61,7
@@
do { \
lstcon_session_t console_session;
lstcon_session_t console_session;
-void
+
static
void
lstcon_node_get(lstcon_node_t *nd)
{
LASSERT (nd->nd_ref >= 1);
lstcon_node_get(lstcon_node_t *nd)
{
LASSERT (nd->nd_ref >= 1);
@@
-88,7
+87,7
@@
lstcon_node_find(lnet_process_id_t id, lstcon_node_t **ndpp, int create)
*ndpp = ndl->ndl_node;
return 0;
}
*ndpp = ndl->ndl_node;
return 0;
}
-
+
if (!create)
return -ENOENT;
if (!create)
return -ENOENT;
@@
-116,7
+115,7
@@
lstcon_node_find(lnet_process_id_t id, lstcon_node_t **ndpp, int create)
return 0;
}
return 0;
}
-void
+
static
void
lstcon_node_put(lstcon_node_t *nd)
{
lstcon_ndlink_t *ndl;
lstcon_node_put(lstcon_node_t *nd)
{
lstcon_ndlink_t *ndl;
@@
-173,7
+172,7
@@
lstcon_ndlink_find(struct list_head *hash,
lstcon_node_put(nd);
return -ENOMEM;
}
lstcon_node_put(nd);
return -ENOMEM;
}
-
+
*ndlpp = ndl;
ndl->ndl_node = nd;
*ndlpp = ndl;
ndl->ndl_node = nd;
@@
-206,9
+205,6
@@
lstcon_group_alloc(char *name, lstcon_group_t **grpp)
if (grp == NULL)
return -ENOMEM;
if (grp == NULL)
return -ENOMEM;
- memset(grp, 0, offsetof(lstcon_group_t,
- grp_ndl_hash[LST_NODE_HASHSIZE]));
-
grp->grp_ref = 1;
if (name != NULL) {
if (strlen(name) > sizeof(grp->grp_name)-1) {
grp->grp_ref = 1;
if (name != NULL) {
if (strlen(name) > sizeof(grp->grp_name)-1) {
@@
-288,12
+284,6
@@
lstcon_group_find(const char *name, lstcon_group_t **grpp)
return -ENOENT;
}
return -ENOENT;
}
-static void
-lstcon_group_put(lstcon_group_t *grp)
-{
- lstcon_group_decref(grp);
-}
-
static int
lstcon_group_ndlink_find(lstcon_group_t *grp, lnet_process_id_t id,
lstcon_ndlink_t **ndlpp, int create)
static int
lstcon_group_ndlink_find(lstcon_group_t *grp, lnet_process_id_t id,
lstcon_ndlink_t **ndlpp, int create)
@@
-351,7
+341,7
@@
lstcon_group_move(lstcon_group_t *old, lstcon_group_t *new)
}
}
}
}
-int
+
static
int
lstcon_sesrpc_condition(int transop, lstcon_node_t *nd, void *arg)
{
lstcon_group_t *grp = (lstcon_group_t *)arg;
lstcon_sesrpc_condition(int transop, lstcon_node_t *nd, void *arg)
{
lstcon_group_t *grp = (lstcon_group_t *)arg;
@@
-380,9
+370,9
@@
lstcon_sesrpc_condition(int transop, lstcon_node_t *nd, void *arg)
return 1;
}
return 1;
}
-int
+
static
int
lstcon_sesrpc_readent(int transop, srpc_msg_t *msg,
lstcon_sesrpc_readent(int transop, srpc_msg_t *msg,
-
lstcon_rpc_ent_t
*ent_up)
+
lstcon_rpc_ent_t __user
*ent_up)
{
srpc_debug_reply_t *rep;
{
srpc_debug_reply_t *rep;
@@
-411,8
+401,8
@@
lstcon_sesrpc_readent(int transop, srpc_msg_t *msg,
static int
lstcon_group_nodes_add(lstcon_group_t *grp,
static int
lstcon_group_nodes_add(lstcon_group_t *grp,
- int count, lnet_process_id_t *ids_up,
- unsigned *featp, struct list_head *result_up)
+ int count, lnet_process_id_t
__user
*ids_up,
+ unsigned *featp, struct list_head
__user
*result_up)
{
lstcon_rpc_trans_t *trans;
lstcon_ndlink_t *ndl;
{
lstcon_rpc_trans_t *trans;
lstcon_ndlink_t *ndl;
@@
-447,7
+437,7
@@
lstcon_group_nodes_add(lstcon_group_t *grp,
}
if (rc != 0) {
}
if (rc != 0) {
-
lstcon_group_put
(tmp);
+
lstcon_group_decref
(tmp);
return rc;
}
return rc;
}
@@
-456,7
+446,7
@@
lstcon_group_nodes_add(lstcon_group_t *grp,
tmp, lstcon_sesrpc_condition, &trans);
if (rc != 0) {
CERROR("Can't create transaction: %d\n", rc);
tmp, lstcon_sesrpc_condition, &trans);
if (rc != 0) {
CERROR("Can't create transaction: %d\n", rc);
-
lstcon_group_put
(tmp);
+
lstcon_group_decref
(tmp);
return rc;
}
return rc;
}
@@
-471,15
+461,15
@@
lstcon_group_nodes_add(lstcon_group_t *grp,
lstcon_rpc_trans_destroy(trans);
lstcon_group_move(tmp, grp);
lstcon_rpc_trans_destroy(trans);
lstcon_group_move(tmp, grp);
-
lstcon_group_put
(tmp);
+
lstcon_group_decref
(tmp);
return rc;
}
static int
lstcon_group_nodes_remove(lstcon_group_t *grp,
return rc;
}
static int
lstcon_group_nodes_remove(lstcon_group_t *grp,
-
int count, lnet_process_id_t
*ids_up,
- struct list_head *result_up)
+
int count, lnet_process_id_t __user
*ids_up,
+ struct list_head
__user
*result_up)
{
lstcon_rpc_trans_t *trans;
lstcon_ndlink_t *ndl;
{
lstcon_rpc_trans_t *trans;
lstcon_ndlink_t *ndl;
@@
-501,7
+491,7
@@
lstcon_group_nodes_remove(lstcon_group_t *grp,
rc = -EFAULT;
goto error;
}
rc = -EFAULT;
goto error;
}
-
+
/* move node to tmp group */
if (lstcon_group_ndlink_find(grp, id, &ndl, 0) == 0)
lstcon_group_ndlink_move(grp, tmp, ndl);
/* move node to tmp group */
if (lstcon_group_ndlink_find(grp, id, &ndl, 0) == 0)
lstcon_group_ndlink_move(grp, tmp, ndl);
@@
-521,12
+511,12
@@
lstcon_group_nodes_remove(lstcon_group_t *grp,
lstcon_rpc_trans_destroy(trans);
/* release nodes anyway, because we can't rollback status */
lstcon_rpc_trans_destroy(trans);
/* release nodes anyway, because we can't rollback status */
-
lstcon_group_put
(tmp);
+
lstcon_group_decref
(tmp);
return rc;
error:
lstcon_group_move(tmp, grp);
return rc;
error:
lstcon_group_move(tmp, grp);
-
lstcon_group_put
(tmp);
+
lstcon_group_decref
(tmp);
return rc;
}
return rc;
}
@@
-540,7
+530,7
@@
lstcon_group_add(char *name)
rc = (lstcon_group_find(name, &grp) == 0)? -EEXIST: 0;
if (rc != 0) {
/* find a group with same name */
rc = (lstcon_group_find(name, &grp) == 0)? -EEXIST: 0;
if (rc != 0) {
/* find a group with same name */
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return rc;
}
return rc;
}
@@
-556,8
+546,8
@@
lstcon_group_add(char *name)
}
int
}
int
-lstcon_nodes_add(char *name, int count, lnet_process_id_t *ids_up,
- unsigned *featp, struct list_head *result_up)
+lstcon_nodes_add(char *name, int count, lnet_process_id_t
__user
*ids_up,
+ unsigned *featp, struct list_head
__user
*result_up)
{
lstcon_group_t *grp;
int rc;
{
lstcon_group_t *grp;
int rc;
@@
-574,14
+564,14
@@
lstcon_nodes_add(char *name, int count, lnet_process_id_t *ids_up,
if (grp->grp_ref > 2) {
/* referred by other threads or test */
CDEBUG(D_NET, "Group %s is busy\n", name);
if (grp->grp_ref > 2) {
/* referred by other threads or test */
CDEBUG(D_NET, "Group %s is busy\n", name);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return -EBUSY;
}
rc = lstcon_group_nodes_add(grp, count, ids_up, featp, result_up);
return -EBUSY;
}
rc = lstcon_group_nodes_add(grp, count, ids_up, featp, result_up);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return rc;
}
return rc;
}
@@
-602,7
+592,7
@@
lstcon_group_del(char *name)
if (grp->grp_ref > 2) {
/* referred by others threads or test */
CDEBUG(D_NET, "Group %s is busy\n", name);
if (grp->grp_ref > 2) {
/* referred by others threads or test */
CDEBUG(D_NET, "Group %s is busy\n", name);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return -EBUSY;
}
return -EBUSY;
}
@@
-611,7
+601,7
@@
lstcon_group_del(char *name)
grp, lstcon_sesrpc_condition, &trans);
if (rc != 0) {
CERROR("Can't create transaction: %d\n", rc);
grp, lstcon_sesrpc_condition, &trans);
if (rc != 0) {
CERROR("Can't create transaction: %d\n", rc);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return rc;
}
return rc;
}
@@
-619,10
+609,10
@@
lstcon_group_del(char *name)
lstcon_rpc_trans_destroy(trans);
lstcon_rpc_trans_destroy(trans);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
/* -ref for session, it's destroyed,
* status can't be rolled back, destroy group anway */
/* -ref for session, it's destroyed,
* status can't be rolled back, destroy group anway */
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return rc;
}
return rc;
}
@@
-642,7
+632,7
@@
lstcon_group_clean(char *name, int args)
if (grp->grp_ref > 2) {
/* referred by test */
CDEBUG(D_NET, "Group %s is busy\n", name);
if (grp->grp_ref > 2) {
/* referred by test */
CDEBUG(D_NET, "Group %s is busy\n", name);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return -EBUSY;
}
return -EBUSY;
}
@@
-651,17
+641,18
@@
lstcon_group_clean(char *name, int args)
lstcon_group_drain(grp, args);
lstcon_group_drain(grp, args);
- lstcon_group_
put
(grp);
+ lstcon_group_
decref
(grp);
/* release empty group */
if (list_empty(&grp->grp_ndl_list))
/* release empty group */
if (list_empty(&grp->grp_ndl_list))
- lstcon_group_
put
(grp);
+ lstcon_group_
decref
(grp);
return 0;
}
int
lstcon_nodes_remove(char *name, int count,
return 0;
}
int
lstcon_nodes_remove(char *name, int count,
- lnet_process_id_t *ids_up, struct list_head *result_up)
+ lnet_process_id_t __user *ids_up,
+ struct list_head __user *result_up)
{
lstcon_group_t *grp = NULL;
int rc;
{
lstcon_group_t *grp = NULL;
int rc;
@@
-675,22
+666,22
@@
lstcon_nodes_remove(char *name, int count,
if (grp->grp_ref > 2) {
/* referred by test */
CDEBUG(D_NET, "Group %s is busy\n", name);
if (grp->grp_ref > 2) {
/* referred by test */
CDEBUG(D_NET, "Group %s is busy\n", name);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return -EBUSY;
}
rc = lstcon_group_nodes_remove(grp, count, ids_up, result_up);
return -EBUSY;
}
rc = lstcon_group_nodes_remove(grp, count, ids_up, result_up);
- lstcon_group_
put
(grp);
+ lstcon_group_
decref
(grp);
/* release empty group */
if (list_empty(&grp->grp_ndl_list))
/* release empty group */
if (list_empty(&grp->grp_ndl_list))
- lstcon_group_
put
(grp);
+ lstcon_group_
decref
(grp);
return rc;
}
int
return rc;
}
int
-lstcon_group_refresh(char *name, struct list_head *result_up)
+lstcon_group_refresh(char *name, struct list_head
__user
*result_up)
{
lstcon_rpc_trans_t *trans;
lstcon_group_t *grp;
{
lstcon_rpc_trans_t *trans;
lstcon_group_t *grp;
@@
-705,7
+696,7
@@
lstcon_group_refresh(char *name, struct list_head *result_up)
if (grp->grp_ref > 2) {
/* referred by test */
CDEBUG(D_NET, "Group %s is busy\n", name);
if (grp->grp_ref > 2) {
/* referred by test */
CDEBUG(D_NET, "Group %s is busy\n", name);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return -EBUSY;
}
return -EBUSY;
}
@@
-716,7
+707,7
@@
lstcon_group_refresh(char *name, struct list_head *result_up)
if (rc != 0) {
/* local error, return */
CDEBUG(D_NET, "Can't create transaction: %d\n", rc);
if (rc != 0) {
/* local error, return */
CDEBUG(D_NET, "Can't create transaction: %d\n", rc);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return rc;
}
return rc;
}
@@
-726,13
+717,13
@@
lstcon_group_refresh(char *name, struct list_head *result_up)
lstcon_rpc_trans_destroy(trans);
/* -ref for me */
lstcon_rpc_trans_destroy(trans);
/* -ref for me */
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return rc;
}
int
return rc;
}
int
-lstcon_group_list(int index, int len, char *name_up)
+lstcon_group_list(int index, int len, char
__user
*name_up)
{
lstcon_group_t *grp;
{
lstcon_group_t *grp;
@@
-751,7
+742,7
@@
lstcon_group_list(int index, int len, char *name_up)
static int
lstcon_nodes_getent(struct list_head *head, int *index_p,
static int
lstcon_nodes_getent(struct list_head *head, int *index_p,
-
int *count_p, lstcon_node_ent_t
*dents_up)
+
int *count_p, lstcon_node_ent_t __user
*dents_up)
{
lstcon_ndlink_t *ndl;
lstcon_node_t *nd;
{
lstcon_ndlink_t *ndl;
lstcon_node_t *nd;
@@
-790,8
+781,9
@@
lstcon_nodes_getent(struct list_head *head, int *index_p,
}
int
}
int
-lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p,
- int *index_p, int *count_p, lstcon_node_ent_t *dents_up)
+lstcon_group_info(char *name, lstcon_ndlist_ent_t __user *gents_p,
+ int *index_p, int *count_p,
+ lstcon_node_ent_t __user *dents_up)
{
lstcon_ndlist_ent_t *gentp;
lstcon_group_t *grp;
{
lstcon_ndlist_ent_t *gentp;
lstcon_group_t *grp;
@@
-804,11
+796,11
@@
lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p,
return rc;
}
return rc;
}
-
if (dents_up != 0
) {
+
if (dents_up != NULL
) {
/* verbose query */
rc = lstcon_nodes_getent(&grp->grp_ndl_list,
index_p, count_p, dents_up);
/* verbose query */
rc = lstcon_nodes_getent(&grp->grp_ndl_list,
index_p, count_p, dents_up);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return rc;
}
return rc;
}
@@
-817,13
+809,11
@@
lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p,
LIBCFS_ALLOC(gentp, sizeof(lstcon_ndlist_ent_t));
if (gentp == NULL) {
CERROR("Can't allocate ndlist_ent\n");
LIBCFS_ALLOC(gentp, sizeof(lstcon_ndlist_ent_t));
if (gentp == NULL) {
CERROR("Can't allocate ndlist_ent\n");
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return -ENOMEM;
}
return -ENOMEM;
}
- memset(gentp, 0, sizeof(lstcon_ndlist_ent_t));
-
list_for_each_entry(ndl, &grp->grp_ndl_list, ndl_link)
LST_NODE_STATE_COUNTER(ndl->ndl_node, gentp);
list_for_each_entry(ndl, &grp->grp_ndl_list, ndl_link)
LST_NODE_STATE_COUNTER(ndl->ndl_node, gentp);
@@
-832,7
+822,7
@@
lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p,
LIBCFS_FREE(gentp, sizeof(lstcon_ndlist_ent_t));
LIBCFS_FREE(gentp, sizeof(lstcon_ndlist_ent_t));
- lstcon_group_
put
(grp);
+ lstcon_group_
decref
(grp);
return 0;
}
return 0;
}
@@
-919,7
+909,7
@@
lstcon_batch_add(char *name)
}
int
}
int
-lstcon_batch_list(int index, int len, char *name_up)
+lstcon_batch_list(int index, int len, char
__user
*name_up)
{
lstcon_batch_t *bat;
{
lstcon_batch_t *bat;
@@
-937,9
+927,9
@@
lstcon_batch_list(int index, int len, char *name_up)
}
int
}
int
-lstcon_batch_info(char *name, lstcon_test_batch_ent_t
*ent_up, int server
,
- int testidx, int *index_p, int *ndent_p,
-
lstcon_node_ent_t
*dents_up)
+lstcon_batch_info(char *name, lstcon_test_batch_ent_t
__user *ent_up
,
+
int server,
int testidx, int *index_p, int *ndent_p,
+
lstcon_node_ent_t __user
*dents_up)
{
lstcon_test_batch_ent_t *entp;
struct list_head *clilst;
{
lstcon_test_batch_ent_t *entp;
struct list_head *clilst;
@@
-984,8
+974,6
@@
lstcon_batch_info(char *name, lstcon_test_batch_ent_t *ent_up, int server,
if (entp == NULL)
return -ENOMEM;
if (entp == NULL)
return -ENOMEM;
- memset(entp, 0, sizeof(lstcon_test_batch_ent_t));
-
if (test == NULL) {
entp->u.tbe_batch.bae_ntest = bat->bat_ntest;
entp->u.tbe_batch.bae_state = bat->bat_state;
if (test == NULL) {
entp->u.tbe_batch.bae_ntest = bat->bat_ntest;
entp->u.tbe_batch.bae_state = bat->bat_state;
@@
-1011,7
+999,7
@@
lstcon_batch_info(char *name, lstcon_test_batch_ent_t *ent_up, int server,
return rc;
}
return rc;
}
-int
+
static
int
lstcon_batrpc_condition(int transop, lstcon_node_t *nd, void *arg)
{
switch (transop) {
lstcon_batrpc_condition(int transop, lstcon_node_t *nd, void *arg)
{
switch (transop) {
@@
-1035,7
+1023,7
@@
lstcon_batrpc_condition(int transop, lstcon_node_t *nd, void *arg)
static int
lstcon_batch_op(lstcon_batch_t *bat, int transop,
static int
lstcon_batch_op(lstcon_batch_t *bat, int transop,
- struct list_head *result_up)
+ struct list_head
__user
*result_up)
{
lstcon_rpc_trans_t *trans;
int rc;
{
lstcon_rpc_trans_t *trans;
int rc;
@@
-1058,7
+1046,7
@@
lstcon_batch_op(lstcon_batch_t *bat, int transop,
}
int
}
int
-lstcon_batch_run(char *name, int timeout, struct list_head *result_up)
+lstcon_batch_run(char *name, int timeout, struct list_head
__user
*result_up)
{
lstcon_batch_t *bat;
int rc;
{
lstcon_batch_t *bat;
int rc;
@@
-1080,7
+1068,7
@@
lstcon_batch_run(char *name, int timeout, struct list_head *result_up)
}
int
}
int
-lstcon_batch_stop(char *name, int force, struct list_head *result_up)
+lstcon_batch_stop(char *name, int force, struct list_head
__user
*result_up)
{
lstcon_batch_t *bat;
int rc;
{
lstcon_batch_t *bat;
int rc;
@@
-1093,7
+1081,7
@@
lstcon_batch_stop(char *name, int force, struct list_head *result_up)
bat->bat_arg = force;
rc = lstcon_batch_op(bat, LST_TRANS_TSBSTOP, result_up);
bat->bat_arg = force;
rc = lstcon_batch_op(bat, LST_TRANS_TSBSTOP, result_up);
-
+
/* mark batch as stopped if all RPCs finished */
if (lstcon_tsbop_stat_failure(lstcon_trans_stat(), 0) == 0)
bat->bat_state = LST_BATCH_IDLE;
/* mark batch as stopped if all RPCs finished */
if (lstcon_tsbop_stat_failure(lstcon_trans_stat(), 0) == 0)
bat->bat_state = LST_BATCH_IDLE;
@@
-1117,8
+1105,8
@@
lstcon_batch_destroy(lstcon_batch_t *bat)
list_del(&test->tes_link);
list_del(&test->tes_link);
- lstcon_group_
put
(test->tes_src_grp);
- lstcon_group_
put
(test->tes_dst_grp);
+ lstcon_group_
decref
(test->tes_src_grp);
+ lstcon_group_
decref
(test->tes_dst_grp);
LIBCFS_FREE(test, offsetof(lstcon_test_t,
tes_param[test->tes_paramlen]));
LIBCFS_FREE(test, offsetof(lstcon_test_t,
tes_param[test->tes_paramlen]));
@@
-1154,7
+1142,7
@@
lstcon_batch_destroy(lstcon_batch_t *bat)
LIBCFS_FREE(bat, sizeof(lstcon_batch_t));
}
LIBCFS_FREE(bat, sizeof(lstcon_batch_t));
}
-int
+
static
int
lstcon_testrpc_condition(int transop, lstcon_node_t *nd, void *arg)
{
lstcon_test_t *test;
lstcon_testrpc_condition(int transop, lstcon_node_t *nd, void *arg)
{
lstcon_test_t *test;
@@
-1179,7
+1167,7
@@
lstcon_testrpc_condition(int transop, lstcon_node_t *nd, void *arg)
if (transop == LST_TRANS_TSBCLIADD) {
hash = batch->bat_cli_hash;
head = &batch->bat_cli_list;
if (transop == LST_TRANS_TSBCLIADD) {
hash = batch->bat_cli_hash;
head = &batch->bat_cli_list;
-
+
} else {
LASSERT (transop == LST_TRANS_TSBSRVADD);
} else {
LASSERT (transop == LST_TRANS_TSBSRVADD);
@@
-1199,7
+1187,7
@@
lstcon_testrpc_condition(int transop, lstcon_node_t *nd, void *arg)
}
static int
}
static int
-lstcon_test_nodes_add(lstcon_test_t *test, struct list_head *result_up)
+lstcon_test_nodes_add(lstcon_test_t *test, struct list_head
__user
*result_up)
{
lstcon_rpc_trans_t *trans;
lstcon_group_t *grp;
{
lstcon_rpc_trans_t *trans;
lstcon_group_t *grp;
@@
-1297,7
+1285,7
@@
lstcon_test_add(char *batch_name, int type, int loop,
int concur, int dist, int span,
char *src_name, char *dst_name,
void *param, int paramlen, int *retp,
int concur, int dist, int span,
char *src_name, char *dst_name,
void *param, int paramlen, int *retp,
- struct list_head *result_up)
+ struct list_head
__user
*result_up)
{
lstcon_test_t *test = NULL;
int rc;
{
lstcon_test_t *test = NULL;
int rc;
@@
-1333,7
+1321,6
@@
lstcon_test_add(char *batch_name, int type, int loop,
goto out;
}
goto out;
}
- memset(test, 0, offsetof(lstcon_test_t, tes_param[paramlen]));
test->tes_hdr.tsb_id = batch->bat_hdr.tsb_id;
test->tes_batch = batch;
test->tes_type = type;
test->tes_hdr.tsb_id = batch->bat_hdr.tsb_id;
test->tes_batch = batch;
test->tes_type = type;
@@
-1376,15
+1363,15
@@
out:
LIBCFS_FREE(test, offsetof(lstcon_test_t, tes_param[paramlen]));
if (dst_grp != NULL)
LIBCFS_FREE(test, offsetof(lstcon_test_t, tes_param[paramlen]));
if (dst_grp != NULL)
- lstcon_group_
put
(dst_grp);
+ lstcon_group_
decref
(dst_grp);
if (src_grp != NULL)
if (src_grp != NULL)
- lstcon_group_
put
(src_grp);
+ lstcon_group_
decref
(src_grp);
return rc;
}
return rc;
}
-int
+
static
int
lstcon_test_find(lstcon_batch_t *batch, int idx, lstcon_test_t **testpp)
{
lstcon_test_t *test;
lstcon_test_find(lstcon_batch_t *batch, int idx, lstcon_test_t **testpp)
{
lstcon_test_t *test;
@@
-1399,9
+1386,9
@@
lstcon_test_find(lstcon_batch_t *batch, int idx, lstcon_test_t **testpp)
return -ENOENT;
}
return -ENOENT;
}
-int
+
static
int
lstcon_tsbrpc_readent(int transop, srpc_msg_t *msg,
lstcon_tsbrpc_readent(int transop, srpc_msg_t *msg,
-
lstcon_rpc_ent_t
*ent_up)
+
lstcon_rpc_ent_t __user
*ent_up)
{
srpc_batch_reply_t *rep = &msg->msg_body.bat_reply;
{
srpc_batch_reply_t *rep = &msg->msg_body.bat_reply;
@@
-1418,7
+1405,7
@@
lstcon_tsbrpc_readent(int transop, srpc_msg_t *msg,
int
lstcon_test_batch_query(char *name, int testidx, int client,
int
lstcon_test_batch_query(char *name, int testidx, int client,
- int timeout, struct list_head *result_up)
+ int timeout, struct list_head
__user
*result_up)
{
lstcon_rpc_trans_t *trans;
struct list_head *translist;
{
lstcon_rpc_trans_t *trans;
struct list_head *translist;
@@
-1447,11
+1434,11
@@
lstcon_test_batch_query(char *name, int testidx, int client,
CDEBUG(D_NET, "Can't find test: %d\n", testidx);
return rc;
}
CDEBUG(D_NET, "Can't find test: %d\n", testidx);
return rc;
}
-
+
translist = &test->tes_trans_list;
ndlist = &test->tes_src_grp->grp_ndl_list;
hdr = &test->tes_hdr;
translist = &test->tes_trans_list;
ndlist = &test->tes_src_grp->grp_ndl_list;
hdr = &test->tes_hdr;
- }
+ }
transop = client ? LST_TRANS_TSBCLIQRY : LST_TRANS_TSBSRVQRY;
transop = client ? LST_TRANS_TSBCLIQRY : LST_TRANS_TSBSRVQRY;
@@
-1478,21
+1465,23
@@
lstcon_test_batch_query(char *name, int testidx, int client,
return rc;
}
return rc;
}
-int
+
static
int
lstcon_statrpc_readent(int transop, srpc_msg_t *msg,
lstcon_statrpc_readent(int transop, srpc_msg_t *msg,
-
lstcon_rpc_ent_t
*ent_up)
+
lstcon_rpc_ent_t __user
*ent_up)
{
{
-
srpc_stat_reply_t *rep = &msg->msg_body.stat_reply;
-
sfw_counters_t
*sfwk_stat;
-
srpc_counters_t
*srpc_stat;
-
lnet_counters_t
*lnet_stat;
-
+ srpc_stat_reply_t *rep = &msg->msg_body.stat_reply;
+
sfw_counters_t __user
*sfwk_stat;
+
srpc_counters_t __user
*srpc_stat;
+
lnet_counters_t __user
*lnet_stat;
+
if (rep->str_status != 0)
return 0;
if (rep->str_status != 0)
return 0;
- sfwk_stat = (sfw_counters_t *)&ent_up->rpe_payload[0];
- srpc_stat = (srpc_counters_t *)((char *)sfwk_stat + sizeof(*sfwk_stat));
- lnet_stat = (lnet_counters_t *)((char *)srpc_stat + sizeof(*srpc_stat));
+ sfwk_stat = (sfw_counters_t __user *)&ent_up->rpe_payload[0];
+ srpc_stat = (srpc_counters_t __user *)
+ ((char __user *)sfwk_stat + sizeof(*sfwk_stat));
+ lnet_stat = (lnet_counters_t __user *)
+ ((char __user *)srpc_stat + sizeof(*srpc_stat));
if (copy_to_user(sfwk_stat, &rep->str_fw, sizeof(*sfwk_stat)) ||
copy_to_user(srpc_stat, &rep->str_rpc, sizeof(*srpc_stat)) ||
if (copy_to_user(sfwk_stat, &rep->str_fw, sizeof(*sfwk_stat)) ||
copy_to_user(srpc_stat, &rep->str_rpc, sizeof(*srpc_stat)) ||
@@
-1502,9
+1491,9
@@
lstcon_statrpc_readent(int transop, srpc_msg_t *msg,
return 0;
}
return 0;
}
-int
+
static
int
lstcon_ndlist_stat(struct list_head *ndlist,
lstcon_ndlist_stat(struct list_head *ndlist,
- int timeout, struct list_head *result_up)
+ int timeout, struct list_head
__user
*result_up)
{
struct list_head head;
lstcon_rpc_trans_t *trans;
{
struct list_head head;
lstcon_rpc_trans_t *trans;
@@
-1529,7
+1518,8
@@
lstcon_ndlist_stat(struct list_head *ndlist,
}
int
}
int
-lstcon_group_stat(char *grp_name, int timeout, struct list_head *result_up)
+lstcon_group_stat(char *grp_name, int timeout,
+ struct list_head __user *result_up)
{
lstcon_group_t *grp;
int rc;
{
lstcon_group_t *grp;
int rc;
@@
-1542,14
+1532,14
@@
lstcon_group_stat(char *grp_name, int timeout, struct list_head *result_up)
rc = lstcon_ndlist_stat(&grp->grp_ndl_list, timeout, result_up);
rc = lstcon_ndlist_stat(&grp->grp_ndl_list, timeout, result_up);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return rc;
}
int
return rc;
}
int
-lstcon_nodes_stat(int count, lnet_process_id_t *ids_up,
- int timeout, struct list_head *result_up)
+lstcon_nodes_stat(int count, lnet_process_id_t
__user
*ids_up,
+ int timeout, struct list_head
__user
*result_up)
{
lstcon_ndlink_t *ndl;
lstcon_group_t *tmp;
{
lstcon_ndlink_t *ndl;
lstcon_group_t *tmp;
@@
-1580,21
+1570,21
@@
lstcon_nodes_stat(int count, lnet_process_id_t *ids_up,
}
if (rc != 0) {
}
if (rc != 0) {
-
lstcon_group_put
(tmp);
+
lstcon_group_decref
(tmp);
return rc;
}
rc = lstcon_ndlist_stat(&tmp->grp_ndl_list, timeout, result_up);
return rc;
}
rc = lstcon_ndlist_stat(&tmp->grp_ndl_list, timeout, result_up);
-
lstcon_group_put
(tmp);
+
lstcon_group_decref
(tmp);
return rc;
}
return rc;
}
-int
+
static
int
lstcon_debug_ndlist(struct list_head *ndlist,
struct list_head *translist,
lstcon_debug_ndlist(struct list_head *ndlist,
struct list_head *translist,
- int timeout, struct list_head *result_up)
+ int timeout, struct list_head
__user
*result_up)
{
lstcon_rpc_trans_t *trans;
int rc;
{
lstcon_rpc_trans_t *trans;
int rc;
@@
-1616,7
+1606,7
@@
lstcon_debug_ndlist(struct list_head *ndlist,
}
int
}
int
-lstcon_session_debug(int timeout, struct list_head *result_up)
+lstcon_session_debug(int timeout, struct list_head
__user
*result_up)
{
return lstcon_debug_ndlist(&console_session.ses_ndl_list,
NULL, timeout, result_up);
{
return lstcon_debug_ndlist(&console_session.ses_ndl_list,
NULL, timeout, result_up);
@@
-1624,7
+1614,7
@@
lstcon_session_debug(int timeout, struct list_head *result_up)
int
lstcon_batch_debug(int timeout, char *name,
int
lstcon_batch_debug(int timeout, char *name,
- int client, struct list_head *result_up)
+ int client, struct list_head
__user
*result_up)
{
lstcon_batch_t *bat;
int rc;
{
lstcon_batch_t *bat;
int rc;
@@
-1642,7
+1632,7
@@
lstcon_batch_debug(int timeout, char *name,
int
lstcon_group_debug(int timeout, char *name,
int
lstcon_group_debug(int timeout, char *name,
- struct list_head *result_up)
+ struct list_head
__user
*result_up)
{
lstcon_group_t *grp;
int rc;
{
lstcon_group_t *grp;
int rc;
@@
-1653,15
+1643,15
@@
lstcon_group_debug(int timeout, char *name,
rc = lstcon_debug_ndlist(&grp->grp_ndl_list, NULL,
timeout, result_up);
rc = lstcon_debug_ndlist(&grp->grp_ndl_list, NULL,
timeout, result_up);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return rc;
}
int
lstcon_nodes_debug(int timeout,
return rc;
}
int
lstcon_nodes_debug(int timeout,
- int count, lnet_process_id_t *ids_up,
- struct list_head *result_up)
+ int count, lnet_process_id_t __user *ids_up,
+ struct list_head
__user
*result_up)
{
lnet_process_id_t id;
lstcon_ndlink_t *ndl;
{
lnet_process_id_t id;
lstcon_ndlink_t *ndl;
@@
-1690,14
+1680,14
@@
lstcon_nodes_debug(int timeout,
}
if (rc != 0) {
}
if (rc != 0) {
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return rc;
}
rc = lstcon_debug_ndlist(&grp->grp_ndl_list, NULL,
timeout, result_up);
return rc;
}
rc = lstcon_debug_ndlist(&grp->grp_ndl_list, NULL,
timeout, result_up);
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
return rc;
}
return rc;
}
@@
-1721,11
+1711,9
@@
lstcon_new_session_id(lst_sid_t *sid)
sid->ses_stamp = cfs_time_current();
}
sid->ses_stamp = cfs_time_current();
}
-extern srpc_service_t lstcon_acceptor_service;
-
int
lstcon_session_new(char *name, int key, unsigned feats,
int
lstcon_session_new(char *name, int key, unsigned feats,
- int timeout, int force, lst_sid_t *sid_up)
+ int timeout, int force, lst_sid_t
__user
*sid_up)
{
int rc = 0;
int i;
{
int rc = 0;
int i;
@@
-1793,8
+1781,10
@@
lstcon_session_new(char *name, int key, unsigned feats,
}
int
}
int
-lstcon_session_info(lst_sid_t *sid_up, int *key_up, unsigned *featp,
- lstcon_ndlist_ent_t *ndinfo_up, char *name_up, int len)
+lstcon_session_info(lst_sid_t __user *sid_up, int __user *key_up,
+ unsigned __user *featp,
+ lstcon_ndlist_ent_t __user *ndinfo_up,
+ char __user *name_up, int len)
{
lstcon_ndlist_ent_t *entp;
lstcon_ndlink_t *ndl;
{
lstcon_ndlist_ent_t *entp;
lstcon_ndlink_t *ndl;
@@
-1807,8
+1797,6
@@
lstcon_session_info(lst_sid_t *sid_up, int *key_up, unsigned *featp,
if (entp == NULL)
return -ENOMEM;
if (entp == NULL)
return -ENOMEM;
- memset(entp, 0, sizeof(*entp));
-
list_for_each_entry(ndl, &console_session.ses_ndl_list, ndl_link)
LST_NODE_STATE_COUNTER(ndl->ndl_node, entp);
list_for_each_entry(ndl, &console_session.ses_ndl_list, ndl_link)
LST_NODE_STATE_COUNTER(ndl->ndl_node, entp);
@@
-1837,7
+1825,7
@@
lstcon_session_end()
LASSERT (console_session.ses_state == LST_SESSION_ACTIVE);
LASSERT (console_session.ses_state == LST_SESSION_ACTIVE);
- rc = lstcon_rpc_trans_ndlist(&console_session.ses_ndl_list,
+ rc = lstcon_rpc_trans_ndlist(&console_session.ses_ndl_list,
NULL, LST_TRANS_SESEND, NULL,
lstcon_sesrpc_condition, &trans);
if (rc != 0) {
NULL, LST_TRANS_SESEND, NULL,
lstcon_sesrpc_condition, &trans);
if (rc != 0) {
@@
-1877,7
+1865,7
@@
lstcon_session_end()
lstcon_group_t, grp_link);
LASSERT(grp->grp_ref == 1);
lstcon_group_t, grp_link);
LASSERT(grp->grp_ref == 1);
- lstcon_group_
put
(grp);
+ lstcon_group_
decref
(grp);
}
/* all nodes should be released */
}
/* all nodes should be released */
@@
-1998,15
+1986,15
@@
lstcon_acceptor_handle (srpc_server_rpc_t *rpc)
out:
rep->msg_ses_feats = console_session.ses_features;
if (grp != NULL)
out:
rep->msg_ses_feats = console_session.ses_features;
if (grp != NULL)
-
lstcon_group_put
(grp);
+
lstcon_group_decref
(grp);
mutex_unlock(&console_session.ses_mutex);
return rc;
}
mutex_unlock(&console_session.ses_mutex);
return rc;
}
-srpc_service_t lstcon_acceptor_service;
-void lstcon_init_acceptor_service(void)
+s
tatic s
rpc_service_t lstcon_acceptor_service;
+
static
void lstcon_init_acceptor_service(void)
{
/* initialize selftest console acceptor service table */
lstcon_acceptor_service.sv_name = "join session";
{
/* initialize selftest console acceptor service table */
lstcon_acceptor_service.sv_name = "join session";
@@
-2015,7
+2003,7
@@
void lstcon_init_acceptor_service(void)
lstcon_acceptor_service.sv_wi_total = SFW_FRWK_WI_MAX;
}
lstcon_acceptor_service.sv_wi_total = SFW_FRWK_WI_MAX;
}
-
extern int lstcon_ioctl_entry(unsigned int cmd, struct libcfs_ioctl_data *data
);
+
int lstcon_ioctl_entry(unsigned int cmd, struct libcfs_ioctl_hdr *hdr
);
DECLARE_IOCTL_HANDLER(lstcon_ioctl_handler, lstcon_ioctl_entry);
DECLARE_IOCTL_HANDLER(lstcon_ioctl_handler, lstcon_ioctl_entry);
@@
-2125,4
+2113,3
@@
lstcon_console_fini(void)
return 0;
}
return 0;
}
-#endif