From: Stefan Metzmacher Date: Fri, 28 Aug 2020 12:37:59 +0000 (+0200) Subject: s3:share_mode_lock: reproduce problem with stale disconnected share mode entries X-Git-Tag: talloc-2.3.2~680 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=444f2bedf723b89bb9f493c47812bff2154c4113;p=thirdparty%2Fsamba.git s3:share_mode_lock: reproduce problem with stale disconnected share mode entries This reproduces the origin of "PANIC: assert failed in get_lease_type()" (https://bugzilla.samba.org/show_bug.cgi?id=14428). share_mode_cleanup_disconnected() removes disconnected entries from leases.tdb and brlock.tdb but not from locking.tdb. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14428 Signed-off-by: Stefan Metzmacher Reviewed-by: Volker Lendecke --- diff --git a/selftest/knownfail.d/bug-14428 b/selftest/knownfail.d/bug-14428 new file mode 100644 index 00000000000..e198400ea16 --- /dev/null +++ b/selftest/knownfail.d/bug-14428 @@ -0,0 +1 @@ +^samba3.blackbox.durable_v2_delay.bug.14428 diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c index ba0bc2b1e7b..ca8b2f47529 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -1730,6 +1730,20 @@ bool share_mode_cleanup_disconnected(struct file_id fid, data->have_share_modes = false; data->modified = true; + /* + * This is a temporary reproducer for the origin of + * https://bugzilla.samba.org/show_bug.cgi?id=14428 + * "PANIC: assert failed in get_lease_type()" + * + * This will be removed again once the bug is demonstrated + * and fixed. + */ + TALLOC_FREE(state.lck); + state.lck = get_existing_share_mode_lock(frame, fid); + if (state.lck != NULL) { + DBG_ERR("Reproduced BUG#14428\n"); + } + ret = true; done: talloc_free(frame); diff --git a/source3/script/tests/test_durable_handle_reconnect.sh b/source3/script/tests/test_durable_handle_reconnect.sh index e9af9ca8a84..66a35f08f17 100755 --- a/source3/script/tests/test_durable_handle_reconnect.sh +++ b/source3/script/tests/test_durable_handle_reconnect.sh @@ -17,12 +17,26 @@ testit "durable_v2_delay.durable_v2_reconnect_delay" $VALGRIND \ smb2.durable-v2-delay.durable_v2_reconnect_delay || failed=$(expr $failed + 1) +SMBD_LOG_FILES="$SMBD_TEST_LOG" +if [ $SMBD_DONT_LOG_STDOUT -eq 1 ]; then + _SMBD_LOG_FILE=$(dirname $SMBD_TEST_LOG)/logs/log.smbd + SMBD_LOG_FILES="$SMBD_LOG_FILES $_SMBD_LOG_FILE" +fi + +bug_count_0=$(grep 'Reproduced BUG#14428' $SMBD_LOG_FILES | wc -l) + testit "durable_v2_delay.durable_v2_reconnect_delay_msec" $VALGRIND \ $BINDIR/smbtorture //$SERVER_IP/durable \ -U$USERNAME%$PASSWORD \ smb2.durable-v2-delay.durable_v2_reconnect_delay_msec || failed=$(expr $failed + 1) +bug_count_1=$(grep 'Reproduced BUG#14428' $SMBD_LOG_FILES | wc -l) + +testit "bug.14428 bug_count_0[$bug_count_0] bug_count_1[$bug_count_1]" \ + test $bug_count_0 -eq $bug_count_1 || + failed=$(expr $failed + 1) + rm $delay_inject_conf testok $0 $failed