LICENSE IPL10
FIXES 124359
avoid either reopening closed vnodes and leaving cached descriptors around,
or discarding a reference we're not holding; instead, sync changes when the
fd is closed, and note such has been done; otherwise, no changes from older
code.
return 0;
IH_LOCK;
+ ihP->ih_refcnt++; /* must not disappear over unlock */
+ if (ihP->ih_synced) {
+ FdHandle_t *fdP;
+ IH_UNLOCK;
+
+ fdP = IH_OPEN(ihP);
+ if (fdP) {
+ OS_SYNC(fdP->fd_fd);
+ FDH_CLOSE(fdP);
+ }
+
+ IH_LOCK;
+ }
+
assert(ihP->ih_refcnt > 0);
+ ihP->ih_synced = 0;
+
ih_fdclose(ihP);
- IH_UNLOCK;
+ if (ihP->ih_refcnt > 1) {
+ ihP->ih_refcnt--;
+ IH_UNLOCK;
+ } else {
+ IH_UNLOCK;
+ ih_release(ihP);
+ }
return 0;
}
IH_UNLOCK;
fdP = IH_OPEN(ihP);
- if (fdP) OS_SYNC(fdP->fd_fd);
- FDH_CLOSE(fdP);
+ if (fdP) {
+ OS_SYNC(fdP->fd_fd);
+ FDH_CLOSE(fdP);
+ }
IH_LOCK;
}
for (i = 0; i < vec_len; i++) {
IH_REALLYCLOSE(ih_vec[i]);
- IH_RELEASE(ih_vec[i]);
}
free(ih_vec);