]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/lock.h
Fix race in steal_device_lock shown in truncate-concurrent-test
[bacula/bacula] / bacula / src / stored / lock.h
index 16b47bb924dd3e87450338a1b9b35bb2419efb57..5742f3db7373ae7c253f5cf608fd3089798aa591 100644 (file)
@@ -1,17 +1,20 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2017 Kern Sibbald
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  * Definitions for locking and blocking functions in the SD
@@ -85,8 +88,8 @@ void    _unlock_volumes();
 
 #define block_device(d, s)          _block_device(__FILE__, __LINE__, (d), s)
 #define unblock_device(d)           _unblock_device(__FILE__, __LINE__, (d))
-#define steal_device_lock(d, p, s)  _steal_device_lock(__FILE__, __LINE__, (d), (p), s)
-#define give_back_device_lock(d, p) _give_back_device_lock(__FILE__, __LINE__, (d), (p))
+#define obtain_device_block(d, p, s)  _obtain_device_block(__FILE__, __LINE__, (d), (p), s)
+#define give_back_device_block(d, p) _give_back_device_block(__FILE__, __LINE__, (d), (p))
 
 /* m_blocked states (mutually exclusive) */
 enum {
@@ -105,6 +108,7 @@ typedef struct s_steal_lock {
    pthread_t  no_wait_id;             /* id of no wait thread */
    int        dev_blocked;            /* state */
    int        dev_prev_blocked;       /* previous blocked state */
+   uint32_t   blocked_by;             /* previous blocker */
 } bsteal_lock_t;
 
 /*