]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3840: assertion failed 'sde' in UFS cache loading
authorAlex Rousskov <rousskov@measurement-factory.com>
Mon, 6 May 2013 12:19:39 +0000 (06:19 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 6 May 2013 12:19:39 +0000 (06:19 -0600)
src/fs/ufs/RebuildState.cc

index b3c2d0d090f16ba94faebe068f2f8671ccf8a573..d327c88c75761d9936f6d51a9279bdb9d9423579 100644 (file)
@@ -420,9 +420,14 @@ Fs::Ufs::RebuildState::undoAdd()
     added->releaseRequest();
 
     if (added->swap_filen > -1) {
-        UFSSwapDir *sde = dynamic_cast<UFSSwapDir *>(INDEXSD(added->swap_dirn));
-        assert(sde);
-        sde->undoAddDiskRestore(added);
+        SwapDir *someDir = INDEXSD(added->swap_dirn);
+        assert(someDir);
+        if (UFSSwapDir *ufsDir = dynamic_cast<UFSSwapDir*>(someDir))
+            ufsDir->undoAddDiskRestore(added);
+        // else the entry was loaded from and/or is currently in a non-UFS dir
+        // Thus, there is no use in preserving its disk file (the only purpose
+        // of undoAddDiskRestore!), even if we could. Instead, we release the
+        // the entry and [eventually] unlink its disk file or free its slot.
     }
 
     added->release();