ihandle: don't keep reallyclosing future fds
authorDerrick Brashear <shadow@dementix.org>
Mon, 21 Nov 2011 17:06:59 +0000 (12:06 -0500)
committerDerrick Brashear <shadow@dementix.org>
Thu, 9 Aug 2012 15:08:26 +0000 (08:08 -0700)
given that we can mark something invalid for future use, ever,
once we have done so for all fds, we ih_reallyclose is done.
don't persist the setting to the detriment of new fds

Change-Id: If82368dad79841a5d68f45a608b2645b32f951e7
Reviewed-on: http://gerrit.openafs.org/6101
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

src/vol/ihandle.c

index 90fd2ad..a9608c9 100644 (file)
@@ -508,6 +508,20 @@ fd_reallyclose(FdHandle_t * fdP)
      */
     if (!ihP->ih_fdhead) {
        ihP->ih_flags &= ~IH_REALLY_CLOSED;
+    } else {
+       FdHandle_t *lfdP, *next;
+       int clear = 1;
+       for (lfdP = ihP->ih_fdhead; lfdP != NULL; lfdP = next) {
+           next = lfdP->fd_ihnext;
+           osi_Assert(lfdP->fd_ih == ihP);
+           if (lfdP->fd_status != FD_HANDLE_CLOSING) {
+               clear = 0;
+               break;
+           }
+       }
+       /* no *future* fd should be subjected to this */
+       if (clear)
+           ihP->ih_flags &= ~IH_REALLY_CLOSED;
     }
 
     if (fdP->fd_refcnt == 0) {