This is really expensive as share_mode_forall_entries() is currently
doing a talloc_memdup() of the whole record...
This is mainly used to avoid regressions, so only
use smbd:validate_oplock_types = yes in make test,
but skip it for production.
This improves the following test:
time smbtorture //127.0.0.1/m -Uroot%test \
smb2.create.bench-path-contention-shared \
--option='torture:bench_path=file.dat' \
--option="torture:timelimit=60" \
--option="torture:nprocs=256" \
--option="torture:qdepth=1"
From:
open[num/s=8852,avslat=0.014999,minlat=0.000042,maxlat=0.054600]
close[num/s=8850,avslat=0.014136,minlat=0.000025,maxlat=0.054537]
to:
open[num/s=11377,avslat=0.012075,minlat=0.000041,maxlat=0.054107]
close[num/s=11375,avslat=0.010594,minlat=0.000023,maxlat=0.053620]
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15125
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
panic action = cd $self->{srcdir} && $self->{srcdir}/selftest/gdb_backtrace %d %\$(MAKE_TEST_BINARY)
smbd:suicide mode = yes
smbd:FSCTL_SMBTORTURE = yes
+ smbd:validate_oplock_types = yes
client min protocol = SMB2_02
server min protocol = SMB2_02
panic action = $RealBin/gdb_backtrace \%d
smbd:suicide mode = yes
smbd:FSCTL_SMBTORTURE = yes
+ smbd:validate_oplock_types = yes
wins support = yes
server role = $ctx->{server_role}
server services = +echo $services
static bool validate_oplock_types(struct share_mode_lock *lck)
{
struct validate_oplock_types_state state = { .valid = true };
+ static bool skip_validation;
+ bool validate;
bool ok;
+ if (skip_validation) {
+ return true;
+ }
+
+ validate = lp_parm_bool(-1, "smbd", "validate_oplock_types", false);
+ if (!validate) {
+ DBG_DEBUG("smbd:validate_oplock_types not set to yes\n");
+ skip_validation = true;
+ return true;
+ }
+
ok = share_mode_forall_entries(lck, validate_oplock_types_fn, &state);
if (!ok) {
DBG_DEBUG("share_mode_forall_entries failed\n");