diff options
author | David Howells <dhowells@redhat.com> | 2016-09-04 08:14:46 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2016-09-04 16:41:39 -0400 |
commit | 090f85deb6e88f0edff1a18d610abd857e30c753 (patch) | |
tree | 0741cf2fd76802f0a5d06e421279dacd4064df49 | |
parent | 5f2d9c44389e7cd9fe192570f6f20199bc861eb8 (diff) |
rxrpc: Don't change the epoch
It seems the local epoch should only be changed on boot, so remove the code
that changes it for client connections.
Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r-- | net/rxrpc/conn_client.c | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/net/rxrpc/conn_client.c b/net/rxrpc/conn_client.c index e19804dd6c8d..82de1aeaef21 100644 --- a/net/rxrpc/conn_client.c +++ b/net/rxrpc/conn_client.c | |||
@@ -108,12 +108,12 @@ static DECLARE_DELAYED_WORK(rxrpc_client_conn_reap, | |||
108 | /* | 108 | /* |
109 | * Get a connection ID and epoch for a client connection from the global pool. | 109 | * Get a connection ID and epoch for a client connection from the global pool. |
110 | * The connection struct pointer is then recorded in the idr radix tree. The | 110 | * The connection struct pointer is then recorded in the idr radix tree. The |
111 | * epoch is changed if this wraps. | 111 | * epoch doesn't change until the client is rebooted (or, at least, unless the |
112 | * module is unloaded). | ||
112 | */ | 113 | */ |
113 | static int rxrpc_get_client_connection_id(struct rxrpc_connection *conn, | 114 | static int rxrpc_get_client_connection_id(struct rxrpc_connection *conn, |
114 | gfp_t gfp) | 115 | gfp_t gfp) |
115 | { | 116 | { |
116 | u32 epoch; | ||
117 | int id; | 117 | int id; |
118 | 118 | ||
119 | _enter(""); | 119 | _enter(""); |
@@ -121,34 +121,18 @@ static int rxrpc_get_client_connection_id(struct rxrpc_connection *conn, | |||
121 | idr_preload(gfp); | 121 | idr_preload(gfp); |
122 | spin_lock(&rxrpc_conn_id_lock); | 122 | spin_lock(&rxrpc_conn_id_lock); |
123 | 123 | ||
124 | epoch = rxrpc_epoch; | 124 | id = idr_alloc_cyclic(&rxrpc_client_conn_ids, conn, |
125 | 125 | 1, 0x40000000, GFP_NOWAIT); | |
126 | /* We could use idr_alloc_cyclic() here, but we really need to know | 126 | if (id < 0) |
127 | * when the thing wraps so that we can advance the epoch. | 127 | goto error; |
128 | */ | ||
129 | if (rxrpc_client_conn_ids.cur == 0) | ||
130 | rxrpc_client_conn_ids.cur = 1; | ||
131 | id = idr_alloc(&rxrpc_client_conn_ids, conn, | ||
132 | rxrpc_client_conn_ids.cur, 0x40000000, GFP_NOWAIT); | ||
133 | if (id < 0) { | ||
134 | if (id != -ENOSPC) | ||
135 | goto error; | ||
136 | id = idr_alloc(&rxrpc_client_conn_ids, conn, | ||
137 | 1, 0x40000000, GFP_NOWAIT); | ||
138 | if (id < 0) | ||
139 | goto error; | ||
140 | epoch++; | ||
141 | rxrpc_epoch = epoch; | ||
142 | } | ||
143 | rxrpc_client_conn_ids.cur = id + 1; | ||
144 | 128 | ||
145 | spin_unlock(&rxrpc_conn_id_lock); | 129 | spin_unlock(&rxrpc_conn_id_lock); |
146 | idr_preload_end(); | 130 | idr_preload_end(); |
147 | 131 | ||
148 | conn->proto.epoch = epoch; | 132 | conn->proto.epoch = rxrpc_epoch; |
149 | conn->proto.cid = id << RXRPC_CIDSHIFT; | 133 | conn->proto.cid = id << RXRPC_CIDSHIFT; |
150 | set_bit(RXRPC_CONN_HAS_IDR, &conn->flags); | 134 | set_bit(RXRPC_CONN_HAS_IDR, &conn->flags); |
151 | _leave(" [CID %x:%x]", epoch, conn->proto.cid); | 135 | _leave(" [CID %x]", conn->proto.cid); |
152 | return 0; | 136 | return 0; |
153 | 137 | ||
154 | error: | 138 | error: |