From: <ke...@us...> - 2008-03-27 09:57:48
|
Revision: 6695 http://bacula.svn.sourceforge.net/bacula/?rev=6695&view=rev Author: kerns Date: 2008-03-27 02:57:54 -0700 (Thu, 27 Mar 2008) Log Message: ----------- kes Rework certain SD locking based on gdb tracebacks of deadlocks sent by Eric. This code now uses only the volume_lock() rather than the reservations lock when at EOM and acquiring a new volume. kes Ensure only one exit point in several subroutines. Modified Paths: -------------- branches/Branch-2.2/bacula/src/stored/askdir.c branches/Branch-2.2/bacula/src/stored/reserve.c branches/Branch-2.2/bacula/src/version.h branches/Branch-2.2/bacula/technotes-2.1 Modified: branches/Branch-2.2/bacula/src/stored/askdir.c =================================================================== --- branches/Branch-2.2/bacula/src/stored/askdir.c 2008-03-26 20:51:14 UTC (rev 6694) +++ branches/Branch-2.2/bacula/src/stored/askdir.c 2008-03-27 09:57:54 UTC (rev 6695) @@ -252,6 +252,7 @@ { JCR *jcr = dcr->jcr; BSOCK *dir = jcr->dir_bsock; + bool rtn; Dmsg2(200, "dir_find_next_appendable_volume: reserved=%d Vol=%s\n", dcr->reserved_device, dcr->VolumeName); @@ -261,7 +262,7 @@ * the most available could already be mounted on another * drive, so we continue looking for a not in use Volume. */ - lock_reservations(); + lock_volumes(); P(vol_info_mutex); dcr->volume_in_use = false; for (int vol_index=1; vol_index < 40; vol_index++) { @@ -271,8 +272,7 @@ unbash_spaces(dcr->media_type); unbash_spaces(dcr->pool_name); Dmsg1(100, ">dird %s", dir->msg); - bool ok = do_get_volume_info(dcr); - if (ok) { + if (do_get_volume_info(dcr)) { if (!is_volume_in_use(dcr)) { Dmsg0(400, "dir_find_next_appendable_volume return true\n"); if (reserve_volume(dcr, dcr->VolumeName) == 0) { @@ -280,9 +280,8 @@ dcr->dev->print_name()); continue; } - V(vol_info_mutex); - unlock_reservations(); - return true; + rtn = true; + goto get_out; } else { Dmsg1(100, "Volume %s is in use.\n", dcr->VolumeName); dcr->volume_in_use = true; @@ -293,11 +292,13 @@ dcr->dev->print_name()); break; } + rtn = false; + dcr->VolumeName[0] = 0; - dcr->VolumeName[0] = 0; +get_out: V(vol_info_mutex); - unlock_reservations(); - return false; + unlock_volumes(); + return rtn; } Modified: branches/Branch-2.2/bacula/src/stored/reserve.c =================================================================== --- branches/Branch-2.2/bacula/src/stored/reserve.c 2008-03-26 20:51:14 UTC (rev 6694) +++ branches/Branch-2.2/bacula/src/stored/reserve.c 2008-03-27 09:57:54 UTC (rev 6695) @@ -410,7 +410,6 @@ */ void switch_device(DCR *dcr, DEVICE *dev) { - // lock_reservations(); DCR save_dcr; dev->dlock(); @@ -589,28 +588,36 @@ bool is_volume_in_use(DCR *dcr) { - VOLRES *vol = find_volume(dcr); + bool rtn = false; + VOLRES *vol; + + lock_volumes(); + vol = find_volume(dcr); if (!vol) { Dmsg2(dbglvl, "jid=%u Vol=%s not in use.\n", jid(), dcr->VolumeName); - return false; /* vol not in list */ + goto get_out; /* vol not in list */ } ASSERT(vol->dev != NULL); if (dcr->dev == vol->dev) { /* same device OK */ Dmsg2(dbglvl, "jid=%u Vol=%s on same dev.\n", jid(), dcr->VolumeName); - return false; + goto get_out; } else { Dmsg4(dbglvl, "jid=%u Vol=%s on %s we have %s\n", jid(), dcr->VolumeName, vol->dev->print_name(), dcr->dev->print_name()); } if (!vol->dev->is_busy()) { Dmsg3(dbglvl, "jid=%u Vol=%s dev=%s not busy.\n", jid(), dcr->VolumeName, vol->dev->print_name()); - return false; + goto get_out; } else { Dmsg3(dbglvl, "jid=%u Vol=%s dev=%s busy.\n", jid(), dcr->VolumeName, vol->dev->print_name()); } Dmsg3(dbglvl, "jid=%u Vol=%s in use by %s.\n", jid(), dcr->VolumeName, vol->dev->print_name()); - return true; + rtn = true; + +get_out: + unlock_volumes(); + return rtn; } Modified: branches/Branch-2.2/bacula/src/version.h =================================================================== --- branches/Branch-2.2/bacula/src/version.h 2008-03-26 20:51:14 UTC (rev 6694) +++ branches/Branch-2.2/bacula/src/version.h 2008-03-27 09:57:54 UTC (rev 6695) @@ -3,9 +3,9 @@ */ #undef VERSION -#define VERSION "2.2.9-b2" -#define BDATE "24 March 2008" -#define LSMDATE "24Mar08" +#define VERSION "2.2.9-b3" +#define BDATE "27 March 2008" +#define LSMDATE "27Mar08" #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n" #define BYEAR "2008" /* year for copyright messages in progs */ Modified: branches/Branch-2.2/bacula/technotes-2.1 =================================================================== --- branches/Branch-2.2/bacula/technotes-2.1 2008-03-26 20:51:14 UTC (rev 6694) +++ branches/Branch-2.2/bacula/technotes-2.1 2008-03-27 09:57:54 UTC (rev 6695) @@ -1,6 +1,14 @@ Technical notes on version 2.2 General: +Beta release Version 2.2.9-b3 +27Mar08 +kes Rework certain SD locking based on gdb tracebacks of deadlocks + sent by Eric. This code now uses only the volume_lock() rather + than the reservations lock when at EOM and acquiring a new + volume. +kes Ensure only one exit point in several subroutines. + 22Mar08 kes Fix to JobMedia fix. kes Fix bug pointed out by Peter Much that causes the StorageId to This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |