]> git.sur5r.net Git - bacula/bacula/commitdiff
Restrict acquire to one job at a time
authorKern Sibbald <kern@sibbald.com>
Sat, 15 Aug 2009 08:59:49 +0000 (10:59 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 15 Aug 2009 19:37:37 +0000 (21:37 +0200)
bacula/src/stored/acquire.c

index b15c954daaabac21f4fb7a17e4271cd13413bb86..2cacabcecb4543c4eeb1982b2206b85df0a12b2f 100644 (file)
@@ -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;
 }