[SCM] Samba Shared Repository - branch master updated

Ralph Böhme slow at samba.org
Fri Jul 27 14:05:02 UTC 2018


The branch, master has been updated
       via  409d462 selftest: run smbtorture3 SMB2-BASIC tests against additional shares
       via  cbb7eb1 selftest: set "smbd:async dosmode = no" in the vfs_aio_pthread share
       via  0b32efc s4: torture: test closing dir handle with in-flight find
       via  0736fdc smbd: use async dos_mode_at_send in smbd_smb2_query_directory_send()
       via  8884036 smbd: let smbd_dirptr_lanman2_entry return smb_fname
       via  00a26ac smbd: deal with fsp->aio_requests in close_directory()
       via  0e1d11e smbd: fix a long line in smb2_query_directory_next_entry()
       via  abef6ca smbd: factor out smb2_query_directory_next_entry() from smbd_smb2_query_directory_send()
       via  bcfc830 smbd: rework error exit in smbd_dirptr_lanman2_entry()
       via  8954085 smbd: pass get_dosmode to mode_fn in smbd_dirptr_get_entry()
       via  2a2294b smbd: pass get_dosmode to smbd_dirptr_get_entry()
       via  8de5018 smbd: add "get_dosmode" argument to smbd_dirptr_lanman2_entry()
       via  0fbeac0 smbd: add dos_mode_at_send/recv()
       via  0feef16 smbd: factor out dosmode post processing
       via  1265b51 vfs_default: implement SMB_VFS_GET_DOS_ATTRIBUTES_SEND/RECV
       via  0d1fb6a smbd: split out public parse_dos_attribute_blob() from get_ea_dos_attribute()
       via  47d7743 s3: vfs: add SMB_VFS_GET_DOS_ATTRIBUTES_SEND/RECV
       via  8a6013f vfs_xattr_tdb: implement SMB_VFS_GETXATTRAT_SEND/RECV
       via  c1c8a1f vfs_default: implement SMB_VFS_GETXATTRAT_SEND/RECV
       via  7e1f9c9 s3: vfs: add SMB_VFS_GETXATTRAT_SEND/RECV
       via  ff863f2 pthreadpool: we need to use pthreadpool_tevent_per_thread_cwd() on the callers pool
       via  591d72f ldb_mdb: #ifdef EBADE as it is not portable
      from  e7ef0c9 ctdb-common: Drop unused function mkdir_p_or_die()

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 409d462f4976334189c751287a9fadc314a3a20e
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Jul 26 18:13:44 2018 +0200

    selftest: run smbtorture3 SMB2-BASIC tests against additional shares
    
    This runs the smbtorture3 SMB2-BASIC and smb2.compound_find tests against shares
    with "smbd:async dosmode" enabled.
    
    On the vfs_aio_pthread_async_dosmode_force_sync* shares we
    force a sync threadpool which ensures we test behaviour on systems that
    don't support unshare(CLONE_FS) and also don't support
    per-thread-credentials. This simulates the code path of non linux
    systems. And makes sure that we don't regress there.
    
    We also test with xattr_tdb and without.
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Fri Jul 27 16:04:02 CEST 2018 on sn-devel-144

