--------------------- PatchSet 11277 Date: 2007/02/27 09:01:53 Author: serassio Branch: HEAD Tag: (none) Log: Bug #1892: COSS tries to shut down the same directory twice on exit Whit this patch storeCossDirPick() can pick only an active COSS Store Members: src/fs/coss/store_dir_coss.c:1.67->1.68 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.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- squid/src/fs/coss/store_dir_coss.c 21 Jan 2007 12:54:04 -0000 1.67 +++ squid/src/fs/coss/store_dir_coss.c 27 Feb 2007 09:01:53 -0000 1.68 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_coss.c,v 1.67 2007/01/21 12:54:04 adrian Exp $ + * $Id: store_dir_coss.c,v 1.68 2007/02/27 09:01:53 serassio 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; + } } } }