--------------------- PatchSet 11947 Date: 2008/02/16 12:45:48 Author: adrian Branch: SQUID_2_6 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.33.2.4->1.33.2.5 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.33.2.4 retrieving revision 1.33.2.5 diff -u -r1.33.2.4 -r1.33.2.5 --- squid/src/fs/diskd/store_io_diskd.c 3 Feb 2007 21:54:16 -0000 1.33.2.4 +++ squid/src/fs/diskd/store_io_diskd.c 16 Feb 2008 12:45:48 -0000 1.33.2.5 @@ -1,6 +1,6 @@ /* - * $Id: store_io_diskd.c,v 1.33.2.4 2007/02/03 21:54:16 hno Exp $ + * $Id: store_io_diskd.c,v 1.33.2.5 2008/02/16 12:45:48 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++;