From: Stefan Metzmacher Date: Wed, 23 Dec 2020 10:59:05 +0000 (+0100) Subject: share_mode_lock: DEBUG/ASSERT recursion deadlock detection X-Git-Tag: tevent-0.11.0~2042 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db743ab005bc7671d4fb0f5bea895c1097b707c5;p=thirdparty%2Fsamba.git share_mode_lock: DEBUG/ASSERT recursion deadlock detection This situation should never happen! The known trigger is fixed with the change to adouble_open_rsrc_fsp() Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme --- diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c index 80c04fdeda0..e8bb3e58e1f 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -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);