/* 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);
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() \
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)
#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
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));
/*
* 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));
}
}
-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);
}
/*