1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00
samba-mirror/source3/smbd
Ralph Boehme 0736fdcdb0 smbd: use async dos_mode_at_send in smbd_smb2_query_directory_send()
Finally: use the new dos_mode_at_send() in the directory enumeration
loop. This means that fetching the DOS attributes for directory entries
is done asynchronously with regard to the enumeration loop.

As the DOS attribute is typically read from an extended attribute in the
filesytem, this avoids sequentially blocking on IO. If the IO subsystem
is slow servicing these request, enabling async processing can result in
performance improvements.

A parametric option

  smbd:async dosmode = true | false (default: false)

can be used to enable the new async processing.

Simulating slow IO with usleep(5000) in the synchronous and asynchronous
versions of SMB_VFS_GET_DOS_ATTRIBUTES(), the results of enumerating a
directory with 10,000 files are:

    smbd:async dosmode = no:

        $ time bin/smbclient -U slow%x //localhost/test -c "ls dir\*" > /dev/null
        real    0m59.597s
        user    0m0.024s
        sys     0m0.012s

    smbd:async dosmode = yes:

        $ time bin/smbclient -U slow%x //localhost/test -c "ls dir\*" > /dev/null
        real    0m0.698s
        user    0m0.038s
        sys     0m0.025s

Performance gains in real world workloads depends on whether the actual
IO requests can be merged and parallelized by the kernel. Without such
wins at the IO layer, the async processing may even be slower then the
sync processing due to the additional overhead.

The following parameters can be used to adapt async processing behaviour
for specific workloads and systems:

        aio max threads = X (default: 100)
        smbd:max async dosmode = Y (default: "aio max threads" * 2)

By default we have at most twice the number of async requests in flight
as threads provided by the underlying threadpool. This ensures a worker
thread that finishes a job can directly pick up a new one without going
to sleep.

It may be advisable to reduce the number of threads to avoid scheduling
overhead while also increasing "smbd:max async dosmode".

