Whamcloud - gitweb
LU-3990 kernel: kernel update [SLES SP2 3.0.93-0.5]
[fs/lustre-release.git] / lnet / selftest / console.c
index 4eaf731..d58cc9c 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,6 +26,8 @@
 /*
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -269,21 +269,21 @@ lstcon_group_decref(lstcon_group_t *grp)
 }
 
 static int
-lstcon_group_find(char *name, lstcon_group_t **grpp)
+lstcon_group_find(const char *name, lstcon_group_t **grpp)
 {
-        lstcon_group_t   *grp;
+       lstcon_group_t   *grp;
 
-        cfs_list_for_each_entry_typed(grp, &console_session.ses_grp_list,
-                                      lstcon_group_t, grp_link) {
-                if (strncmp(grp->grp_name, name, LST_NAME_SIZE) != 0)
-                        continue;
+       cfs_list_for_each_entry_typed(grp, &console_session.ses_grp_list,
+                                     lstcon_group_t, grp_link) {
+               if (strncmp(grp->grp_name, name, LST_NAME_SIZE) != 0)
+                       continue;
 
-                lstcon_group_addref(grp);  /* +1 ref for caller */
-                *grpp = grp;
-                return 0;
-        }
+               lstcon_group_addref(grp);  /* +1 ref for caller */
+               *grpp = grp;
+               return 0;
+       }
 
-        return -ENOENT;
+       return -ENOENT;
 }
 
 static void
