]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/rxrpc/local_object.c
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
[linux.git] / net / rxrpc / local_object.c
index 3aa179efcda43f2245fd2c71a1af219620d7d097..a6c1349e965d94c3ef6361c04298799a25a2f8c3 100644 (file)
@@ -383,14 +383,11 @@ void rxrpc_put_local(struct rxrpc_local *local)
  */
 struct rxrpc_local *rxrpc_use_local(struct rxrpc_local *local)
 {
-       unsigned int au;
-
        local = rxrpc_get_local_maybe(local);
        if (!local)
                return NULL;
 
-       au = atomic_fetch_add_unless(&local->active_users, 1, 0);
-       if (au == 0) {
+       if (!__rxrpc_use_local(local)) {
                rxrpc_put_local(local);
                return NULL;
        }
@@ -404,14 +401,11 @@ struct rxrpc_local *rxrpc_use_local(struct rxrpc_local *local)
  */
 void rxrpc_unuse_local(struct rxrpc_local *local)
 {
-       unsigned int au;
-
        if (local) {
-               au = atomic_dec_return(&local->active_users);
-               if (au == 0)
+               if (__rxrpc_unuse_local(local)) {
+                       rxrpc_get_local(local);
                        rxrpc_queue_local(local);
-               else
-                       rxrpc_put_local(local);
+               }
        }
 }
 
@@ -468,7 +462,7 @@ static void rxrpc_local_processor(struct work_struct *work)
 
        do {
                again = false;
-               if (atomic_read(&local->active_users) == 0) {
+               if (!__rxrpc_use_local(local)) {
                        rxrpc_local_destroyer(local);
                        break;
                }
@@ -482,6 +476,8 @@ static void rxrpc_local_processor(struct work_struct *work)
                        rxrpc_process_local_events(local);
                        again = true;
                }
+
+               __rxrpc_unuse_local(local);
        } while (again);
 
        rxrpc_put_local(local);