commit cbb7eb1fa27da053e0fe4ffd84df39754ecbdfd4
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Jul 26 18:11:22 2018 +0200

    selftest: set "smbd:async dosmode = no" in the vfs_aio_pthread share
    
    This just explicitly sets the current default, to ensure the tests that
    use this share always use the same "smbd:async dosmode" setting even if
    the default changes in the future.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 0b32efcd9976d2352a71b314a7445c2e6e13578f
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 22 09:22:08 2018 +0100

    s4: torture: test closing dir handle with in-flight find
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 0736fdcdb0b9f072a482074ff69bb0054e16ffb2
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Jul 25 19:14:25 2018 +0200

    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 at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 8884036ba297f504eb2e427db8247719ffb7a713
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 15 19:03:59 2018 +0100

    smbd: let smbd_dirptr_lanman2_entry return smb_fname
    
    Note that smb_fname is relative to fsp, not conn!
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 00a26ac9856d4ec483736ae7c4bf17d08feed5f8
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Mar 21 20:41:44 2018 +0100

    smbd: deal with fsp->aio_requests in close_directory()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 0e1d11eebd72bc28b733fb76107a43facb76c492
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Jun 21 12:44:42 2018 +0200

    smbd: fix a long line in smb2_query_directory_next_entry()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit abef6ca70610fbc2f0a527ff2084fe8eda43031b
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Jul 3 11:25:57 2018 +0200

    smbd: factor out smb2_query_directory_next_entry() from smbd_smb2_query_directory_send()
    
    This paves the way for adding async functions into the enumeration loop.
    
    Best viewed with: git show -w
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit bcfc830c284e4eaa76e1a562bf60d8ecdf8d11ab
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 15 18:57:50 2018 +0100

    smbd: rework error exit in smbd_dirptr_lanman2_entry()
    
    The next commit will add code that must be run if status is NT_STATUS_OK
    or STATUS_MORE_ENTRIES.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 8954085ad713546ea84237bbe355973226fc3cb8
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 15 16:48:38 2018 +0100

    smbd: pass get_dosmode to mode_fn in smbd_dirptr_get_entry()
    
    This finally uses "get_dosmode" as passed in from the SMB2 layer, but
    all callers still pass true, so no change in behaviour.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 2a2294bbdfff754403f9381388cbb71cde3a9694
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 15 16:08:11 2018 +0100

    smbd: pass get_dosmode to smbd_dirptr_get_entry()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 8de5018c9f54af5694d91f6884c1d71d09a258c3
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 15 15:50:41 2018 +0100

    smbd: add "get_dosmode" argument to smbd_dirptr_lanman2_entry()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 0fbeac035676b164c9b582ec181f51f525b39e3a
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 15 15:21:53 2018 +0100

    smbd: add dos_mode_at_send/recv()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>

commit 0feef1684e5a3a1889182e68597298a0e25df4ba
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Jul 25 17:15:46 2018 +0200

    smbd: factor out dosmode post processing
    
    We apply some post processing to the dosmode returned from the VFS
    function. Move this to a seperate function which will be reused in the
    next commit in the async dos_mode_send/recv post processing.
    
    Best viewed with: git show --histogram
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 1265b5167328db1bf6d64f50c39276cc19278d70
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 15 12:35:13 2018 +0100

    vfs_default: implement SMB_VFS_GET_DOS_ATTRIBUTES_SEND/RECV
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 0d1fb6a73820e44c53c45e0b7f4455105ef2afb2
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 15 10:56:28 2018 +0100

    smbd: split out public parse_dos_attribute_blob() from get_ea_dos_attribute()
    
    In preperation of adding an async version of get_ea_dos_attribute() that
    will then call parse_dos_attribute_blob() too.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 47d77432e4e0c61ba93390a5e33641a401154b54
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 15 13:08:55 2018 +0100

    s3: vfs: add SMB_VFS_GET_DOS_ATTRIBUTES_SEND/RECV
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 8a6013f612f3a5ae8dccfab8aa07baf09450b59a
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Jun 21 17:04:22 2018 +0200

    vfs_xattr_tdb: implement SMB_VFS_GETXATTRAT_SEND/RECV
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit c1c8a1f635266a954ea3de08d6d03de7f0ce503b
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Mar 13 16:17:27 2018 +0100

    vfs_default: implement SMB_VFS_GETXATTRAT_SEND/RECV
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 7e1f9c9d83a91f67925d7ba504b434eaf682e8a7
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Mar 13 08:14:53 2018 +0100

    s3: vfs: add SMB_VFS_GETXATTRAT_SEND/RECV
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit ff863f2d98ac5e12073af824b794404c3d7198c5
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Jul 26 09:41:22 2018 +0200

    pthreadpool: we need to use pthreadpool_tevent_per_thread_cwd() on the callers pool
    
    In pthreadpool_tevent_job_send() we remember if the job will be chdir
    safe. It means we means we need to ask the callers pool when calling
    pthreadpool_tevent_per_thread_cwd(), as the callers pool might
    be a wrapper using pthreadpool_tevent_force_per_thread_cwd().
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 591d72f9c7981350eba19221398dbe7bcf0c098b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Jul 26 02:29:10 2018 +0200

    ldb_mdb: #ifdef EBADE as it is not portable
    
    E.g. FreeBSD 11.2 doesn't have it.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 examples/VFS/skel_opaque.c            | 104 ++++++
 examples/VFS/skel_transparent.c       | 171 ++++++++++
 lib/ldb/ldb_mdb/ldb_mdb.c             |   2 +
 lib/pthreadpool/pthreadpool_tevent.c  |   3 +-
 selftest/target/Samba3.pm             |  43 +++
 source3/include/smbprofile.h          |   1 +
 source3/include/vfs.h                 |  70 +++++
 source3/include/vfs_macros.h          |  33 ++
 source3/modules/vfs_cap.c             |   2 +
 source3/modules/vfs_catia.c           |  19 ++
 source3/modules/vfs_ceph.c            |   7 +
 source3/modules/vfs_default.c         | 347 ++++++++++++++++++++
 source3/modules/vfs_full_audit.c      | 269 ++++++++++++++++
 source3/modules/vfs_glusterfs.c       |   7 +
 source3/modules/vfs_gpfs.c            |   8 +
 source3/modules/vfs_media_harmony.c   |   2 +
 source3/modules/vfs_not_implemented.c | 104 ++++++
 source3/modules/vfs_offline.c         |   2 +
 source3/modules/vfs_posix_eadb.c      |   2 +
 source3/modules/vfs_shadow_copy2.c    |   2 +
 source3/modules/vfs_snapper.c         |   2 +
 source3/modules/vfs_time_audit.c      | 224 +++++++++++++
 source3/modules/vfs_tsmsm.c           |   2 +
 source3/modules/vfs_unityed_media.c   |   2 +
 source3/modules/vfs_vxfs.c            |   2 +
 source3/modules/vfs_xattr_tdb.c       | 132 ++++++++
 source3/selftest/tests.py             |  11 +
 source3/smbd/close.c                  |  25 ++
 source3/smbd/dir.c                    |   6 +-
 source3/smbd/dosmode.c                | 372 +++++++++++++++-------
 source3/smbd/globals.h                |   4 +
 source3/smbd/proto.h                  |   9 +
 source3/smbd/smb2_query_directory.c   | 577 +++++++++++++++++++++++++---------
 source3/smbd/trans2.c                 |  35 ++-
 source3/smbd/vfs.c                    | 201 +++++++++++-
 source4/torture/smb2/compound.c       |  69 ++++
 36 files changed, 2601 insertions(+), 270 deletions(-)


