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)
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_rpc_trans_destroy(trans);
lstcon_group_move(tmp, grp);
lstcon_rpc_trans_destroy(trans);
lstcon_group_move(tmp, 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 */
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 */
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);
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);
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);
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);
/* -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 */
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);
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);
/* 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);
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");
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);
LIBCFS_FREE(test, offsetof(lstcon_test_t,
tes_param[test->tes_paramlen]));
LIBCFS_FREE(test, offsetof(lstcon_test_t,
tes_param[test->tes_paramlen]));
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);
lstcon_group_t, grp_link);
LASSERT(grp->grp_ref == 1);
lstcon_group_t, grp_link);
LASSERT(grp->grp_ref == 1);