Squid-2.2.STABLE4: Async-IO sync fixes Async IO sync operation was somewhat incomplete. There could be some operations pending when the sync completed. Also, operations needs to be synced when switching user-id's, or it is uncertain which userid the operations get executed as. Index: squid/src/aiops.c diff -u squid/src/aiops.c:1.1.1.16.2.6 squid/src/aiops.c:1.1.1.16.2.7 --- squid/src/aiops.c:1.1.1.16.2.6 Tue Jul 27 19:34:37 1999 +++ squid/src/aiops.c Sun Aug 1 17:13:05 1999 @@ -869,7 +869,7 @@ { do { aio_poll_threads(); - } while(request_queue_len > 0); + } while(request_queue_len > 0 || busy_threads_head != NULL ); return aio_operations_pending(); } Index: squid/src/tools.c diff -u squid/src/tools.c:1.1.1.22.2.2 squid/src/tools.c:1.1.1.22.2.3 --- squid/src/tools.c:1.1.1.22.2.2 Tue Jul 27 20:47:49 1999 +++ squid/src/tools.c Sun Aug 1 17:13:05 1999 @@ -503,6 +503,10 @@ return; if ((pwd = getpwnam(Config.effectiveUser)) == NULL) return; +#if USE_ASYNC_IO + /* Flush any pending operations before switching user id */ + aioSync(); +#endif if (Config.effectiveGroup && (grp = getgrnam(Config.effectiveGroup))) { if (setgid(grp->gr_gid) < 0) debug(50, 1) ("leave_suid: setgid: %s\n", xstrerror()); @@ -529,6 +533,10 @@ enter_suid(void) { debug(21, 3) ("enter_suid: PID %d taking root priveleges\n", getpid()); +#if USE_ASYNC_IO + /* Flush any pending operations before switching user id */ + aioSync(); +#endif #if HAVE_SETRESUID setresuid(-1, 0, -1); #else