Changeset truncated at 500 lines:

diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index 6fc4d58..054de50 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -22,6 +22,7 @@
  */
 
 #include "../source3/include/includes.h"
+#include "lib/util/tevent_unix.h"
 #include "lib/util/tevent_ntstatus.h"
 
 /* PLEASE,PLEASE READ THE VFS MODULES CHAPTER OF THE 
@@ -706,6 +707,52 @@ static NTSTATUS skel_get_dos_attributes(struct vfs_handle_struct *handle,
 	return NT_STATUS_NOT_IMPLEMENTED;
 }
 
+struct skel_get_dos_attributes_state {
+	struct vfs_aio_state aio_state;
+	uint32_t dosmode;
+};
+
+static struct tevent_req *skel_get_dos_attributes_send(
+			TALLOC_CTX *mem_ctx,
+			const struct smb_vfs_ev_glue *evg,
+			struct vfs_handle_struct *handle,
+			files_struct *dir_fsp,
+			struct smb_filename *smb_fname)
+{
+	struct tevent_context *ev = smb_vfs_ev_glue_ev_ctx(evg);
+	struct tevent_req *req = NULL;
+	struct skel_get_dos_attributes_state *state = NULL;
+
+	req = tevent_req_create(mem_ctx, &state,
+				struct skel_get_dos_attributes_state);
+	if (req == NULL) {
+		return NULL;
+	}
+
+	tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
+	return tevent_req_post(req, ev);
+}
+
+static NTSTATUS skel_get_dos_attributes_recv(struct tevent_req *req,
+					     struct vfs_aio_state *aio_state,
+					     uint32_t *dosmode)
+{
+	struct skel_get_dos_attributes_state *state =
+		tevent_req_data(req,
+		struct skel_get_dos_attributes_state);
+	NTSTATUS status;
+
+	if (tevent_req_is_nterror(req, &status)) {
+		tevent_req_received(req);
+		return status;
+	}
+
+	*aio_state = state->aio_state;
+	*dosmode = state->dosmode;
+	tevent_req_received(req);
+	return NT_STATUS_OK;
+}
+
 static NTSTATUS skel_fget_dos_attributes(struct vfs_handle_struct *handle,
 				struct files_struct *fsp,
 				uint32_t *dosmode)
@@ -818,6 +865,59 @@ static ssize_t skel_getxattr(vfs_handle_struct *handle,
 	return -1;
 }
 
+struct skel_getxattrat_state {
+	struct vfs_aio_state aio_state;
+	ssize_t xattr_size;
+	uint8_t *xattr_value;
+};
+
+static struct tevent_req *skel_getxattrat_send(
+			TALLOC_CTX *mem_ctx,
+			const struct smb_vfs_ev_glue *evg,
+			struct vfs_handle_struct *handle,
+			files_struct *dir_fsp,
+			const struct smb_filename *smb_fname,
+			const char *xattr_name,
+			size_t alloc_hint)
+{
+	struct tevent_context *ev = smb_vfs_ev_glue_ev_ctx(evg);
+	struct tevent_req *req = NULL;
+	struct skel_getxattrat_state *state = NULL;
+
+	req = tevent_req_create(mem_ctx, &state,
+				struct skel_getxattrat_state);
+	if (req == NULL) {
+		return NULL;
+	}
+
+	tevent_req_error(req, ENOSYS);
+	return tevent_req_post(req, ev);
+}
+
+static ssize_t skel_getxattrat_recv(struct tevent_req *req,
+				    struct vfs_aio_state *aio_state,
+				    TALLOC_CTX *mem_ctx,
+				    uint8_t **xattr_value)
+{
+	struct skel_getxattrat_state *state = tevent_req_data(
+		req, struct skel_getxattrat_state);
+	ssize_t xattr_size;
+
+	if (tevent_req_is_unix_error(req, &aio_state->error)) {
+		tevent_req_received(req);
+		return -1;
+	}
+
+	*aio_state = state->aio_state;
+	xattr_size = state->xattr_size;
+	if (xattr_value != NULL) {
+		*xattr_value = talloc_move(mem_ctx, &state->xattr_value);
+	}
+
+	tevent_req_received(req);
+	return xattr_size;
+}
+
 static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
 			      struct files_struct *fsp, const char *name,
 			      void *value, size_t size)
@@ -1015,6 +1115,8 @@ static struct vfs_fn_pointers skel_opaque_fns = {
 
 	/* DOS attributes. */
 	.get_dos_attributes_fn = skel_get_dos_attributes,
