From: Eric Bollengier Date: Wed, 7 Apr 2010 09:18:53 +0000 (+0200) Subject: Add lock position info to volume manager X-Git-Tag: Release-5.0.2~138 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f7ab4d85a088e4847abeaf0350d23d84fddcb880;p=bacula%2Fbacula Add lock position info to volume manager --- diff --git a/bacula/src/stored/protos.h b/bacula/src/stored/protos.h index 8aa28538e5..26ffd476de 100644 --- a/bacula/src/stored/protos.h +++ b/bacula/src/stored/protos.h @@ -214,9 +214,9 @@ bool read_records(DCR *dcr, /* From reserve.c */ void init_reservations_lock(); void term_reservations_lock(); -void _lock_reservations(); +void _lock_reservations(const char *file="**Unknown**", int line=0); void _unlock_reservations(); -void _lock_volumes(); +void _lock_volumes(const char *file="**Unknown**", int line=0); void _unlock_volumes(); void unreserve_device(DCR *dcr); void send_drive_reserve_messages(JCR *jcr, void sendit(const char *msg, int len, void *sarg), void *arg); @@ -232,7 +232,7 @@ extern int reservations_lock_count; do { Dmsg3(sd_dbglvl, "lock_reservations at %s:%d precnt=%d\n", \ __FILE__, __LINE__, \ reservations_lock_count); \ - _lock_reservations(); \ + _lock_reservations(__FILE__, __LINE__); \ Dmsg0(sd_dbglvl, "lock_reservations: got lock\n"); \ } while (0) #define unlock_reservations() \ @@ -245,7 +245,7 @@ extern int reservations_lock_count; do { Dmsg3(sd_dbglvl, "lock_volumes at %s:%d precnt=%d\n", \ __FILE__, __LINE__, \ vol_list_lock_count); \ - _lock_volumes(); \ + _lock_volumes(__FILE__, __LINE__); \ Dmsg0(sd_dbglvl, "lock_volumes: got lock\n"); \ } while (0) @@ -257,9 +257,9 @@ extern int reservations_lock_count; #else -#define lock_reservations() _lock_reservations() +#define lock_reservations() _lock_reservations(__FILE__, __LINE__) #define unlock_reservations() _unlock_reservations() -#define lock_volumes() _lock_volumes() +#define lock_volumes() _lock_volumes(__FILE__, __LINE__) #define unlock_volumes() _unlock_volumes() #endif diff --git a/bacula/src/stored/reserve.c b/bacula/src/stored/reserve.c index 8119f84af7..40e0f2f275 100644 --- a/bacula/src/stored/reserve.c +++ b/bacula/src/stored/reserve.c @@ -101,11 +101,11 @@ void term_reservations_lock() int reservations_lock_count = 0; /* This applies to a drive and to Volumes */ -void _lock_reservations() +void _lock_reservations(const char *file, int line) { int errstat; reservations_lock_count++; - if ((errstat=rwl_writelock(&reservation_lock)) != 0) { + if ((errstat=rwl_writelock_p(&reservation_lock, file, line)) != 0) { berrno be; Emsg2(M_ABORT, 0, "rwl_writelock failure. stat=%d: ERR=%s\n", errstat, be.bstrerror(errstat)); diff --git a/bacula/src/stored/vol_mgr.c b/bacula/src/stored/vol_mgr.c index 6f0de21c41..6c6231b73e 100644 --- a/bacula/src/stored/vol_mgr.c +++ b/bacula/src/stored/vol_mgr.c @@ -105,11 +105,11 @@ void term_vol_list_lock() /* * This allows a given thread to recursively call to lock_volumes() */ -void _lock_volumes() +void _lock_volumes(const char *file, int line) { int errstat; vol_list_lock_count++; - if ((errstat=rwl_writelock(&vol_list_lock)) != 0) { + if ((errstat=rwl_writelock_p(&vol_list_lock, file, line)) != 0) { berrno be; Emsg2(M_ABORT, 0, "rwl_writelock failure. stat=%d: ERR=%s\n", errstat, be.bstrerror(errstat)); @@ -127,14 +127,14 @@ void _unlock_volumes() } } -void lock_read_volumes() +void lock_read_volumes(const char *file="**Unknown", int line=0) { - P(read_vol_lock); + bthread_mutex_lock_p(&read_vol_lock, file, line); } void unlock_read_volumes() { - V(read_vol_lock); + bthread_mutex_unlock(&read_vol_lock); } /*