]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
DW:
authorwessels <>
Fri, 13 Oct 2000 12:35:05 +0000 (12:35 +0000)
committerwessels <>
Fri, 13 Oct 2000 12:35:05 +0000 (12:35 +0000)
 - We have to test the bit before calling file_map_bit_reset.
   file_map_bit_reset doesn't do bounds checking.  It assumes
   filn is a valid file number, but it might not be because
   the map is dynamic in size.  Also clearing an already clear
   bit puts the map counter of-of-whack.  Damn, been looking
   for that bug for a long time.

- gindent for good measure.

src/fs/aufs/store_dir_aufs.cc
src/fs/diskd/store_dir_diskd.cc
src/fs/ufs/store_dir_ufs.cc

index ad1da3c76e4cb966e60a354100a6e0702ca8671d..f5d877588e790dbf068f763620f9dbc2d78435c3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_aufs.cc,v 1.7 2000/06/27 22:06:23 hno Exp $
+ * $Id: store_dir_aufs.cc,v 1.8 2000/10/13 06:35:05 wessels Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -152,7 +152,15 @@ storeAufsDirMapBitReset(SwapDir * SD, int fn)
     sfileno filn = fn;
     aioinfo_t *aioinfo;
     aioinfo = (aioinfo_t *) SD->fsdata;
-    file_map_bit_reset(aioinfo->map, filn);
+    /*
+     * We have to test the bit before calling file_map_bit_reset.
+     * file_map_bit_reset doesn't do bounds checking.  It assumes
+     * filn in a valid file number, but it might not be because
+     * the map is dynamic in size.  Also clearing an already clear
+     * bit puts the map counter of-of-whack.
+     */
+    if (file_map_bit_test(aioinfo->map, filn))
+       file_map_bit_reset(aioinfo->map, filn);
 }
 
 int
@@ -348,9 +356,9 @@ storeAufsDirInit(SwapDir * sd)
 {
     static int started_clean_event = 0;
     static const char *errmsg =
-       "\tFailed to verify one of the swap directories, Check cache.log\n"
-       "\tfor details.  Run 'squid -z' to create swap directories\n"
-       "\tif needed, or if running Squid for the first time.";
+    "\tFailed to verify one of the swap directories, Check cache.log\n"
+    "\tfor details.  Run 'squid -z' to create swap directories\n"
+    "\tif needed, or if running Squid for the first time.";
     storeAufsDirInitBitmap(sd);
     if (storeAufsDirVerifyCacheDirs(sd) < 0)
        fatal(errmsg);
@@ -1270,8 +1278,8 @@ storeAufsDirValidFileno(SwapDir * SD, sfileno filn, int flag)
      * be considered invalid.
      */
     if (flag)
-    if (filn > aioinfo->map->max_n_files)
-       return 0;
+       if (filn > aioinfo->map->max_n_files)
+           return 0;
     return 1;
 }
 
index 7e06f481926a1f537e90906016e521571caf9a82..223ccd1da21b29b8ac10944c4d8ce882d7a22c66 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_diskd.cc,v 1.18 2000/10/06 05:21:58 wessels Exp $
+ * $Id: store_dir_diskd.cc,v 1.19 2000/10/13 06:35:19 wessels Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -165,7 +165,15 @@ storeDiskdDirMapBitReset(SwapDir * SD, int fn)
     sfileno filn = fn;
     diskdinfo_t *diskdinfo;
     diskdinfo = SD->fsdata;
-    file_map_bit_reset(diskdinfo->map, filn);
+    /* 
+     * We have to test the bit before calling file_map_bit_reset.
+     * file_map_bit_reset doesn't do bounds checking.  It assumes
+     * filn in a valid file number, but it might not be because
+     * the map is dynamic in size.  Also clearing an already clear
+     * bit puts the map counter of-of-whack.
+     */
+    if (file_map_bit_test(diskdinfo->map, filn))
+       file_map_bit_reset(diskdinfo->map, filn);
 }
 
 int
index 385c6ad6071d8c59b15da3d78c9c8a54e48edb56..463221c934d5ebe79400160c73c93bf21c61f1ec 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_ufs.cc,v 1.7 2000/06/27 22:06:26 hno Exp $
+ * $Id: store_dir_ufs.cc,v 1.8 2000/10/13 06:35:21 wessels Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -152,7 +152,15 @@ storeUfsDirMapBitReset(SwapDir * SD, int fn)
     sfileno filn = fn;
     ufsinfo_t *ufsinfo;
     ufsinfo = (ufsinfo_t *) SD->fsdata;
-    file_map_bit_reset(ufsinfo->map, filn);
+    /*
+     * We have to test the bit before calling file_map_bit_reset.
+     * file_map_bit_reset doesn't do bounds checking.  It assumes
+     * filn in a valid file number, but it might not be because
+     * the map is dynamic in size.  Also clearing an already clear
+     * bit puts the map counter of-of-whack.
+     */
+    if (file_map_bit_test(ufsinfo->map, filn))
+       file_map_bit_reset(ufsinfo->map, filn);
 }
 
 int
@@ -348,9 +356,9 @@ storeUfsDirInit(SwapDir * sd)
 {
     static int started_clean_event = 0;
     static const char *errmsg =
-       "\tFailed to verify one of the swap directories, Check cache.log\n"
-       "\tfor details.  Run 'squid -z' to create swap directories\n"
-       "\tif needed, or if running Squid for the first time.";
+    "\tFailed to verify one of the swap directories, Check cache.log\n"
+    "\tfor details.  Run 'squid -z' to create swap directories\n"
+    "\tif needed, or if running Squid for the first time.";
     storeUfsDirInitBitmap(sd);
     if (storeUfsDirVerifyCacheDirs(sd) < 0)
        fatal(errmsg);