--------------------- PatchSet 11285 Date: 2007/03/03 13:32:44 Author: hno Branch: SQUID_2_6 Tag: (none) Log: Author: serassio MFC: Bug #1892: COSS tries to shut down the same directory twice on exit Whit this patch storeCossDirPick() can pick only an active COSS Store Merged changes: 2007/02/27 09:01:53 serassio +14 -23 Bug #1892: COSS tries to shut down the same directory twice on exit Members: src/fs/coss/store_dir_coss.c:1.66->1.66.2.1 Index: squid/src/fs/coss/store_dir_coss.c =================================================================== RCS file: /cvsroot/squid/squid/src/fs/coss/store_dir_coss.c,v retrieving revision 1.66 retrieving revision 1.66.2.1 diff -u -r1.66 -r1.66.2.1 --- squid/src/fs/coss/store_dir_coss.c 5 Nov 2006 21:14:32 -0000 1.66 +++ squid/src/fs/coss/store_dir_coss.c 3 Mar 2007 13:32:44 -0000 1.66.2.1 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_coss.c,v 1.66 2006/11/05 21:14:32 hno Exp $ + * $Id: store_dir_coss.c,v 1.66.2.1 2007/03/03 13:32:44 hno Exp $ * * DEBUG: section 47 Store COSS Directory Routines * AUTHOR: Eric Stern @@ -627,6 +627,8 @@ storeCossDirShutdown(SwapDir * SD) { CossInfo *cs = (CossInfo *) SD->fsdata; + if (cs->fd == -1) + return; debug(47, 1) ("COSS: %s: syncing\n", stripePath(SD)); storeCossSync(SD); /* This'll call a_file_syncqueue() or a aioSync() */ @@ -1066,28 +1068,17 @@ for (i = 0; i < Config.cacheSwap.n_configured; i++) { SD = &Config.cacheSwap.swapDirs[i]; if (strcmp(SD->type, SWAPDIR_COSS) == 0) { - if ((last_coss_pick_index == -1) || (n_coss_dirs == 1)) { - last_coss_pick_index = i; - return SD; - } else if (choosenext) { - last_coss_pick_index = i; - return SD; - } else if (last_coss_pick_index == i) { - choosenext = 1; - } - } - } - for (i = 0; i < Config.cacheSwap.n_configured; i++) { - SD = &Config.cacheSwap.swapDirs[i]; - if (strcmp(SD->type, SWAPDIR_COSS) == 0) { - if ((last_coss_pick_index == -1) || (n_coss_dirs == 1)) { - last_coss_pick_index = i; - return SD; - } else if (choosenext) { - last_coss_pick_index = i; - return SD; - } else if (last_coss_pick_index == i) { - choosenext = 1; + CossInfo *cs = (CossInfo *) SD->fsdata; + if (cs->fd != -1) { + if ((last_coss_pick_index == -1) || (n_coss_dirs == 1)) { + last_coss_pick_index = i; + return SD; + } else if (choosenext) { + last_coss_pick_index = i; + return SD; + } else if (last_coss_pick_index == i) { + choosenext = 1; + } } } }