From: wessels <> Date: Tue, 24 Feb 1998 23:39:22 +0000 (+0000) Subject: From: "Michael O'Reilly" X-Git-Tag: SQUID_3_0_PRE1~4013 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0027316c3d0e9bfbbf94f7fd40cfa448bc11cfe;p=thirdparty%2Fsquid.git From: "Michael O'Reilly" so I've added the patch below, which checks the make sure the write request really does match the data passed back from the async IO call. note that I haven't actually rebooted with this patch yet, so 'provisional' is an understatement. --- diff --git a/src/disk.cc b/src/disk.cc index fc89fcbf39..975b07093d 100644 --- a/src/disk.cc +++ b/src/disk.cc @@ -1,6 +1,6 @@ /* - * $Id: disk.cc,v 1.106 1998/02/20 21:04:50 wessels Exp $ + * $Id: disk.cc,v 1.107 1998/02/24 16:39:22 wessels Exp $ * * DEBUG: section 6 Disk I/O Routines * AUTHOR: Harvest Derived @@ -265,6 +265,9 @@ diskHandleWrite(int fd, void *notused) } ctrlp = xcalloc(1, sizeof(disk_ctrl_t)); ctrlp->fd = fd; +#if USE_ASYNC_IO + ctrlp->data = fdd->write_q; +#endif assert(fdd->write_q != NULL); assert(fdd->write_q->len > fdd->write_q->buf_offset); #if USE_ASYNC_IO @@ -295,6 +298,28 @@ diskHandleWriteComplete(void *data, int len, int errcode) int do_callback; errno = errcode; debug(6, 3) ("diskHandleWriteComplete: FD %d len = %d\n", fd, len); +#if USE_ASYNC_IO +/* + * From: "Michael O'Reilly" + * Date: 24 Feb 1998 15:12:06 +0800 + * + * A small patch to improve the AIO sanity. the patch below makes sure + * the write request really does match the data passed back from the + * async IO call. note that I haven't actually rebooted with this + * patch yet, so 'provisional' is an understatement. + */ + if (q && q != ctrlp->data) { + dwrite_q *p = ctrlp->data; + debug(50, 0) ("KARMA: q != data (%p, %p)\n", q, p); + debug(50, 0) ("KARMA: (%d, %d, %d FD %d)\n", + q->buf_offset, q->len, len, fd); + debug(50, 0) ("KARMA: desc %s, type %d, open %d, flags 0x%x\n", + F->desc, F->type, F->open, F->flags); + debug(50, 0) ("KARMA: (%d, %d)\n", p->buf_offset, p->len); + len = -1; + errcode = EFAULT; + } +#endif safe_free(data); if (q == NULL) /* Someone aborted then write completed */ return;