Merge patch series "Putting some basic order on isa extension lists"
[linux-2.6-microblaze.git] / net / rxrpc / peer_event.c
index 6685bf9..552ba84 100644 (file)
@@ -235,6 +235,7 @@ static void rxrpc_peer_keepalive_dispatch(struct rxrpc_net *rxnet,
        struct rxrpc_peer *peer;
        const u8 mask = ARRAY_SIZE(rxnet->peer_keepalive) - 1;
        time64_t keepalive_at;
+       bool use;
        int slot;
 
        spin_lock(&rxnet->peer_hash_lock);
@@ -247,9 +248,10 @@ static void rxrpc_peer_keepalive_dispatch(struct rxrpc_net *rxnet,
                if (!rxrpc_get_peer_maybe(peer, rxrpc_peer_get_keepalive))
                        continue;
 
-               if (__rxrpc_use_local(peer->local, rxrpc_local_use_peer_keepalive)) {
-                       spin_unlock(&rxnet->peer_hash_lock);
+               use = __rxrpc_use_local(peer->local, rxrpc_local_use_peer_keepalive);
+               spin_unlock(&rxnet->peer_hash_lock);
 
+               if (use) {
                        keepalive_at = peer->last_tx_at + RXRPC_KEEPALIVE_TIME;
                        slot = keepalive_at - base;
                        _debug("%02x peer %u t=%d {%pISp}",
@@ -270,9 +272,11 @@ static void rxrpc_peer_keepalive_dispatch(struct rxrpc_net *rxnet,
                        spin_lock(&rxnet->peer_hash_lock);
                        list_add_tail(&peer->keepalive_link,
                                      &rxnet->peer_keepalive[slot & mask]);
+                       spin_unlock(&rxnet->peer_hash_lock);
                        rxrpc_unuse_local(peer->local, rxrpc_local_unuse_peer_keepalive);
                }
-               rxrpc_put_peer_locked(peer, rxrpc_peer_put_keepalive);
+               rxrpc_put_peer(peer, rxrpc_peer_put_keepalive);
+               spin_lock(&rxnet->peer_hash_lock);
        }
 
        spin_unlock(&rxnet->peer_hash_lock);