Merge remote-tracking branch 'lightnvm/for-next'
[deliverable/linux.git] / net / rxrpc / conn_client.c
index 349402b08e5abf80ef93392b9a6af2176f534bf4..9344a8416ceb4cc4ca9a3682a2a3ce4e04c229f5 100644 (file)
@@ -108,12 +108,12 @@ static DECLARE_DELAYED_WORK(rxrpc_client_conn_reap,
 /*
  * Get a connection ID and epoch for a client connection from the global pool.
  * The connection struct pointer is then recorded in the idr radix tree.  The
- * epoch is changed if this wraps.
+ * epoch doesn't change until the client is rebooted (or, at least, unless the
+ * module is unloaded).
  */
 static int rxrpc_get_client_connection_id(struct rxrpc_connection *conn,
                                          gfp_t gfp)
 {
-       u32 epoch;
        int id;
 
        _enter("");
@@ -121,34 +121,18 @@ static int rxrpc_get_client_connection_id(struct rxrpc_connection *conn,
        idr_preload(gfp);
        spin_lock(&rxrpc_conn_id_lock);
 
-       epoch = rxrpc_epoch;
-
-       /* We could use idr_alloc_cyclic() here, but we really need to know
-        * when the thing wraps so that we can advance the epoch.
-        */
-       if (rxrpc_client_conn_ids.cur == 0)
-               rxrpc_client_conn_ids.cur = 1;
-       id = idr_alloc(&rxrpc_client_conn_ids, conn,
-                      rxrpc_client_conn_ids.cur, 0x40000000, GFP_NOWAIT);
-       if (id < 0) {
-               if (id != -ENOSPC)
-                       goto error;
-               id = idr_alloc(&rxrpc_client_conn_ids, conn,
-                              1, 0x40000000, GFP_NOWAIT);
-               if (id < 0)
-                       goto error;
-               epoch++;
-               rxrpc_epoch = epoch;
-       }
-       rxrpc_client_conn_ids.cur = id + 1;
+       id = idr_alloc_cyclic(&rxrpc_client_conn_ids, conn,
+                             1, 0x40000000, GFP_NOWAIT);
+       if (id < 0)
+               goto error;
 
        spin_unlock(&rxrpc_conn_id_lock);
        idr_preload_end();
 
-       conn->proto.epoch = epoch;
+       conn->proto.epoch = rxrpc_epoch;
        conn->proto.cid = id << RXRPC_CIDSHIFT;
        set_bit(RXRPC_CONN_HAS_IDR, &conn->flags);
-       _leave(" [CID %x:%x]", epoch, conn->proto.cid);
+       _leave(" [CID %x]", conn->proto.cid);
        return 0;
 
 error:
@@ -364,6 +348,7 @@ static int rxrpc_get_client_conn(struct rxrpc_call *call,
 
        if (cp->exclusive) {
                call->conn = candidate;
+               call->security_ix = candidate->security_ix;
                _leave(" = 0 [exclusive %d]", candidate->debug_id);
                return 0;
        }
@@ -411,6 +396,7 @@ static int rxrpc_get_client_conn(struct rxrpc_call *call,
 candidate_published:
        set_bit(RXRPC_CONN_IN_CLIENT_CONNS, &candidate->flags);
        call->conn = candidate;
+       call->security_ix = candidate->security_ix;
        spin_unlock(&local->client_conns_lock);
        _leave(" = 0 [new %d]", candidate->debug_id);
        return 0;
@@ -428,6 +414,7 @@ found_extant_conn:
 
        spin_lock(&conn->channel_lock);
        call->conn = conn;
+       call->security_ix = conn->security_ix;
        list_add(&call->chan_wait_link, &conn->waiting_calls);
        spin_unlock(&conn->channel_lock);
        _leave(" = 0 [extant %d]", conn->debug_id);
@@ -537,6 +524,11 @@ static void rxrpc_activate_one_channel(struct rxrpc_connection *conn,
                                             struct rxrpc_call, chan_wait_link);
        u32 call_id = chan->call_counter + 1;
 
+       write_lock_bh(&call->state_lock);
+       call->state = RXRPC_CALL_CLIENT_SEND_REQUEST;
+       write_unlock_bh(&call->state_lock);
+
+       rxrpc_see_call(call);
        list_del_init(&call->chan_wait_link);
        conn->active_chans |= 1 << channel;
        call->peer      = rxrpc_get_peer(conn->params.peer);
@@ -741,7 +733,7 @@ void rxrpc_disconnect_client_call(struct rxrpc_call *call)
         * terminal retransmission without requiring access to the call.
         */
        if (test_bit(RXRPC_CALL_EXPOSED, &call->flags)) {
-               _debug("exposed %u,%u", call->call_id, call->local_abort);
+               _debug("exposed %u,%u", call->call_id, call->abort_code);
                __rxrpc_disconnect_call(conn, call);
        }
 
This page took 0.031954 seconds and 5 git commands to generate.