rx: better rxi_FindRpcStat check for end of queue
authorJeffrey Altman <jaltman@your-file-system.com>
Thu, 26 Jul 2012 22:35:48 +0000 (18:35 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Fri, 27 Jul 2012 13:35:43 +0000 (06:35 -0700)
patchset 1f0cf8b2b4bb6e36d8d82323a15ced72d91db0ec tested for
an empty queue but what is really required is a test for end of
queue after the queue_Scan().  If the queue_Scan() completes
at the end of the queue, in other words, pointing at the list
head, then return NULL because no match was found.

Change-Id: I444531d3cfa85b4691eaa8960da0266de82a03a3
Reviewed-on: http://gerrit.openafs.org/7886
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

src/rx/rx.c

index 4689bea..e344db5 100644 (file)
@@ -8112,9 +8112,6 @@ rxi_FindRpcStat(struct rx_queue *stats, afs_uint32 rxInterface,
 {
     rx_interface_stat_p rpc_stat, nrpc_stat;
 
-    if (queue_IsEmpty(stats) && !create)
-        return NULL;
-
     /*
      * See if there's already a structure for this interface
      */
@@ -8126,8 +8123,12 @@ rxi_FindRpcStat(struct rx_queue *stats, afs_uint32 rxInterface,
     }
 
     /* if they didn't ask us to create, we're done */
-    if (!create)
-       return rpc_stat;
+    if (!create) {
+        if (queue_IsEnd(stats, rpc_stat))
+            return NULL;
+        else
+            return rpc_stat;
+    }
 
     /* can't proceed without these */
     if (!totalFunc || !counter)