+	.get_dos_attributes_send_fn = skel_get_dos_attributes_send,
+	.get_dos_attributes_recv_fn = skel_get_dos_attributes_recv,
 	.fget_dos_attributes_fn = skel_fget_dos_attributes,
 	.set_dos_attributes_fn = skel_set_dos_attributes,
 	.fset_dos_attributes_fn = skel_fset_dos_attributes,
@@ -1037,6 +1139,8 @@ static struct vfs_fn_pointers skel_opaque_fns = {
 
 	/* EA operations. */
 	.getxattr_fn = skel_getxattr,
+	.getxattrat_send_fn = skel_getxattrat_send,
+	.getxattrat_recv_fn = skel_getxattrat_recv,
 	.fgetxattr_fn = skel_fgetxattr,
 	.listxattr_fn = skel_listxattr,
 	.flistxattr_fn = skel_flistxattr,
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index d84e6de..cff52fa 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -886,6 +886,86 @@ static NTSTATUS skel_get_dos_attributes(struct vfs_handle_struct *handle,
 				dosmode);
 }
 
+struct skel_get_dos_attributes_state {
+	struct vfs_aio_state aio_state;
+	uint32_t dosmode;
+};
+
+static void skel_get_dos_attributes_done(struct tevent_req *subreq);
+
+static struct tevent_req *skel_get_dos_attributes_send(
+			TALLOC_CTX *mem_ctx,
+			const struct smb_vfs_ev_glue *evg,
+			struct vfs_handle_struct *handle,
+			files_struct *dir_fsp,
+			struct smb_filename *smb_fname)
+{
+	struct tevent_context *ev = smb_vfs_ev_glue_ev_ctx(evg);
+	struct tevent_req *req = NULL;
+	struct skel_get_dos_attributes_state *state = NULL;
+	struct tevent_req *subreq = NULL;
+
+	req = tevent_req_create(mem_ctx, &state,
+				struct skel_get_dos_attributes_state);
+	if (req == NULL) {
+		return NULL;
+	}
+
+	subreq = SMB_VFS_NEXT_GET_DOS_ATTRIBUTES_SEND(mem_ctx,
+						      evg,
+						      handle,
+						      dir_fsp,
+						      smb_fname);
+	if (tevent_req_nomem(subreq, req)) {
+		return tevent_req_post(req, ev);
+	}
+	tevent_req_set_callback(subreq, skel_get_dos_attributes_done, req);
+
+	return req;
+}
+
+static void skel_get_dos_attributes_done(struct tevent_req *subreq)
+{
+	struct tevent_req *req =
+		tevent_req_callback_data(subreq,
+		struct tevent_req);
+	struct skel_get_dos_attributes_state *state =
+		tevent_req_data(req,
+		struct skel_get_dos_attributes_state);
+	NTSTATUS status;
+
+	status = SMB_VFS_NEXT_GET_DOS_ATTRIBUTES_RECV(subreq,
+						      &state->aio_state,
+						      &state->dosmode);
+	TALLOC_FREE(subreq);
+	if (tevent_req_nterror(req, status)) {
+		return;
+	}
+
+	tevent_req_done(req);
+	return;
+}
+
+static NTSTATUS skel_get_dos_attributes_recv(struct tevent_req *req,
+					     struct vfs_aio_state *aio_state,
+					     uint32_t *dosmode)
+{
+	struct skel_get_dos_attributes_state *state =
+		tevent_req_data(req,
+		struct skel_get_dos_attributes_state);
+	NTSTATUS status;
+
+	if (tevent_req_is_nterror(req, &status)) {
+		tevent_req_received(req);
+		return status;
+	}
+
+	*aio_state = state->aio_state;
+	*dosmode = state->dosmode;
+	tevent_req_received(req);
+	return NT_STATUS_OK;
+}
+
 static NTSTATUS skel_fget_dos_attributes(struct vfs_handle_struct *handle,
 				struct files_struct *fsp,
 				uint32_t *dosmode)
