From: Kern Sibbald Date: Sat, 15 Aug 2009 08:59:49 +0000 (+0200) Subject: Restrict acquire to one job at a time X-Git-Tag: Release-5.0.0~332^2~24^2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3d06e95b84c6602c46093bf5253c50ddc2786457;p=bacula%2Fbacula Restrict acquire to one job at a time --- diff --git a/bacula/src/stored/acquire.c b/bacula/src/stored/acquire.c index b15c954daa..2cacabcecb 100644 --- a/bacula/src/stored/acquire.c +++ b/bacula/src/stored/acquire.c @@ -333,6 +333,7 @@ get_out: return ok; } +static pthread_mutex_t acquire_lock = PTHREAD_MUTEX_INITIALIZER; /* * Acquire device for writing. We permit multiple writers. @@ -352,6 +353,7 @@ DCR *acquire_device_for_append(DCR *dcr) init_device_wait_timers(dcr); + P(acquire_lock); /* only one job at a time */ dev->dlock(); Dmsg1(100, "acquire_append device is %s\n", dev->is_tape()?"tape": (dev->is_dvd()?"DVD":"disk")); @@ -421,6 +423,7 @@ DCR *acquire_device_for_append(DCR *dcr) get_out: dcr->clear_reserved(); dev->dunlock(); + V(acquire_lock); return ok ? dcr : NULL; }