From: robertc <> Date: Mon, 28 Jul 2003 15:27:28 +0000 (+0000) Subject: Summary: Various fixes - comms and diskio. X-Git-Tag: SQUID_3_0_PRE2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=db2ff94c9a0499143b615a37c26f31ae66ddb962;p=thirdparty%2Fsquid.git Summary: Various fixes - comms and diskio. Keywords: Comm accept logic was not indicating that it was not cbdata. Also, mark eventAdd as extern, not C extern. UFS IO module was not reporting failure on failed opens. AUFS - log when reads are scheduled, as queued reads are scheduled after the read_ call. Fix a race condition with synchronous store opens, that previously lead to double-callbacks. --- diff --git a/src/comm.cc b/src/comm.cc index 30a443347c..0b01bef231 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.383 2003/07/14 11:03:38 robertc Exp $ + * $Id: comm.cc,v 1.384 2003/07/28 09:27:28 robertc Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -1030,7 +1030,7 @@ comm_accept_check_event(void *data) } eventAdd("comm_accept_check_event", comm_accept_check_event, &fdc_table[fd], - 1000.0 / (double)(fdc_table[fd].accept.accept.check_delay), 1); + 1000.0 / (double)(fdc_table[fd].accept.accept.check_delay), 1, false); } @@ -2381,7 +2381,7 @@ fdc_t::acceptOne(int fd) { if (fdNFree() < RESERVED_FD) { debug(5, 3) ("comm_accept_try: we're out of fds - deferring io!\n"); eventAdd("comm_accept_check_event", comm_accept_check_event, this, - 1000.0 / (double)(accept.accept.check_delay), 1); + 1000.0 / (double)(accept.accept.check_delay), 1, false); accept.accept.finished(true); return; } diff --git a/src/fs/aufs/store_io_aufs.cc b/src/fs/aufs/store_io_aufs.cc index 820375a7a5..ed826e479f 100644 --- a/src/fs/aufs/store_io_aufs.cc +++ b/src/fs/aufs/store_io_aufs.cc @@ -182,6 +182,7 @@ AUFSFile::open (int flags, mode_t mode, IORequestor::Pointer callback) void AUFSFile::read(char *buf, off_t offset, size_t size) { + debug(79, 3) ("AUFSFile::read: %p, size %u\n", this, size); assert (fd > -1); assert (ioRequestor.getRaw()); statCounter.syscalls.disk.reads++; diff --git a/src/fs/ufs/store_io_ufs.cc b/src/fs/ufs/store_io_ufs.cc index a875c1563b..cc3f38e3bf 100644 --- a/src/fs/ufs/store_io_ufs.cc +++ b/src/fs/ufs/store_io_ufs.cc @@ -1,6 +1,6 @@ /* - * $Id: store_io_ufs.cc,v 1.20 2003/07/22 15:23:15 robertc Exp $ + * $Id: store_io_ufs.cc,v 1.21 2003/07/28 09:27:29 robertc Exp $ * * DEBUG: section 79 Storage Manager UFS Interface * AUTHOR: Duane Wessels @@ -125,7 +125,7 @@ UFSFile::operator delete (void *address) void UFSFile::deleteSelf() const {delete this;} -UFSFile::UFSFile (char const *aPath) : fd (-1), closed (true) +UFSFile::UFSFile (char const *aPath) : fd (-1), closed (true), error_(false) { assert (aPath); debug (79,3)("UFSFile::UFSFile: %s\n", aPath); @@ -147,6 +147,7 @@ UFSFile::open (int flags, mode_t mode, IORequestor::Pointer callback) if (fd < 0) { debug(79, 3) ("UFSFile::open: got failure (%d)\n", errno); + error(true); } else { closed = false; store_open_disk_fd++; @@ -192,12 +193,17 @@ UFSFile::canRead() const bool UFSFile::error() const { - if (fd < 0 && !closed) + if ((fd < 0 && !closed) || error_) return true; return false; } +void UFSFile::error(bool const &aBool) +{ + error_ = aBool; +} + void UFSStoreState::ioCompletedNotification() { diff --git a/src/fs/ufs/store_ufs.h b/src/fs/ufs/store_ufs.h index c30ce25d03..afe7b490f5 100644 --- a/src/fs/ufs/store_ufs.h +++ b/src/fs/ufs/store_ufs.h @@ -35,6 +35,8 @@ private: CBDATA_CLASS(UFSFile); int fd; bool closed; + void error (bool const &); + bool error_; char const *path_; IORequestor::Pointer ioRequestor; void doClose(); diff --git a/src/protos.h b/src/protos.h index 5b596951a8..b7a2a5e3c4 100644 --- a/src/protos.h +++ b/src/protos.h @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.485 2003/07/22 15:23:02 robertc Exp $ + * $Id: protos.h,v 1.486 2003/07/28 09:27:28 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -242,7 +242,7 @@ SQUIDCEXTERN void idnsALookup(const char *, IDNSCB *, void *); SQUIDCEXTERN void idnsPTRLookup(const struct in_addr, IDNSCB *, void *); -SQUIDCEXTERN void eventAdd(const char *name, EVH * func, void *arg, double when, int, bool cbdata=true); +extern void eventAdd(const char *name, EVH * func, void *arg, double when, int, bool cbdata=true); SQUIDCEXTERN void eventAddIsh(const char *name, EVH * func, void *arg, double delta_ish, int); SQUIDCEXTERN void eventRun(void); SQUIDCEXTERN int eventNextTime(void); diff --git a/src/store_client.cc b/src/store_client.cc index 9d76a0a36b..7480af7d5c 100644 --- a/src/store_client.cc +++ b/src/store_client.cc @@ -1,6 +1,6 @@ /* - * $Id: store_client.cc,v 1.131 2003/07/14 14:16:02 robertc Exp $ + * $Id: store_client.cc,v 1.132 2003/07/28 09:27:28 robertc Exp $ * * DEBUG: section 90 Storage Manager Client-Side Interface * AUTHOR: Duane Wessels @@ -493,7 +493,15 @@ void store_client::fail() { object_ok = false; - callback(0, true); + /* synchronous open failures callback from the store, + * before startSwapin detects the failure. + * TODO: fix this inconsistent behaviour - probably by + * having storeSwapInStart become a callback functions, + * not synchronous + */ + + if (callbackPending()) + callback(0, true); } static void