]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
share_mode_lock: DEBUG/ASSERT recursion deadlock detection
authorStefan Metzmacher <metze@samba.org>
Wed, 23 Dec 2020 10:59:05 +0000 (11:59 +0100)
committerRalph Boehme <slow@samba.org>
Thu, 21 Jan 2021 13:35:33 +0000 (13:35 +0000)
This situation should never happen!

The known trigger is fixed with the change to adouble_open_rsrc_fsp()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/locking/share_mode_lock.c

index 80c04fdeda07c947f48d7447a2518c14e0739118..e8bb3e58e1f074f36a109ca6c1610cda2461ad21 100644 (file)
@@ -880,8 +880,15 @@ struct share_mode_lock *get_share_mode_lock(
 
        if (static_share_mode_data != NULL) {
                if (!file_id_equal(&static_share_mode_data->id, &id)) {
-                       DEBUG(1, ("Can not lock two share modes "
-                                 "simultaneously\n"));
+                       struct file_id_buf existing;
+                       struct file_id_buf requested;
+
+                       DBG_ERR("Can not lock two share modes "
+                               "simultaneously: existing %s requested %s\n",
+                               file_id_str_buf(static_share_mode_data->id, &existing),
+                               file_id_str_buf(id, &requested));
+
+                       smb_panic(__location__);
                        goto fail;
                }
                goto done;
@@ -904,6 +911,7 @@ struct share_mode_lock *get_share_mode_lock(
        cmp = tdb_data_cmp(share_mode_lock_key, key);
        if (cmp != 0) {
                DBG_WARNING("Can not lock two share modes simultaneously\n");
+               smb_panic(__location__);
                goto fail;
        }
 
@@ -929,6 +937,15 @@ done:
 
        talloc_set_destructor(lck, share_mode_lock_destructor);
 
+       if (CHECK_DEBUGLVL(DBGLVL_DEBUG)) {
+               struct file_id_buf returned;
+
+               DBG_DEBUG("Returning %s (data_refcount=%zu key_refcount=%zu)\n",
+                         file_id_str_buf(id, &returned),
+                         static_share_mode_data_refcount,
+                         share_mode_lock_key_refcount);
+       }
+
        return lck;
 fail:
        TALLOC_FREE(lck);