]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Summary: Various fixes - comms and diskio.
authorrobertc <>
Mon, 28 Jul 2003 15:27:28 +0000 (15:27 +0000)
committerrobertc <>
Mon, 28 Jul 2003 15:27:28 +0000 (15:27 +0000)
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.

src/comm.cc
src/fs/aufs/store_io_aufs.cc
src/fs/ufs/store_io_ufs.cc
src/fs/ufs/store_ufs.h
src/protos.h
src/store_client.cc

index 30a443347cbb19b1c169329d3b2dc369ebf9cd57..0b01bef231dde8b28e5956654a198865e3b08628 100644 (file)
@@ -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;
     }
index 820375a7a576bd7f59969a3786acaa79ffcf6e7a..ed826e479f2e4c863bf0124494015f2e82a541fc 100644 (file)
@@ -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++;
index a875c1563b3b926393de453eb812f4902654ba77..cc3f38e3bfd3b257876c114787c899d4e1ce93db 100644 (file)
@@ -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()
 {
index c30ce25d036bd360289250a0781b6625b6ab16a9..afe7b490f53bdd9c27de3c12b32b2ba7c82c3f56 100644 (file)
@@ -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();
index 5b596951a8df825caedee7366996832b72d1df16..b7a2a5e3c48b85d296338b5e5480d0e7672ae625 100644 (file)
@@ -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);
index 9d76a0a36ba2c984a22f350f9531cd91e35eb7b7..7480af7d5c8bfbf701f14a4e10909f87423d746b 100644 (file)
@@ -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