@@ -297,7 +297,7 @@ lstcon_group_ndlink_find(lstcon_group_t *grp, lnet_process_id_t id,
                          lstcon_ndlink_t **ndlpp, int create)
 {
         int     rc;
-        
+
         rc = lstcon_ndlink_find(&grp->grp_ndl_hash[0], id, ndlpp, create);
         if (rc != 0)
                 return rc;
@@ -392,9 +392,9 @@ lstcon_sesrpc_readent(int transop, srpc_msg_t *msg,
         case LST_TRANS_SESQRY:
                 rep = &msg->msg_body.dbg_reply;
 
-                if (cfs_copy_to_user(&ent_up->rpe_priv[0],
+               if (copy_to_user(&ent_up->rpe_priv[0],
                                      &rep->dbg_timeout, sizeof(int)) ||
-                    cfs_copy_to_user(&ent_up->rpe_payload[0],
+                   copy_to_user(&ent_up->rpe_payload[0],
                                      &rep->dbg_name, LST_NAME_SIZE))
                         return -EFAULT;
 
@@ -408,9 +408,9 @@ lstcon_sesrpc_readent(int transop, srpc_msg_t *msg,
 }
 
 static int
-lstcon_group_nodes_add(lstcon_group_t *grp, int count,
-                       lnet_process_id_t *ids_up,
-                       cfs_list_t *result_up)
+lstcon_group_nodes_add(lstcon_group_t *grp,
+                      int count, lnet_process_id_t *ids_up,
+                      unsigned *featp, cfs_list_t *result_up)
 {
         lstcon_rpc_trans_t      *trans;
         lstcon_ndlink_t         *ndl;
@@ -426,7 +426,7 @@ lstcon_group_nodes_add(lstcon_group_t *grp, int count,
         }
 
         for (i = 0 ; i < count; i++) {
-                if (cfs_copy_from_user(&id, &ids_up[i], sizeof(id))) {
+               if (copy_from_user(&id, &ids_up[i], sizeof(id))) {
                         rc = -EFAULT;
                         break;
                 }
@@ -463,6 +463,8 @@ lstcon_group_nodes_add(lstcon_group_t *grp, int count,
 
         rc = lstcon_rpc_trans_interpreter(trans, result_up,
                                           lstcon_sesrpc_readent);
+       *featp = trans->tas_features;
+
         /* destroy all RPGs */
         lstcon_rpc_trans_destroy(trans);
 
@@ -493,7 +495,7 @@ lstcon_group_nodes_remove(lstcon_group_t *grp,
         }
 
         for (i = 0; i < count; i++) {
-                if (cfs_copy_from_user(&id, &ids_up[i], sizeof(id))) {
+               if (copy_from_user(&id, &ids_up[i], sizeof(id))) {
                         rc = -EFAULT;
                         goto error;
                 }
@@ -552,8 +554,8 @@ lstcon_group_add(char *name)
 }
 
 int
-lstcon_nodes_add(char *name, int count,
-                 lnet_process_id_t *ids_up, cfs_list_t *result_up)
+lstcon_nodes_add(char *name, int count, lnet_process_id_t *ids_up,
+                unsigned *featp, cfs_list_t *result_up)
 {
         lstcon_group_t         *grp;
         int                     rc;
@@ -575,7 +577,7 @@ lstcon_nodes_add(char *name, int count,
                 return -EBUSY;
         }
 
-        rc = lstcon_group_nodes_add(grp, count, ids_up, result_up);
+       rc = lstcon_group_nodes_add(grp, count, ids_up, featp, result_up);
 
         lstcon_group_put(grp);
 
@@ -738,7 +740,7 @@ lstcon_group_list(int index, int len, char *name_up)
         cfs_list_for_each_entry_typed(grp, &console_session.ses_grp_list,
                                       lstcon_group_t, grp_link) {
                 if (index-- == 0) {
-                        return cfs_copy_to_user(name_up, grp->grp_name, len) ?
+                       return copy_to_user(name_up, grp->grp_name, len) ?
                                -EFAULT : 0;
                 }
         }
@@ -768,9 +770,9 @@ lstcon_nodes_getent(cfs_list_t *head, int *index_p,
                         break;
 
                 nd = ndl->ndl_node;
-                if (cfs_copy_to_user(&dents_up[count].nde_id,
+               if (copy_to_user(&dents_up[count].nde_id,
                                      &nd->nd_id, sizeof(nd->nd_id)) ||
-                    cfs_copy_to_user(&dents_up[count].nde_state,
+                   copy_to_user(&dents_up[count].nde_state,
                                      &nd->nd_state, sizeof(nd->nd_state)))
                         return -EFAULT;
 
@@ -825,7 +827,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p,
                                       lstcon_ndlink_t, ndl_link)
                 LST_NODE_STATE_COUNTER(ndl->ndl_node, gentp);
 
-        rc = cfs_copy_to_user(gents_p, gentp,
+       rc = copy_to_user(gents_p, gentp,
                               sizeof(lstcon_ndlist_ent_t)) ? -EFAULT: 0;
 
         LIBCFS_FREE(gentp, sizeof(lstcon_ndlist_ent_t));
@@ -835,20 +837,20 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t *gents_p,
         return 0;
 }
 
-int
-lstcon_batch_find(char *name, lstcon_batch_t **batpp)
+static int
+lstcon_batch_find(const char *name, lstcon_batch_t **batpp)
 {
-        lstcon_batch_t   *bat;
+       lstcon_batch_t   *bat;
 
-        cfs_list_for_each_entry_typed(bat, &console_session.ses_bat_list,
-                                      lstcon_batch_t, bat_link) {
-                if (strncmp(bat->bat_name, name, LST_NAME_SIZE) == 0) {
-                        *batpp = bat;
-                        return 0;
-                }
-        }
+       cfs_list_for_each_entry_typed(bat, &console_session.ses_bat_list,
+                                     lstcon_batch_t, bat_link) {
+               if (strncmp(bat->bat_name, name, LST_NAME_SIZE) == 0) {
+                       *batpp = bat;
+                       return 0;
+               }
+       }
 
-        return -ENOENT;
+       return -ENOENT;
 }
 
 int
@@ -922,7 +924,7 @@ lstcon_batch_list(int index, int len, char *name_up)
         cfs_list_for_each_entry_typed(bat, &console_session.ses_bat_list,
                                       lstcon_batch_t, bat_link) {
                 if (index-- == 0) {
-                        return cfs_copy_to_user(name_up,bat->bat_name, len) ?
+                       return copy_to_user(name_up, bat->bat_name, len) ?
                                -EFAULT: 0;
                 }
         }
@@ -998,7 +1000,7 @@ lstcon_batch_info(char *name, lstcon_test_batch_ent_t *ent_up, int server,
         cfs_list_for_each_entry_typed(ndl, srvlst, lstcon_ndlink_t, ndl_link)
                 LST_NODE_STATE_COUNTER(ndl->ndl_node, &entp->tbe_srv_nle);
 
-        rc = cfs_copy_to_user(ent_up, entp,
+       rc = copy_to_user(ent_up, entp,
                               sizeof(lstcon_test_batch_ent_t)) ? -EFAULT : 0;
 
         LIBCFS_FREE(entp, sizeof(lstcon_test_batch_ent_t));
@@ -1245,100 +1247,139 @@ again:
         goto again;
 }
 
-int
-lstcon_test_add(char *name, int type, int loop, int concur,
-                int dist, int span, char *src_name, char * dst_name,
-                void *param, int paramlen, int *retp,
-                cfs_list_t *result_up)
+static int
+lstcon_verify_batch(const char *name, lstcon_batch_t **batch)
 {
-        lstcon_group_t  *src_grp = NULL;
-        lstcon_group_t  *dst_grp = NULL;
-        lstcon_test_t   *test    = NULL;
-        lstcon_batch_t  *batch;
-        int              rc;
-
-        rc = lstcon_batch_find(name, &batch);
-        if (rc != 0) {
-                CDEBUG(D_NET, "Can't find batch %s\n", name);
-                return rc;
-        }
-
-        if (batch->bat_state != LST_BATCH_IDLE) {
-                CDEBUG(D_NET, "Can't change running batch %s\n", name);
-                return rc;
-        }
-        
-        rc = lstcon_group_find(src_name, &src_grp);
-        if (rc != 0) {
-                CDEBUG(D_NET, "Can't find group %s\n", src_name);
-                goto out;
-        }
-
-        rc = lstcon_group_find(dst_name, &dst_grp);
-        if (rc != 0) {
-                CDEBUG(D_NET, "Can't find group %s\n", dst_name);
-                goto out;
-        }
-
-        if (dst_grp->grp_userland)
-                *retp = 1;
-
-        LIBCFS_ALLOC(test, offsetof(lstcon_test_t, tes_param[paramlen]));
-        if (!test) {
-                CERROR("Can't allocate test descriptor\n");
-                rc = -ENOMEM;
+       int rc;
 
-                goto out;
-        }
+       rc = lstcon_batch_find(name, batch);
+       if (rc != 0) {
+               CDEBUG(D_NET, "Can't find batch %s\n", name);
+               return rc;
+       }
 
-        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_oneside       = 0; /* TODO */
-        test->tes_loop          = loop;
-        test->tes_concur        = concur;
-        test->tes_stop_onerr    = 1; /* TODO */
-        test->tes_span          = span;
-        test->tes_dist          = dist;
-        test->tes_cliidx        = 0; /* just used for creating RPC */
-        test->tes_src_grp       = src_grp;
-        test->tes_dst_grp       = dst_grp;
-        CFS_INIT_LIST_HEAD(&test->tes_trans_list);
+       if ((*batch)->bat_state != LST_BATCH_IDLE) {
+               CDEBUG(D_NET, "Can't change running batch %s\n", name);
+               return -EINVAL;
+       }
 
-        if (param != NULL) {
-                test->tes_paramlen = paramlen;
-                memcpy(&test->tes_param[0], param, paramlen);
-        }
+       return 0;
+}
 
-        rc = lstcon_test_nodes_add(test, result_up);
+static int
+lstcon_verify_group(const char *name, lstcon_group_t **grp)
+{
+       int                     rc;
+       lstcon_ndlink_t         *ndl;
 
-        if (rc != 0)
-                goto out;
+       rc = lstcon_group_find(name, grp);
+       if (rc != 0) {
+               CDEBUG(D_NET, "can't find group %s\n", name);
+               return rc;
+       }
 
-        if (lstcon_trans_stat()->trs_rpc_errno != 0 ||
-            lstcon_trans_stat()->trs_fwk_errno != 0)
-                CDEBUG(D_NET, "Failed to add test %d to batch %s\n", type, name);
+       cfs_list_for_each_entry_typed(ndl, &(*grp)->grp_ndl_list,
+                                     lstcon_ndlink_t, ndl_link) {
+               if (ndl->ndl_node->nd_state == LST_NODE_ACTIVE) {
+                       return 0;
+               }
+       }
 
-        /* add to test list anyway, so user can check what's going on */
-        cfs_list_add_tail(&test->tes_link, &batch->bat_test_list);
+       CDEBUG(D_NET, "Group %s has no ACTIVE nodes\n", name);
 
-        batch->bat_ntest ++;
-        test->tes_hdr.tsb_index = batch->bat_ntest;
+       return -EINVAL;
+}
 
-        /*  hold groups so nobody can change them */
-        return rc;
+int
+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,
+               cfs_list_t *result_up)
+{
+       lstcon_test_t    *test   = NULL;
+       int              rc;
+       lstcon_group_t   *src_grp = NULL;
+       lstcon_group_t   *dst_grp = NULL;
+       lstcon_batch_t   *batch = NULL;
+
+       /*
+        * verify that a batch of the given name exists, and the groups
+        * that will be part of the batch exist and have at least one
+        * active node
+        */
+       rc = lstcon_verify_batch(batch_name, &batch);
+       if (rc != 0)
+               goto out;
+
+       rc = lstcon_verify_group(src_name, &src_grp);
+       if (rc != 0)
+               goto out;
+
+       rc = lstcon_verify_group(dst_name, &dst_grp);
+       if (rc != 0)
+               goto out;
+
+       if (dst_grp->grp_userland)
+               *retp = 1;
+
+       LIBCFS_ALLOC(test, offsetof(lstcon_test_t, tes_param[paramlen]));
+       if (!test) {
+               CERROR("Can't allocate test descriptor\n");
+               rc = -ENOMEM;
+
+               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_oneside       = 0; /* TODO */
+       test->tes_loop          = loop;
+       test->tes_concur        = concur;
+       test->tes_stop_onerr    = 1; /* TODO */
+       test->tes_span          = span;
+       test->tes_dist          = dist;
+       test->tes_cliidx        = 0; /* just used for creating RPC */
+       test->tes_src_grp       = src_grp;
+       test->tes_dst_grp       = dst_grp;
+       CFS_INIT_LIST_HEAD(&test->tes_trans_list);
+
+       if (param != NULL) {
+               test->tes_paramlen = paramlen;
+               memcpy(&test->tes_param[0], param, paramlen);
+       }
+
+       rc = lstcon_test_nodes_add(test, result_up);
+
+       if (rc != 0)
+               goto out;
+
+       if (lstcon_trans_stat()->trs_rpc_errno != 0 ||
+           lstcon_trans_stat()->trs_fwk_errno != 0)
+               CDEBUG(D_NET, "Failed to add test %d to batch %s\n", type,
+                      batch_name);
+
+       /* add to test list anyway, so user can check what's going on */
+       cfs_list_add_tail(&test->tes_link, &batch->bat_test_list);
+
+       batch->bat_ntest++;
+       test->tes_hdr.tsb_index = batch->bat_ntest;
+
+       /*  hold groups so nobody can change them */
+       return rc;
 out:
-        if (test != NULL)
-                LIBCFS_FREE(test, offsetof(lstcon_test_t, tes_param[paramlen]));
+       if (test != NULL)
+               LIBCFS_FREE(test, offsetof(lstcon_test_t, tes_param[paramlen]));
 
-        if (dst_grp != NULL)
-                lstcon_group_put(dst_grp);
+       if (dst_grp != NULL)
+               lstcon_group_put(dst_grp);
 
-        if (src_grp != NULL)
-                lstcon_group_put(src_grp);
+       if (src_grp != NULL)
+               lstcon_group_put(src_grp);
 
-        return rc;
+       return rc;
 }
 
 int
@@ -1367,7 +1408,7 @@ lstcon_tsbrpc_readent(int transop, srpc_msg_t *msg,
                  transop == LST_TRANS_TSBSRVQRY);
 
         /* positive errno, framework error code */
-        if (cfs_copy_to_user(&ent_up->rpe_priv[0],
+       if (copy_to_user(&ent_up->rpe_priv[0],
                              &rep->bar_active, sizeof(rep->bar_active)))
                 return -EFAULT;
 
@@ -1452,9 +1493,9 @@ lstcon_statrpc_readent(int transop, srpc_msg_t *msg,
         srpc_stat = (srpc_counters_t *)((char *)sfwk_stat + sizeof(*sfwk_stat));
         lnet_stat = (lnet_counters_t *)((char *)srpc_stat + sizeof(*srpc_stat));
 
-        if (cfs_copy_to_user(sfwk_stat, &rep->str_fw, sizeof(*sfwk_stat)) ||
-            cfs_copy_to_user(srpc_stat, &rep->str_rpc, sizeof(*srpc_stat)) ||
-            cfs_copy_to_user(lnet_stat, &rep->str_lnet, sizeof(*lnet_stat)))
+       if (copy_to_user(sfwk_stat, &rep->str_fw, sizeof(*sfwk_stat)) ||
+           copy_to_user(srpc_stat, &rep->str_rpc, sizeof(*srpc_stat)) ||
+           copy_to_user(lnet_stat, &rep->str_lnet, sizeof(*lnet_stat)))
                 return -EFAULT;
 
         return 0;
@@ -1522,7 +1563,7 @@ lstcon_nodes_stat(int count, lnet_process_id_t *ids_up,
         }
 
         for (i = 0 ; i < count; i++) {
-                if (cfs_copy_from_user(&id, &ids_up[i], sizeof(id))) {
+               if (copy_from_user(&id, &ids_up[i], sizeof(id))) {
                         rc = -EFAULT;
                         break;
                 }
@@ -1634,7 +1675,7 @@ lstcon_nodes_debug(int timeout,
         }
 
         for (i = 0; i < count; i++) {
-                if (cfs_copy_from_user(&id, &ids_up[i], sizeof(id))) {
+               if (copy_from_user(&id, &ids_up[i], sizeof(id))) {
                         rc = -EFAULT;
                         break;
                 }
@@ -1682,8 +1723,8 @@ lstcon_new_session_id(lst_sid_t *sid)
 extern srpc_service_t lstcon_acceptor_service;
 
 int
-lstcon_session_new(char *name, int key,
-                   int timeout,int force, lst_sid_t *sid_up)
+lstcon_session_new(char *name, int key, unsigned feats,
+                  int timeout, int force, lst_sid_t *sid_up)
 {
         int     rc = 0;
         int     i;
@@ -1691,8 +1732,8 @@ lstcon_session_new(char *name, int key,
         if (console_session.ses_state != LST_SESSION_NONE) {
                 /* session exists */
                 if (!force) {
-                        CERROR("Session %s already exists\n",
-                               console_session.ses_name);
+                       CNETERR("Session %s already exists\n",
+                               console_session.ses_name);
                         return -EEXIST;
                 }
 
@@ -1703,9 +1744,25 @@ lstcon_session_new(char *name, int key,
                         return rc;
         }
 
-        for (i = 0; i < LST_GLOBAL_HASHSIZE; i++) {
-                LASSERT (cfs_list_empty(&console_session.ses_ndl_hash[i]));
-        }
+       if ((feats & ~LST_FEATS_MASK) != 0) {
+               CNETERR("Unknown session features %x\n",
+                       (feats & ~LST_FEATS_MASK));
+               return -EINVAL;
+       }
+
+       for (i = 0; i < LST_GLOBAL_HASHSIZE; i++)
+               LASSERT(cfs_list_empty(&console_session.ses_ndl_hash[i]));
+
+       lstcon_new_session_id(&console_session.ses_id);
+
+       console_session.ses_key     = key;
+       console_session.ses_state   = LST_SESSION_ACTIVE;
+       console_session.ses_force   = !!force;
+       console_session.ses_features = feats;
+       console_session.ses_feats_updated = 0;
+       console_session.ses_timeout = (timeout <= 0) ?
+                                     LST_CONSOLE_TIMEOUT : timeout;
+       strcpy(console_session.ses_name, name);
 
         rc = lstcon_batch_add(LST_DEFAULT_BATCH);
         if (rc != 0)
@@ -1721,16 +1778,7 @@ lstcon_session_new(char *name, int key,
                 return rc;
         }
 
-        lstcon_new_session_id(&console_session.ses_id);
-
-        console_session.ses_key     = key;
-        console_session.ses_state   = LST_SESSION_ACTIVE;
-        console_session.ses_force   = !!force;
-        console_session.ses_timeout = (timeout <= 0)? LST_CONSOLE_TIMEOUT:
-                                                      timeout;
-        strcpy(console_session.ses_name, name);
-
-        if (cfs_copy_to_user(sid_up, &console_session.ses_id,
+       if (copy_to_user(sid_up, &console_session.ses_id,
                              sizeof(lst_sid_t)) == 0)
                 return rc;
 
@@ -1740,7 +1788,7 @@ lstcon_session_new(char *name, int key,
 }
 
 int
-lstcon_session_info(lst_sid_t *sid_up, int *key_up,
+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_ndlist_ent_t *entp;
@@ -1760,11 +1808,14 @@ lstcon_session_info(lst_sid_t *sid_up, int *key_up,
                                       lstcon_ndlink_t, ndl_link)
                 LST_NODE_STATE_COUNTER(ndl->ndl_node, entp);
 
-        if (cfs_copy_to_user(sid_up, &console_session.ses_id,
+       if (copy_to_user(sid_up, &console_session.ses_id,
                              sizeof(lst_sid_t)) ||
-            cfs_copy_to_user(key_up, &console_session.ses_key, sizeof(int)) ||
-            cfs_copy_to_user(ndinfo_up, entp, sizeof(*entp)) ||
-            cfs_copy_to_user(name_up, console_session.ses_name, len))
+           copy_to_user(key_up, &console_session.ses_key,
+                            sizeof(*key_up)) ||
+           copy_to_user(featp, &console_session.ses_features,
+                            sizeof(*featp)) ||
+           copy_to_user(ndinfo_up, entp, sizeof(*entp)) ||
+           copy_to_user(name_up, console_session.ses_name, len))
                 rc = -EFAULT;
 
         LIBCFS_FREE(entp, sizeof(*entp));
@@ -1806,6 +1857,7 @@ lstcon_session_end()
         console_session.ses_state = LST_SESSION_NONE;
         console_session.ses_key   = 0;
         console_session.ses_force = 0;
+       console_session.ses_feats_updated = 0;
 
         /* destroy all batches */
         while (!cfs_list_empty(&console_session.ses_bat_list)) {
@@ -1833,6 +1885,38 @@ lstcon_session_end()
         return rc;
 }
 
+int
+lstcon_session_feats_check(unsigned feats)
+{
+       int rc = 0;
+
+       if ((feats & ~LST_FEATS_MASK) != 0) {
+               CERROR("Can't support these features: %x\n",
+                      (feats & ~LST_FEATS_MASK));
+               return -EPROTO;
+       }
+
+       spin_lock(&console_session.ses_rpc_lock);
+
+       if (!console_session.ses_feats_updated) {
+               console_session.ses_feats_updated = 1;
+               console_session.ses_features = feats;
+       }
+
+       if (console_session.ses_features != feats)
+               rc = -EPROTO;
+
+       spin_unlock(&console_session.ses_rpc_lock);
+
+       if (rc != 0) {
+               CERROR("remote features %x do not match with "
+                      "session features %x of console\n",
+                      feats, console_session.ses_features);
+       }
+
+       return rc;
+}
+
 static int
 lstcon_acceptor_handle (srpc_server_rpc_t *rpc)
 {
@@ -1846,7 +1930,7 @@ lstcon_acceptor_handle (srpc_server_rpc_t *rpc)
 
         sfw_unpack_message(req);
 
-        cfs_mutex_down(&console_session.ses_mutex);
+       mutex_lock(&console_session.ses_mutex);
 
         jrep->join_sid = console_session.ses_id;
 
@@ -1855,6 +1939,11 @@ lstcon_acceptor_handle (srpc_server_rpc_t *rpc)
                 goto out;
         }
 
+       if (lstcon_session_feats_check(req->msg_ses_feats) != 0) {
+               jrep->join_status = EPROTO;
+               goto out;
+       }
+
         if (jreq->join_sid.ses_nid != LNET_NID_ANY &&
              !lstcon_session_match(jreq->join_sid)) {
                 jrep->join_status = EBUSY;
@@ -1902,10 +1991,11 @@ lstcon_acceptor_handle (srpc_server_rpc_t *rpc)
         jrep->join_status  = 0;
 
 out:
+       rep->msg_ses_feats = console_session.ses_features;
         if (grp != NULL)
                 lstcon_group_put(grp);
 
-        cfs_mutex_up(&console_session.ses_mutex);
+       mutex_unlock(&console_session.ses_mutex);
 
         return rc;
 }
@@ -1917,7 +2007,7 @@ void lstcon_init_acceptor_service(void)
         lstcon_acceptor_service.sv_name    = "join session";
         lstcon_acceptor_service.sv_handler = lstcon_acceptor_handle;
         lstcon_acceptor_service.sv_id      = SRPC_SERVICE_JOIN;
-        lstcon_acceptor_service.sv_concur  = SFW_SERVICE_CONCURRENCY;
+       lstcon_acceptor_service.sv_wi_total = SFW_FRWK_WI_MAX;
 }
 
 extern int lstcon_ioctl_entry(unsigned int cmd, struct libcfs_ioctl_data *data);
@@ -1929,19 +2019,20 @@ int
 lstcon_console_init(void)
 {
         int     i;
-        int     n;
         int     rc;
 
         memset(&console_session, 0, sizeof(lstcon_session_t));
 
-        console_session.ses_id      = LST_INVALID_SID;
-        console_session.ses_state   = LST_SESSION_NONE;
-        console_session.ses_timeout = 0;
-        console_session.ses_force   = 0;
-        console_session.ses_expired = 0;
-        console_session.ses_laststamp = cfs_time_current_sec();   
+       console_session.ses_id              = LST_INVALID_SID;
+       console_session.ses_state           = LST_SESSION_NONE;
+       console_session.ses_timeout         = 0;
+       console_session.ses_force           = 0;
+       console_session.ses_expired         = 0;
+       console_session.ses_feats_updated   = 0;
+       console_session.ses_features        = LST_FEATS_MASK;
+       console_session.ses_laststamp       = cfs_time_current_sec();
 
-        cfs_init_mutex(&console_session.ses_mutex);
+       mutex_init(&console_session.ses_mutex);
 
         CFS_INIT_LIST_HEAD(&console_session.ses_ndl_list);
         CFS_INIT_LIST_HEAD(&console_session.ses_grp_list);
@@ -1968,8 +2059,9 @@ lstcon_console_init(void)
                 return rc;
         }
 
-        n = srpc_service_add_buffers(&lstcon_acceptor_service, SFW_POST_BUFFERS);
-        if (n != SFW_POST_BUFFERS) {
+       rc = srpc_service_add_buffers(&lstcon_acceptor_service,
+                                     lstcon_acceptor_service.sv_wi_total);
+       if (rc != 0) {
                 rc = -ENOMEM;
                 goto out;
         }
@@ -2000,7 +2092,7 @@ lstcon_console_fini(void)
 
         libcfs_deregister_ioctl(&lstcon_ioctl_handler);
 
-        cfs_mutex_down(&console_session.ses_mutex);
+       mutex_lock(&console_session.ses_mutex);
 
         srpc_shutdown_service(&lstcon_acceptor_service);
         srpc_remove_service(&lstcon_acceptor_service);
@@ -2010,7 +2102,7 @@ lstcon_console_fini(void)
 
         lstcon_rpc_module_fini();
 
-        cfs_mutex_up(&console_session.ses_mutex);
+       mutex_unlock(&console_session.ses_mutex);
 
         LASSERT (cfs_list_empty(&console_session.ses_ndl_list));
         LASSERT (cfs_list_empty(&console_session.ses_grp_list));