Note that we disable async processing for certain VFS modules in the VFS
connect function to avoid the overhead of triggering the sync fallback
in dos_mode_at_send(). This is done for VFS modules that implement the
sync SMB_VFS_GET_DOS_ATTRIBUTES(), but not the async version (gpfs), and
for VFS modules that don't share a real filesystem where fchdir() can be
used (ceph, gluster). It is disabled for catia, because we realized that
the catia name translation macros used on
fsps (CATIA_FETCH_FSP_[PRE|POST]_NEXT) have a bug (#13547).

We use threadpool = smb_vfs_ev_glue_tp_chdir_safe() and then
pthreadpool_tevent_max_threads(threadpool) to get the number of maximum
worker threads which matches the pool used by the low level
SMB_VFS_GETXATTRAT_[SEND|RECV] implementation in vfs_default.

This is a terrible abstraction leak that should be removed in the future
by maybe making it possible to ask a VFS function which threadpool it
uses, internally suporting chaining so VFS function FOO that internally
uses BAR can forward the question to BAR.

On a hyphotetical system that had a getxattrat(dirfd, path, ...)
syscall and at the same time doesn't support per-thread current working
directories (eg FreeBSD doesn't have the latter) but has support for
per-thread-credentials, pthreadpool_tevent_max_threads() on the
tp_chdir_safe threadpool returns 1.

So when hooking the hyphotetical getxattrat() into the async
SMB_VFS_GETXATTRAT_[SEND|RECV] implementation in an VFS module, the
implementation could use the tp_path_safe threadpool, but the SMB2
layer would use the wrong threadpool in the call to
pthreadpool_tevent_max_threads(), resulting in no parallelism.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2018-07-27 13:07:15 +02:00
..
notifyd notifyd: Broadcast to all connected nodes 2017-09-29 08:38:10 +02:00
aio.c smbd: add an effective {smb,smbd_smb2}_request->ev_ctx that holds the event context used for the request processing 2018-06-18 08:59:21 +02:00
avahi_register.c s3:avahi: Fix size types 2018-03-20 23:16:15 +01:00
blocking.c smbd: remove unused change_to_root_user() from brl_timeout_fn() 2018-07-12 14:25:18 +02:00
close.c smbd: deal with fsp->aio_requests in close_directory() 2018-07-27 13:07:15 +02:00
conn_idle.c
conn_msg.c
conn.c s3: vfs: add user_vfs_evg to connection_struct 2018-07-25 17:49:06 +02:00
connection.c
dfree.c smbd: Move dfree_info struct 2018-05-25 22:52:12 +02:00
dir.c smbd: pass get_dosmode to mode_fn in smbd_dirptr_get_entry() 2018-07-27 13:07:15 +02:00
dmapi.c Convert all uses of uint8/16/32 to _t in source3/smbd. 2015-05-06 04:14:14 +02:00
dnsregister.c
dosmode.c smbd: add dos_mode_at_send/recv() 2018-07-27 13:07:14 +02:00
durable.c s3: smbd/durable: remove dev and inode check from vfs_default_durable_reconnect_check_stat() 2018-07-07 13:41:09 +02:00
error.c s3:smbd: Fix converity warning with _smb_setlen_large() 2018-05-16 21:30:23 +02:00
fake_file.c Convert three include files from uint32/16/8 to _t types as well as the source that includes them. 2015-05-01 19:15:10 +02:00
file_access.c s3: Filenames: Add uint32_t flags parameter to synthetic_smb_fname(). 2016-03-24 22:57:16 +01:00
fileio.c smbd: explain that/why we use the raw tevent_context for update_write_time_handler() 2018-06-18 08:59:19 +02:00
filename.c Fix spelling s/succesfully/successfully/ 2018-05-12 02:09:27 +02:00
files.c s3: smbd: When deleting an fsp pointer ensure we don't keep any references to it around. 2017-06-22 00:12:49 +02:00
globals.c printing: use housekeeping period that matches cache time 2016-04-19 09:37:14 +02:00
globals.h smbd: let smbd_dirptr_lanman2_entry return smb_fname 2018-07-27 13:07:15 +02:00
ipc.c smbd: add an effective {smb,smbd_smb2}_request->ev_ctx that holds the event context used for the request processing 2018-06-18 08:59:21 +02:00
lanman.c printing: remove unused arguments from delete_and_reload_printers() 2018-06-14 20:52:20 +02:00
mangle_hash2.c
mangle_hash.c smbd: Convert valid.dat to C code 2015-03-24 00:00:20 +01:00
mangle.c s3/smbd: convert "mangled names" option to an enum 2017-01-09 19:31:20 +01:00
message.c Update smbrun to allow for settings environment variables. 2016-10-13 04:26:26 +02:00
msdfs.c s3: vfs: add user_vfs_evg to connection_struct 2018-07-25 17:49:06 +02:00
negprot.c s3:smbd: Fix size types in reply_negprot() 2018-04-03 20:20:10 +02:00
notify_fam.c smbd: Allow passing notify filter from inotify and fam 2016-07-18 15:14:11 +02:00
notify_inotify.c s3: smbd: inotify_map_mask_to_filter incorrectly indexes an array. 2017-04-28 03:18:23 +02:00
notify_msg.c smbd: remove unused tevent_context argument from notify_init 2018-06-18 08:59:18 +02:00
notify.c smbd: remove unused tevent_context argument from notify_init 2018-06-18 08:59:18 +02:00
ntquotas.c s3: VFS: Change SMB_VFS_GET_QUOTA to use const struct smb_filename * instead of const char *. 2017-06-18 02:49:25 +02:00
nttrans.c s3:smbd: Add FALL_THROUGH statements in nttrans.c 2018-03-01 04:37:42 +01:00
open.c smbd: add an effective {smb,smbd_smb2}_request->ev_ctx that holds the event context used for the request processing 2018-06-18 08:59:21 +02:00
oplock_linux.c smbd: explain that/why we use the raw tevent_context for linux_oplock_signal_handler() 2018-06-18 08:59:19 +02:00
oplock.c s3: smbd: SGI IRIX is officially dead. Remove the kernel oplock code for IRIX. 2018-07-25 03:24:39 +02:00
password.c wscript: drop checks for setnetgrent/endnetgrent/getnetgrent 2018-02-21 14:19:17 +01:00
perfcount.c lib:util: Make probing of modules more secure 2017-06-06 18:36:07 +02:00
pipes.c smbd: add an effective {smb,smbd_smb2}_request->ev_ctx that holds the event context used for the request processing 2018-06-18 08:59:21 +02:00
posix_acls.c smbd/posix_acls: reuse secutiry token from session info if exist 2018-07-12 04:31:59 +02:00
process.c smbd: introduce sconn->sync_thread_pool 2018-07-25 17:49:06 +02:00
proto.h smbd: add dos_mode_at_send/recv() 2018-07-27 13:07:14 +02:00
pysmbd.c pysmbd: add session_info arg to py_smbd_set_nt_acl 2018-07-12 04:31:59 +02:00
quotas.c s3: VFS: Change SMB_VFS_GET_QUOTA to use const struct smb_filename * instead of const char *. 2017-06-18 02:49:25 +02:00
reply.c smbd: add an effective {smb,smbd_smb2}_request->ev_ctx that holds the event context used for the request processing 2018-06-18 08:59:21 +02:00
scavenger.c lib: Remove unused serverid.tdb 2017-12-05 04:58:26 +01:00
scavenger.h
seal.c auth: Always supply both the remote and local address to the auth subsystem 2017-03-29 02:37:26 +02:00
sec_ctx.c s3:smbd: Fix incorrect use of sys_getgroups() 2017-04-18 15:43:02 +02:00
server_exit.c smbd: don't client->connections without checking client != NULL first in exit_server_common() 2018-07-26 01:29:38 +02:00
server_reload.c smbd: remove useless set_current_service(NULL,0,True) from reload_services() 2018-06-18 08:59:17 +02:00
server.c smbd: Call smbXsrv_client_global_init in the parent smbd 2018-05-25 16:00:08 +02:00
service.c Revert "s3/service: convert lp_force_group() to const" 2018-07-10 00:12:19 +02:00
session.c rpc_server: Fix NetSessEnum with stale sessions 2018-04-25 22:49:07 +02:00
sesssetup.c smbd: Fix "reset on zero vc" 2018-05-13 23:43:56 +02:00
share_access.c smbd: remove redundant comment (with typo) from token_contains_name() 2016-08-04 18:26:07 +02:00
signing.c
smb2_break.c smbd: add an effective {smb,smbd_smb2}_request->ev_ctx that holds the event context used for the request processing 2018-06-18 08:59:21 +02:00
smb2_close.c smbd: add an effective {smb,smbd_smb2}_request->ev_ctx that holds the event context used for the request processing 2018-06-18 08:59:21 +02:00
smb2_create.c s3: smbd: fix path check in smbd_smb2_create_durable_lease_check() 2018-07-18 00:04:10 +02:00
smb2_flush.c smbd: add an effective {smb,smbd_smb2}_request->ev_ctx that holds the event context used for the request processing 2018-06-18 08:59:21 +02:00
smb2_getinfo.c smbd: add an effective {smb,smbd_smb2}_request->ev_ctx that holds the event context used for the request processing 2018-06-18 08:59:21 +02:00
smb2_glue.c smbd: add an effective {smb,smbd_smb2}_request->ev_ctx that holds the event context used for the request processing 2018-06-18 08:59:21 +02:00
smb2_ioctl_dfs.c s3: debug: smb2: Create a new DBGC_SMB2 debug class and mark all smbd/smb2_*.c files with it. 2018-03-22 02:15:13 +01:00
smb2_ioctl_filesys.c s3: debug: smb2: Create a new DBGC_SMB2 debug class and mark all smbd/smb2_*.c files with it. 2018-03-22 02:15:13 +01:00
smb2_ioctl_named_pipe.c smbd: add an effective {smb,smbd_smb2}_request->ev_ctx that holds the event context used for the request processing 2018-06-18 08:59:21 +02:00
smb2_ioctl_network_fs.c s3: debug: smb2: Create a new DBGC_SMB2 debug class and mark all smbd/smb2_*.c files with it. 2018-03-22 02:15:13 +01:00
smb2_ioctl_private.h
smb2_ioctl.c smbd: add an effective {smb,smbd_smb2}_request->ev_ctx that holds the event context used for the request processing 2018-06-18 08:59:21 +02:00
smb2_keepalive.c s3: debug: smb2: Create a new DBGC_SMB2 debug class and mark all smbd/smb2_*.c files with it. 2018-03-22 02:15:13 +01:00
smb2_lock.c smbd: add an effective {smb,smbd_smb2}_request->ev_ctx that holds the event context used for the request processing 2018-06-18 08:59:21 +02:00
smb2_negprot.c s3: debug: smb2: Create a new DBGC_SMB2 debug class and mark all smbd/smb2_*.c files with it. 2018-03-22 02:15:13 +01:00
smb2_notify.c smbd: add an effective {smb,smbd_smb2}_request->ev_ctx that holds the event context used for the request processing 2018-06-18 08:59:21 +02:00
smb2_query_directory.c smbd: use async dos_mode_at_send in smbd_smb2_query_directory_send() 2018-07-27 13:07:15 +02:00
smb2_read.c smbd: add an effective {smb,smbd_smb2}_request->ev_ctx that holds the event context used for the request processing 2018-06-18 08:59:21 +02:00
smb2_server.c smbd: add missing DO_PROFILE_INC(disconnect) to smbd_server_connection_terminate_ex() 2018-07-25 17:49:06 +02:00
smb2_sesssetup.c smbd: add an effective {smb,smbd_smb2}_request->ev_ctx that holds the event context used for the request processing 2018-06-18 08:59:21 +02:00
smb2_setinfo.c smbd: avoid explicit change_to_user() in defer_rename_done() already done by impersonation 2018-07-12 14:25:18 +02:00
smb2_tcon.c smbd: add an effective {smb,smbd_smb2}_request->ev_ctx that holds the event context used for the request processing 2018-06-18 08:59:21 +02:00
smb2_write.c smbd: add an effective {smb,smbd_smb2}_request->ev_ctx that holds the event context used for the request processing 2018-06-18 08:59:21 +02:00
smbd_cleanupd.c s3:cleanupd: sends MSG_SMB_UNLOCK twice to interested peers 2018-05-04 03:02:27 +02:00
smbd_cleanupd.h smbd: Implement a cleanup daemon 2015-11-16 14:51:33 +01:00
smbd.h s3: smbd: Add UCF_GMT_PATHNAME, which represents FLAGS2_REPARSE_PATH. 2017-05-22 18:41:16 +02:00
smbXsrv_client.c smbd: replace xconn->msg_ctx with xconn->client->msg_ctx 2018-06-18 08:59:18 +02:00
smbXsrv_open.c smbd: replace xconn->msg_ctx with xconn->client->msg_ctx 2018-06-18 08:59:18 +02:00
smbXsrv_session.c smbd: only pass struct smbXsrv_client to smbXsrv_session_logoff_all() 2018-07-25 17:49:06 +02:00
smbXsrv_tcon.c smbd: only pass struct smbXsrv_client to smb1srv_tcon_disconnect_all() 2018-07-25 17:49:06 +02:00
smbXsrv_version.c
srvstr.c s3: smbd: Chain code can return uninitialized memory when talloc buffer is grown. 2017-11-21 19:42:22 +01:00
statcache.c s3: smbd: fix a check in stat_cache_add() 2018-07-07 13:41:09 +02:00
statvfs.c s3/statvfs: expose FILE_SUPPORTS_SPARSE_FILES capability 2015-03-09 21:27:07 +01:00
trans2.c smbd: let smbd_dirptr_lanman2_entry return smb_fname 2018-07-27 13:07:15 +02:00
uid.c s3: vfs: add user_vfs_evg to connection_struct 2018-07-25 17:49:06 +02:00
utmp.c
vfs.c s3: vfs: add SMB_VFS_GET_DOS_ATTRIBUTES_SEND/RECV 2018-07-27 13:07:14 +02:00