--------------------- PatchSet 11946 Date: 2008/02/16 12:43:57 Author: adrian Branch: SQUID_2_7 Tag: (none) Log: Bugzilla #761 : Handle recursive completion operations in diskd. From the bugzilla bug: The problem is pretty simple in this instance: * client connection is aborted! * storeClose() -> diskd close() -> set diskdstate->flags.close_request * queue a diskd message * out of queue space! call storeDirCallback() * one of the pending IO events is for that client, so it gets handled * but .. the diskstate->flags.close_request for that IO is set, so the assertion gets triggered! Members: src/fs/diskd/store_io_diskd.c:1.38->1.38.2.1 Index: squid/src/fs/diskd/store_io_diskd.c =================================================================== RCS file: /cvsroot/squid/squid/src/fs/diskd/store_io_diskd.c,v retrieving revision 1.38 retrieving revision 1.38.2.1 diff -u -r1.38 -r1.38.2.1 --- squid/src/fs/diskd/store_io_diskd.c 24 Jan 2007 23:23:53 -0000 1.38 +++ squid/src/fs/diskd/store_io_diskd.c 16 Feb 2008 12:43:57 -0000 1.38.2.1 @@ -1,6 +1,6 @@ /* - * $Id: store_io_diskd.c,v 1.38 2007/01/24 23:23:53 wessels Exp $ + * $Id: store_io_diskd.c,v 1.38.2.1 2008/02/16 12:43:57 adrian Exp $ * * DEBUG: section 79 Squid-side DISKD I/O functions. * AUTHOR: Duane Wessels @@ -198,7 +198,10 @@ char *rbuf; diskdstate_t *diskdstate = sio->fsstate; debug(79, 3) ("storeDiskdRead: dirno %d, fileno %08X\n", sio->swap_dirn, sio->swap_filen); - assert(!diskdstate->flags.close_request); + if (diskdstate->flags.close_request) { + debug(79, 2) ("storeDiskRead: closing, so ignore!\n"); + return; + } if (!cbdataValid(sio)) return; if (diskdstate->flags.reading) { @@ -239,6 +242,11 @@ diskdstate_t *diskdstate = sio->fsstate; debug(79, 3) ("storeDiskdWrite: dirno %d, fileno %08X\n", SD->index, sio->swap_filen); assert(!diskdstate->flags.close_request); + if (diskdstate->flags.close_request) { + debug(79, 2) ("storeDiskWrite: closing, so ignore!\n"); + free_func(buf); + return; + } if (!cbdataValid(sio)) { free_func(buf); return; @@ -363,6 +371,10 @@ int valid; statCounter.syscalls.disk.reads++; diskdstate->flags.reading = 0; + if (diskdstate->flags.close_request) { + debug(79, 2) ("storeDiskReadDone: closing, so ignore!\n"); + return; + } valid = cbdataValid(sio->read.callback_data); cbdataUnlock(sio->read.callback_data); debug(79, 3) ("storeDiskdReadDone: dirno %d, fileno %08x status %d\n", @@ -404,7 +416,8 @@ sio->swap_dirn, sio->swap_filen, M->status); if (M->status < 0) { diskd_stats.write.fail++; - storeDiskdIOCallback(sio, DISK_ERROR); + if (!diskdstate->flags.close_request) + storeDiskdIOCallback(sio, DISK_ERROR); return; } diskd_stats.write.success++;