@@ -1004,6 +1084,93 @@ static ssize_t skel_getxattr(vfs_handle_struct *handle,
 	return SMB_VFS_NEXT_GETXATTR(handle, smb_fname, name, value, size);
 }
 
+struct skel_getxattrat_state {
+	struct vfs_aio_state aio_state;
+	ssize_t xattr_size;
+	uint8_t *xattr_value;
+};
+
+static void skel_getxattrat_done(struct tevent_req *subreq);
+
+static struct tevent_req *skel_getxattrat_send(
+			TALLOC_CTX *mem_ctx,
+			const struct smb_vfs_ev_glue *evg,
+			struct vfs_handle_struct *handle,
+			files_struct *dir_fsp,
+			const struct smb_filename *smb_fname,
+			const char *xattr_name,
+			size_t alloc_hint)
+{
+	struct tevent_context *ev = smb_vfs_ev_glue_ev_ctx(evg);
+	struct tevent_req *req = NULL;
+	struct skel_getxattrat_state *state = NULL;
+	struct tevent_req *subreq = NULL;
+
+	req = tevent_req_create(mem_ctx, &state,
+				struct skel_getxattrat_state);
+	if (req == NULL) {
+		return NULL;
+	}
+
+	subreq = SMB_VFS_NEXT_GETXATTRAT_SEND(state,
+					      evg,
+					      handle,
+					      dir_fsp,
+					      smb_fname,
+					      xattr_name,
+					      alloc_hint);
+	if (tevent_req_nomem(subreq, req)) {
+		return tevent_req_post(req, ev);
+	}
+	tevent_req_set_callback(subreq, skel_getxattrat_done, req);
+
+	return req;
+}
+
+static void skel_getxattrat_done(struct tevent_req *subreq)
+{
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct skel_getxattrat_state *state = tevent_req_data(
+		req, struct skel_getxattrat_state);
+
+	state->xattr_size = SMB_VFS_NEXT_GETXATTRAT_RECV(subreq,
+							 &state->aio_state,
+							 state,
+							 &state->xattr_value);
+	TALLOC_FREE(subreq);
+	if (state->xattr_size == -1) {
+		tevent_req_error(req, state->aio_state.error);
+		return;
+	}
+
+	tevent_req_done(req);
+}
+
+static ssize_t skel_getxattrat_recv(struct tevent_req *req,
+				    struct vfs_aio_state *aio_state,
+				    TALLOC_CTX *mem_ctx,
+				    uint8_t **xattr_value)
+{
+	struct skel_getxattrat_state *state = tevent_req_data(
+		req, struct skel_getxattrat_state);
+	ssize_t xattr_size;
+
+	if (tevent_req_is_unix_error(req, &aio_state->error)) {
+		tevent_req_received(req);
+		return -1;
+	}
+
+	*aio_state = state->aio_state;
+	xattr_size = state->xattr_size;
+	if (xattr_value != NULL) {
+		*xattr_value = talloc_move(mem_ctx, &state->xattr_value);
+	}
+
+	tevent_req_received(req);
+	return xattr_size;
+}
+
 static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
 			      struct files_struct *fsp, const char *name,
 			      void *value, size_t size)
