From ed483d8e570700a303e11bc03d6250cd0ae4aaed Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 22 Mar 2017 19:22:31 -0700 Subject: [PATCH] s3: smbd: Change "strict sync" paramter from "no" to "yes" for 4.7.0. Document change and modify in loadparm.c. Safer default for new installs and vendors. Signed-off-by: Jeremy Allison Reviewed-by: Christof Schmitt --- docs-xml/smbdotconf/tuning/strictsync.xml | 68 ++++++++++++++++++------------- lib/param/loadparm.c | 2 + source3/param/loadparm.c | 2 +- 3 files changed, 43 insertions(+), 29 deletions(-) rewrite docs-xml/smbdotconf/tuning/strictsync.xml (75%) diff --git a/docs-xml/smbdotconf/tuning/strictsync.xml b/docs-xml/smbdotconf/tuning/strictsync.xml dissimilarity index 75% index 5cfd38831bb..f2e378877b4 100644 --- a/docs-xml/smbdotconf/tuning/strictsync.xml +++ b/docs-xml/smbdotconf/tuning/strictsync.xml @@ -1,28 +1,40 @@ - - - Many Windows applications (including the Windows 98 explorer - shell) seem to confuse flushing buffer contents to disk with doing - a sync to disk. Under UNIX, a sync call forces the thread to be - suspended until the kernel has ensured that all outstanding data in - kernel disk buffers has been safely stored onto stable storage. - This is very slow and should only be done rarely. Setting this - parameter to no (the default) means that - smbd - 8 ignores the Windows - applications requests for a sync call. There is only a possibility - of losing data if the operating system itself that Samba is running - on crashes, so there is little danger in this default setting. In - addition, this fixes many performance problems that people have - reported with the new Windows98 explorer shell file copies. - The flush request from SMB2/3 clients is handled - asynchronously, so for these clients setting the parameter - to yes does not block the processing of other - requests in the smbd process. - - -sync always -no - + + + This parameter controls whether Samba honors a request + from an SMB client to ensure any outstanding operating system + buffer contents held in memory are safely written onto stable + storage on disk. If set to yes, which is + the default, then Windows applications can force the smbd server + to synchronize unwritten data onto the disk. If set to + no then smbd will ignore client + requests to synchronize unwritten data onto stable storage on + disk. + + In Samba 4.7.0, the default for this parameter changed from + no to yes to better + match the expectations of SMB2/3 clients and improve application + safety when running against smbd. + + The flush request from SMB2/3 clients is handled + asynchronously inside smbd, so leaving the parameter as the default + value of yes does not block the processing of + other requests to the smbd process. + + Legacy Windows applications (such as the Windows 98 explorer + shell) seemed to confuse writing buffer contents to the operating + system with synchronously writing outstanding data onto stable storage + on disk. Changing this parameter to no means that + smbd + 8 will ignore the Windows + applications request to synchronize unwritten data onto disk. Only + consider changing this if smbd is serving obsolete SMB1 Windows clients + prior to Windows XP (Windows 98 and below). There should be no need to + change this setting for normal operations. + + +sync always +yes + diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index 335c54a3abe..cedf8facb8d 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -2832,6 +2832,8 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx) lpcfg_do_global_parameter(lp_ctx, "strict locking", "Auto"); + lpcfg_do_global_parameter(lp_ctx, "strict sync", "yes"); + lpcfg_do_global_parameter(lp_ctx, "map readonly", "yes"); lpcfg_do_global_parameter(lp_ctx, "allow trusted domains", "yes"); diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index c65e613feea..57220a64282 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -207,7 +207,7 @@ static struct loadparm_service sDefault = .sync_always = false, .strict_allocate = false, .strict_rename = false, - .strict_sync = false, + .strict_sync = true, .mangling_char = '~', .copymap = NULL, .delete_readonly = false, -- 2.11.4.GIT