]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd: only run validate_oplock_types() with smbd:validate_oplock_types = yes
authorStefan Metzmacher <metze@samba.org>
Fri, 19 Aug 2022 15:17:41 +0000 (15:17 +0000)
committerJeremy Allison <jra@samba.org>
Fri, 19 Aug 2022 18:41:34 +0000 (18:41 +0000)
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>
selftest/target/Samba3.pm
selftest/target/Samba4.pm
source3/smbd/open.c

index 88898807428ccb5d40c636b8be2a33ab32d05416..d413f14bacd4c4fd090ebcba58c5aca40028e8bf 100755 (executable)
@@ -2772,6 +2772,7 @@ sub provision($$)
        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
index 1762ae4ae79b44ee7f43eab72f821f8365ae2891..e5ae57cb7fcc678c19ced40e9a78699e0045f393 100755 (executable)
@@ -778,6 +778,7 @@ sub provision_raw_step1($$)
        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
index 1d6c3cfbfbc084a705a42be683819f1dc4868583..e189d418262e3e49eaa476ababbb9dd7deae18be 100644 (file)
@@ -2210,8 +2210,21 @@ static bool validate_oplock_types_fn(
 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");