@@ -1211,6 +1378,8 @@ static struct vfs_fn_pointers skel_transparent_fns = {
 
 	/* DOS attributes. */
 	.get_dos_attributes_fn = skel_get_dos_attributes,
+	.get_dos_attributes_send_fn = skel_get_dos_attributes_send,
+	.get_dos_attributes_recv_fn = skel_get_dos_attributes_recv,
 	.fget_dos_attributes_fn = skel_fget_dos_attributes,
 	.set_dos_attributes_fn = skel_set_dos_attributes,
 	.fset_dos_attributes_fn = skel_fset_dos_attributes,
@@ -1233,6 +1402,8 @@ static struct vfs_fn_pointers skel_transparent_fns = {
 
 	/* EA operations. */
 	.getxattr_fn = skel_getxattr,
+	.getxattrat_send_fn = skel_getxattrat_send,
+	.getxattrat_recv_fn = skel_getxattrat_recv,
 	.fgetxattr_fn = skel_fgetxattr,
 	.listxattr_fn = skel_listxattr,
 	.flistxattr_fn = skel_flistxattr,
diff --git a/lib/ldb/ldb_mdb/ldb_mdb.c b/lib/ldb/ldb_mdb/ldb_mdb.c
index af552fe..bd84fe1 100644
--- a/lib/ldb/ldb_mdb/ldb_mdb.c
+++ b/lib/ldb/ldb_mdb/ldb_mdb.c
@@ -40,7 +40,9 @@ int ldb_mdb_err_map(int lmdb_err)
 		return LDB_SUCCESS;
 	case EIO:
 		return LDB_ERR_OPERATIONS_ERROR;
+#ifdef EBADE
 	case EBADE:
+#endif
 	case MDB_INCOMPATIBLE:
 	case MDB_CORRUPTED:
 	case MDB_INVALID:
diff --git a/lib/pthreadpool/pthreadpool_tevent.c b/lib/pthreadpool/pthreadpool_tevent.c
index f88f82d..b4a9786 100644
--- a/lib/pthreadpool/pthreadpool_tevent.c
+++ b/lib/pthreadpool/pthreadpool_tevent.c
@@ -992,6 +992,7 @@ struct tevent_req *pthreadpool_tevent_job_send(
 	struct pthreadpool_tevent_job_state *state = NULL;
 	struct pthreadpool_tevent_job *job = NULL;
 	int ret;
+	struct pthreadpool_tevent *caller_pool = pool;
 	struct pthreadpool_tevent_wrapper *wrapper = pool->wrapper.ctx;
 
 	pthreadpool_tevent_cleanup_orphaned_jobs();
@@ -1037,7 +1038,7 @@ struct tevent_req *pthreadpool_tevent_job_send(
 		return tevent_req_post(req, ev);
 	}
 	PTHREAD_TEVENT_JOB_THREAD_FENCE_INIT(job);
-	job->per_thread_cwd = pthreadpool_tevent_per_thread_cwd(pool);
+	job->per_thread_cwd = pthreadpool_tevent_per_thread_cwd(caller_pool);
 	talloc_set_destructor(job, pthreadpool_tevent_job_destructor);
 	DLIST_ADD_END(job->pool->jobs, job);
 	job->state = state;
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index a553405..5b8cf9e 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -775,6 +775,49 @@ sub setup_simpleserver
 	read only = no
 	vfs objects = aio_pthread
 	aio_pthread:aio open = yes
+	smbd:async dosmode = no
+
+[vfs_aio_pthread_async_dosmode_default1]
+	path = $prefix_abs/share
+	read only = no
+	vfs objects = aio_pthread
+	store dos attributes = yes
+	aio_pthread:aio open = yes
+	smbd:async dosmode = yes
+
+[vfs_aio_pthread_async_dosmode_default2]
+	path = $prefix_abs/share
+	read only = no
+	vfs objects = aio_pthread xattr_tdb
+	store dos attributes = yes
+	aio_pthread:aio open = yes
+	smbd:async dosmode = yes
+
+[vfs_aio_pthread_async_dosmode_force_sync1]
+	path = $prefix_abs/share
+	read only = no
+	vfs objects = aio_pthread
+	store dos attributes = yes
+	aio_pthread:aio open = yes
+	smbd:async dosmode = yes
+	# This simulates non linux systems
+	smbd:force sync user path safe threadpool = yes
+	smbd:force sync user chdir safe threadpool = yes
+	smbd:force sync root path safe threadpool = yes
+	smbd:force sync root chdir safe threadpool = yes
+
+[vfs_aio_pthread_async_dosmode_force_sync2]
+	path = $prefix_abs/share
+	read only = no
+	vfs objects = aio_pthread xattr_tdb
+	store dos attributes = yes
+	aio_pthread:aio open = yes
+	smbd:async dosmode = yes
+	# This simulates non linux systems
+	smbd:force sync user path safe threadpool = yes
+	smbd:force sync user chdir safe threadpool = yes
+	smbd:force sync root path safe threadpool = yes
+	smbd:force sync root chdir safe threadpool = yes
 
 [vfs_aio_fork]
 	path = $prefix_abs/share
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index e33f77e..8888ae3 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -95,6 +95,7 @@ struct tevent_context;
 	SMBPROFILE_STATS_BASIC(syscall_brl_lock) \
 	SMBPROFILE_STATS_BASIC(syscall_brl_unlock) \
 	SMBPROFILE_STATS_BASIC(syscall_brl_cancel) \
+	SMBPROFILE_STATS_BYTES(syscall_asys_getxattrat) \
 	SMBPROFILE_STATS_SECTION_END \
 	\
 	SMBPROFILE_STATS_SECTION_START(acl, "ACL Calls") \
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 3d3718d..4f3db69 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -259,6 +259,8 @@
 /* Bump to version 40, Samba 4.10 will ship with that */
 /* Version 40 - Introduce smb_vfs_ev_glue infrastructure. */
 /* Version 40 - Add vfs_not_implemented_* helper functions. */
+/* Version 40 - Add SMB_VFS_GETXATTRAT_SEND/RECV */
+/* Version 40 - Add SMB_VFS_GET_DOS_ATTRIBUTES_SEND/RECV */
 
 #define SMB_VFS_INTERFACE_VERSION 40
 
@@ -899,6 +901,18 @@ struct vfs_fn_pointers {
 					   struct files_struct *fsp,
 					   uint32_t dosmode);
 
+	struct tevent_req *(*get_dos_attributes_send_fn)(
+				TALLOC_CTX *mem_ctx,
+				const struct smb_vfs_ev_glue *evg,
+				struct vfs_handle_struct *handle,
+				files_struct *dir_fsp,
+				struct smb_filename *smb_fname);
+
+	NTSTATUS (*get_dos_attributes_recv_fn)(
+				struct tevent_req *req,
+				struct vfs_aio_state *aio_state,
+				uint32_t *dosmode);
+
 	/* NT ACL operations. */
 
 	NTSTATUS (*fget_nt_acl_fn)(struct vfs_handle_struct *handle,
@@ -953,6 +967,18 @@ struct vfs_fn_pointers {
 					const char *name,
 					void *value,
 					size_t size);
+	struct tevent_req *(*getxattrat_send_fn)(
+				TALLOC_CTX *mem_ctx,
+				const struct smb_vfs_ev_glue *evg,
+				struct vfs_handle_struct *handle,
+				files_struct *dir_fsp,
+				const struct smb_filename *smb_fname,
+				const char *xattr_name,
+				size_t alloc_hint);
+	ssize_t (*getxattrat_recv_fn)(struct tevent_req *req,
+				      struct vfs_aio_state *aio_state,
+				      TALLOC_CTX *mem_ctx,
+				      uint8_t **xattr_value);
 	ssize_t (*fgetxattr_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size);
 	ssize_t (*listxattr_fn)(struct vfs_handle_struct *handle,
 					const struct smb_filename *smb_fname,
@@ -1342,6 +1368,16 @@ NTSTATUS smb_vfs_call_set_dos_attributes(struct vfs_handle_struct *handle,
 NTSTATUS smb_vfs_call_fset_dos_attributes(struct vfs_handle_struct *handle,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list