]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
ihandle: Actually assert active fdPs are not AVAIL
authorAndrew Deason <adeason@sinenomine.net>
Wed, 24 Aug 2011 17:30:00 +0000 (12:30 -0500)
committerDerrick Brashear <shadow@dementix.org>
Fri, 16 Dec 2011 11:03:42 +0000 (03:03 -0800)
FdHandle_t's that are on the linked list for an associated IHandle_t
should not be in the state FD_HANDLE_AVAIL. For the non-PIO case, we
assert that this is the case in ih_open (since we assert that if the
FdHandle_t is not in INUSE state, then it must be in OPEN state).
However, for the PIO case, we were just skipping over any FdHandle_t's
that were in the AVAIL state. These should never exist while on that
linked list, so assert for the PIO case, as well.

In the absence of bugs, there is no functional change here, but it
perhaps makes the ih_open loop easier to understand.

Reviewed-on: http://gerrit.openafs.org/5307
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 6d79cfb36165c33dd1fd9c4d7ca8436d9a78f7ff)

Change-Id: If9e74f6120b007368128aead8787d715a1b1f093
Reviewed-on: http://gerrit.openafs.org/6306
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
src/vol/ihandle.c

index 3e8a5129819cc0b0aab769c8ad5ed202485919c9..675abe4845466ee05987a8542d77ae79092cd641 100644 (file)
@@ -353,20 +353,22 @@ ih_open(IHandle_t * ihP)
         * If we don't have positional i/o, don't try to share fds, since
         * we can't do so in a threadsafe way.
         */
-       if (fdP->fd_status != FD_HANDLE_INUSE) {
-           osi_Assert(fdP->fd_status == FD_HANDLE_OPEN);
+       if (fdP->fd_status == FD_HANDLE_INUSE) {
+           continue;
+       }
+       osi_Assert(fdP->fd_status == FD_HANDLE_OPEN);
 #else /* HAVE_PIO */
-       if (fdP->fd_status != FD_HANDLE_AVAIL) {
+       osi_Assert(fdP->fd_status != FD_HANDLE_AVAIL);
 #endif /* HAVE_PIO */
-           fdP->fd_refcnt++;
-           if (fdP->fd_status == FD_HANDLE_OPEN) {
-               fdP->fd_status = FD_HANDLE_INUSE;
-               DLL_DELETE(fdP, fdLruHead, fdLruTail, fd_next, fd_prev);
-           }
-           ihP->ih_refcnt++;
-           IH_UNLOCK;
-           return fdP;
+
+       fdP->fd_refcnt++;
+       if (fdP->fd_status == FD_HANDLE_OPEN) {
+           fdP->fd_status = FD_HANDLE_INUSE;
+           DLL_DELETE(fdP, fdLruHead, fdLruTail, fd_next, fd_prev);
        }
+       ihP->ih_refcnt++;
+       IH_UNLOCK;
+       return fdP;
     }
 
     /*