rxrpc: Provide queuing helper functions
authorDavid Howells <dhowells@redhat.com>
Mon, 27 Jun 2016 09:32:02 +0000 (10:32 +0100)
committerDavid Howells <dhowells@redhat.com>
Wed, 6 Jul 2016 09:43:05 +0000 (10:43 +0100)
Provide queueing helper functions so that the queueing of local and
connection objects can be fixed later.

The issue is that a ref on the object needs to be passed to the work queue,
but the act of queueing the object may fail because the object is already
queued.  Testing the queuedness of an object before hand doesn't work
because there can be a race with someone else trying to queue it.  What
will have to be done is to adjust the refcount depending on the result of
the queue operation.

Signed-off-by: David Howells <dhowells@redhat.com>
net/rxrpc/ar-internal.h
net/rxrpc/conn_event.c
net/rxrpc/input.c

index 796368d..45aef3e 100644 (file)
@@ -35,7 +35,6 @@ struct rxrpc_crypt {
        queue_delayed_work(rxrpc_workqueue, (WS), (D))
 
 #define rxrpc_queue_call(CALL) rxrpc_queue_work(&(CALL)->processor)
-#define rxrpc_queue_conn(CONN) rxrpc_queue_work(&(CONN)->processor)
 
 struct rxrpc_connection;
 
@@ -566,6 +565,12 @@ static inline void rxrpc_get_connection(struct rxrpc_connection *conn)
        atomic_inc(&conn->usage);
 }
 
+
+static inline void rxrpc_queue_conn(struct rxrpc_connection *conn)
+{
+       rxrpc_queue_work(&conn->processor);
+}
+
 /*
  * input.c
  */
@@ -618,6 +623,11 @@ static inline void rxrpc_put_local(struct rxrpc_local *local)
                __rxrpc_put_local(local);
 }
 
+static inline void rxrpc_queue_local(struct rxrpc_local *local)
+{
+       rxrpc_queue_work(&local->processor);
+}
+
 /*
  * misc.c
  */
index 6a3c967..d7e183c 100644 (file)
@@ -318,7 +318,7 @@ void rxrpc_reject_packet(struct rxrpc_local *local, struct sk_buff *skb)
        CHECK_SLAB_OKAY(&local->usage);
 
        skb_queue_tail(&local->reject_queue, skb);
-       rxrpc_queue_work(&local->processor);
+       rxrpc_queue_local(local);
 }
 
 /*
index 5f26cae..fe7ff33 100644 (file)
@@ -595,7 +595,7 @@ static void rxrpc_post_packet_to_local(struct rxrpc_local *local,
        _enter("%p,%p", local, skb);
 
        skb_queue_tail(&local->event_queue, skb);
-       rxrpc_queue_work(&local->processor);
+       rxrpc_queue_local(local);
 }
 
 /*