impersonation part 6 (kitchen sink)

slow at samba.org slow at samba.org
Tue Jul 24 20:25:21 UTC 2018


On Tue, Jul 24, 2018 at 09:50:41PM +0200, Ralph Böhme via samba-technical wrote:
>there are more missing... working on it. *argh*

hopefully this time I got them all -- the durable handle functions were missing 
as well. At least it passes ./configure --with-static-modules=ALL ... && make -j 
test TESTS='samba3.smb2.create.*nt4_dc'.

Pipeline: https://gitlab.com/samba-team/devel/samba/pipelines/26426821

Patchset attached, please review&push.

-slow

-- 
Ralph Boehme, Samba Team       https://samba.org/
Samba Developer, SerNet GmbH   https://sernet.de/en/samba/
GPG Key Fingerprint:           FAE2 C608 8A24 2520 51C5
                               59E4 AA1E 9B71 2639 9E46
-------------- next part --------------
From 98a3be73118a85f0db49844928d141e765416885 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Tue, 24 Jul 2018 12:30:33 +0200
Subject: [PATCH 01/17] autobuild: add some basic tests for the all shared and
 non shared builds

This makes sure each module is at least loaded once
and registers itself as a module.

It means that the skel_opaque and skel_transparent vfs examples
are loaded.

Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Signed-off-by: Ralph Boehme <slow at samba.org>
---
 script/autobuild.py | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/script/autobuild.py b/script/autobuild.py
index 1a8cf7cfd88..bb7ce4e4a52 100755
--- a/script/autobuild.py
+++ b/script/autobuild.py
@@ -242,16 +242,29 @@ tasks = {
                       # build with all modules static
                       ("allstatic-configure", "./configure.developer " + samba_configure_params + " --with-static-modules=ALL", "text/plain"),
                       ("allstatic-make", "make -j", "text/plain"),
+                      ("allstatic-test", "make test "
+                       "FAIL_IMMEDIATELY=1 "
+                       "TESTS='samba3.smb2.create.*nt4_dc'",
+                       "text/plain"),
 
                       # retry without any required modules
                       ("none-distclean", "make distclean", "text/plain"),
                       ("none-configure", "./configure.developer " + samba_configure_params + " --with-static-modules=!FORCED,!DEFAULT --with-shared-modules=!FORCED,!DEFAULT", "text/plain"),
                       ("none-make", "make -j", "text/plain"),
+                      ("none-test", "make test "
+                       "FAIL_IMMEDIATELY=1 "
+                       "TESTS='samba3.smb2.create.*nt4_dc'",
+                       "text/plain"),
 
                       # retry with nonshared smbd and smbtorture
                       ("nonshared-distclean", "make distclean", "text/plain"),
                       ("nonshared-configure", "./configure.developer " + samba_configure_params + " --bundled-libraries=talloc,tdb,pytdb,ldb,pyldb,tevent,pytevent --with-static-modules=ALL --nonshared-binary=smbtorture,smbd/smbd", "text/plain"),
-                      ("nonshared-make", "make -j", "text/plain")],
+                      ("nonshared-make", "make -j", "text/plain"),
+                      ("nonshared-test", "make test "
+                       "FAIL_IMMEDIATELY=1 "
+                       "TESTS='samba3.smb2.create.*nt4_dc'",
+                       "text/plain")
+                      ],
 
     "samba-systemkrb5" : [
                       ("random-sleep", "script/random-sleep.sh 60 600", "text/plain"),
-- 
2.13.6


From ba68175e0fb53ad7406b11eb472dde55ba6613b7 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Tue, 24 Jul 2018 18:58:45 +0200
Subject: [PATCH 02/17] examples/VFS/skel_opaque: add missing audit_file_fn

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 examples/VFS/skel_opaque.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index 446cfd5767e..6b91a26c7c5 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -885,6 +885,15 @@ static bool skel_aio_force(struct vfs_handle_struct *handle,
 	return false;
 }
 
+static NTSTATUS skel_audit_file(struct vfs_handle_struct *handle,
+				struct smb_filename *file,
+				struct security_acl *sacl,
+				uint32_t access_requested,
+				uint32_t access_denied)
+{
+	return NT_STATUS_NOT_IMPLEMENTED;
+}
+
 /* VFS operations structure */
 
 struct vfs_fn_pointers skel_opaque_fns = {
@@ -975,6 +984,7 @@ struct vfs_fn_pointers skel_opaque_fns = {
 	.translate_name_fn = skel_translate_name,
 	.fsctl_fn = skel_fsctl,
 	.readdir_attr_fn = skel_readdir_attr,
+	.audit_file_fn = skel_audit_file,
 
 	/* DOS attributes. */
 	.get_dos_attributes_fn = skel_get_dos_attributes,
-- 
2.13.6


From 5480ca44a9bd9cbdf7723f75ccc12fa1e39d3e7d Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Tue, 24 Jul 2018 21:56:26 +0200
Subject: [PATCH 03/17] examples/VFS/skel_opaque: add missing durable handle
 functions

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 examples/VFS/skel_opaque.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index 6b91a26c7c5..f88e9258c73 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -894,6 +894,34 @@ static NTSTATUS skel_audit_file(struct vfs_handle_struct *handle,
 	return NT_STATUS_NOT_IMPLEMENTED;
 }
 
+static NTSTATUS skel_durable_cookie(struct vfs_handle_struct *handle,
+				    struct files_struct *fsp,
+				    TALLOC_CTX *mem_ctx,
+				    DATA_BLOB *cookie)
+{
+	return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+static NTSTATUS skel_durable_disconnect(struct vfs_handle_struct *handle,
+					struct files_struct *fsp,
+					const DATA_BLOB old_cookie,
+					TALLOC_CTX *mem_ctx,
+					DATA_BLOB *new_cookie)
+{
+	return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+static NTSTATUS skel_durable_reconnect(struct vfs_handle_struct *handle,
+				       struct smb_request *smb1req,
+				       struct smbXsrv_open *op,
+				       const DATA_BLOB old_cookie,
+				       TALLOC_CTX *mem_ctx,
+				       struct files_struct **fsp,
+				       DATA_BLOB *new_cookie)
+{
+	return NT_STATUS_NOT_IMPLEMENTED;
+}
+
 /* VFS operations structure */
 
 struct vfs_fn_pointers skel_opaque_fns = {
@@ -1020,6 +1048,11 @@ struct vfs_fn_pointers skel_opaque_fns = {
 
 	/* aio operations */
 	.aio_force_fn = skel_aio_force,
+
+	/* durable handle operations */
+	.durable_cookie_fn = skel_durable_cookie,
+	.durable_disconnect_fn = skel_durable_disconnect,
+	.durable_reconnect_fn = skel_durable_reconnect,
 };
 
 static_decl_vfs;
-- 
2.13.6


From 750936b55d81e4acb9229a60cb0f5e6ae2263641 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Mon, 23 Jul 2018 09:02:52 +0200
Subject: [PATCH 04/17] examples/VFS/skel_opaque: call smb_vfs_assert_all_fns()

This template should always implement all calls.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
---
 examples/VFS/skel_opaque.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index f88e9258c73..5b9d1f4451f 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -1058,6 +1058,13 @@ struct vfs_fn_pointers skel_opaque_fns = {
 static_decl_vfs;
 NTSTATUS vfs_skel_opaque_init(TALLOC_CTX *ctx)
 {
+	/*
+	 * smb_vfs_assert_all_fns() makes sure every
+	 * call is implemented.
+	 *
+	 * An opaque module requires this!
+	 */
+	smb_vfs_assert_all_fns(&skel_opaque_fns, "skel_opaque");
 	return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_opaque",
 				&skel_opaque_fns);
 }
-- 
2.13.6


From e3854d99eb82b4cf30a4bc40cede7b523bbf4547 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Tue, 24 Jul 2018 18:58:59 +0200
Subject: [PATCH 05/17] examples/VFS/skel_transparent: add missing
 audit_file_fn

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 examples/VFS/skel_transparent.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index 7f2c78b2e3b..a8580712c71 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -1063,6 +1063,19 @@ static bool skel_aio_force(struct vfs_handle_struct *handle,
 	return SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
 }
 
+static NTSTATUS skel_audit_file(struct vfs_handle_struct *handle,
+				struct smb_filename *file,
+				struct security_acl *sacl,
+				uint32_t access_requested,
+				uint32_t access_denied)
+{
+	return SMB_VFS_NEXT_AUDIT_FILE(handle,
+				       file,
+				       sacl,
+				       access_requested,
+				       access_denied);
+}
+
 /* VFS operations structure */
 
 struct vfs_fn_pointers skel_transparent_fns = {
@@ -1153,6 +1166,7 @@ struct vfs_fn_pointers skel_transparent_fns = {
 	.translate_name_fn = skel_translate_name,
 	.fsctl_fn = skel_fsctl,
 	.readdir_attr_fn = skel_readdir_attr,
+	.audit_file_fn = skel_audit_file,
 
 	/* DOS attributes. */
 	.get_dos_attributes_fn = skel_get_dos_attributes,
-- 
2.13.6


From c86f3a4c9d75017febe227505c44d497929202f9 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Tue, 24 Jul 2018 22:03:01 +0200
Subject: [PATCH 06/17] examples/VFS/skel_transparent: add missing durable
 handle functions

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 examples/VFS/skel_transparent.c | 46 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index a8580712c71..9ed902ed8cd 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -1076,6 +1076,47 @@ static NTSTATUS skel_audit_file(struct vfs_handle_struct *handle,
 				       access_denied);
 }
 
+static NTSTATUS skel_durable_cookie(struct vfs_handle_struct *handle,
+				    struct files_struct *fsp,
+				    TALLOC_CTX *mem_ctx,
+				    DATA_BLOB *cookie)
+{
+	return SMB_VFS_NEXT_DURABLE_COOKIE(handle,
+					   fsp,
+					   mem_ctx,
+					   cookie);
+}
+
+static NTSTATUS skel_durable_disconnect(struct vfs_handle_struct *handle,
+					struct files_struct *fsp,
+					const DATA_BLOB old_cookie,
+					TALLOC_CTX *mem_ctx,
+					DATA_BLOB *new_cookie)
+{
+	return SMB_VFS_NEXT_DURABLE_DISCONNECT(handle,
+					       fsp,
+					       old_cookie,
+					       mem_ctx,
+					       new_cookie);
+}
+
+static NTSTATUS skel_durable_reconnect(struct vfs_handle_struct *handle,
+				       struct smb_request *smb1req,
+				       struct smbXsrv_open *op,
+				       const DATA_BLOB old_cookie,
+				       TALLOC_CTX *mem_ctx,
+				       struct files_struct **fsp,
+				       DATA_BLOB *new_cookie)
+{
+	return SMB_VFS_NEXT_DURABLE_RECONNECT(handle,
+					      smb1req,
+					      op,
+					      old_cookie,
+					      mem_ctx,
+					      fsp,
+					      new_cookie);
+}
+
 /* VFS operations structure */
 
 struct vfs_fn_pointers skel_transparent_fns = {
@@ -1202,6 +1243,11 @@ struct vfs_fn_pointers skel_transparent_fns = {
 
 	/* aio operations */
 	.aio_force_fn = skel_aio_force,
+
+	/* durable handle operations */
+	.durable_cookie_fn = skel_durable_cookie,
+	.durable_disconnect_fn = skel_durable_disconnect,
+	.durable_reconnect_fn = skel_durable_reconnect,
 };
 
 static_decl_vfs;
-- 
2.13.6


From fc8adff2294388313f65340996a97693477803ee Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Mon, 23 Jul 2018 09:02:52 +0200
Subject: [PATCH 07/17] examples/VFS/skel_transparent: call
 smb_vfs_assert_all_fns()

This template should always include all calls.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
---
 examples/VFS/skel_transparent.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index 9ed902ed8cd..513294f867f 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -1253,6 +1253,14 @@ struct vfs_fn_pointers skel_transparent_fns = {
 static_decl_vfs;
 NTSTATUS vfs_skel_transparent_init(TALLOC_CTX *ctx)
 {
+	/*
+	 * smb_vfs_assert_all_fns() is only needed in
+	 * order to have a complete example.
+	 *
+	 * A transparent vfs module typically don't
+	 * need to implement every calls.
+	 */
+	smb_vfs_assert_all_fns(&skel_transparent_fns, "skel_transparent");
 	return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "skel_transparent",
 				&skel_transparent_fns);
 }
-- 
2.13.6


From 02dc721414cde3df54a8aed66f48631ab2aaf12c Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Mon, 23 Jul 2018 09:14:36 +0200
Subject: [PATCH 08/17] vfs_default: call smb_vfs_assert_all_fns()

This module needs to implement every call.

Signed-off-by: Stefan Metzmacher <metze at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
---
 source3/modules/vfs_default.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 082b70f5a98..cbe505dd1d1 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -3000,6 +3000,12 @@ static struct vfs_fn_pointers vfs_default_fns = {
 static_decl_vfs;
 NTSTATUS vfs_default_init(TALLOC_CTX *ctx)
 {
+	/*
+	 * Here we need to implement every call!
+	 *
+	 * As this is the end of the vfs module chain.
+	 */
+	smb_vfs_assert_all_fns(&vfs_default_fns, DEFAULT_VFS_MODULE_NAME);
 	return smb_register_vfs(SMB_VFS_INTERFACE_VERSION,
 				DEFAULT_VFS_MODULE_NAME, &vfs_default_fns);
 }
-- 
2.13.6


From 5bcf802109c096c501a4f691d73d872576af054b Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Thu, 28 Jun 2018 21:47:54 +0200
Subject: [PATCH 09/17] s3: lib/xattr_tdb: fix listing xattrs

If there's no record in the xattr.tdb, dbwrap_fetch() will return
NT_STATUS_NOT_FOUND. That should not result in an error in callers of
xattr_tdb_load_attrs().

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
---
 source3/lib/xattr_tdb.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/source3/lib/xattr_tdb.c b/source3/lib/xattr_tdb.c
index 34afbe29291..f3a2e19bf5d 100644
--- a/source3/lib/xattr_tdb.c
+++ b/source3/lib/xattr_tdb.c
@@ -115,6 +115,9 @@ static NTSTATUS xattr_tdb_load_attrs(TALLOC_CTX *mem_ctx,
 			      make_tdb_data(id_buf, sizeof(id_buf)),
 			      &data);
 	if (!NT_STATUS_IS_OK(status)) {
+		if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
+			return status;
+		}
 		return NT_STATUS_INTERNAL_DB_CORRUPTION;
 	}
 
@@ -316,14 +319,21 @@ ssize_t xattr_tdb_listattr(struct db_context *db_ctx,
 
 	status = xattr_tdb_load_attrs(frame, db_ctx, id, &attribs);
 
-	if (!NT_STATUS_IS_OK(status)) {
-		DEBUG(10, ("xattr_tdb_fetch_attrs failed: %s\n",
+	if (!NT_STATUS_IS_OK(status) &&
+	    !NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND))
+	{
+		DEBUG(0, ("xattr_tdb_fetch_attrs failed: %s\n",
 			   nt_errstr(status)));
 		errno = EINVAL;
 		TALLOC_FREE(frame);
 		return -1;
 	}
 
+	if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
+		TALLOC_FREE(frame);
+		return 0;
+	}
+
 	DEBUG(10, ("xattr_tdb_listattr: Found %d xattrs\n",
 		   attribs->num_eas));
 
-- 
2.13.6


From 35add542925a428bfc4d0467db4dd2f4c1b9bc9b Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Thu, 22 Mar 2018 10:07:49 +0100
Subject: [PATCH 10/17] s4: libcli/smb2: calculate correct credit charge for
 finds

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
---
 source4/libcli/smb2/find.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/source4/libcli/smb2/find.c b/source4/libcli/smb2/find.c
index 2e0bd35f102..23ac7378212 100644
--- a/source4/libcli/smb2/find.c
+++ b/source4/libcli/smb2/find.c
@@ -35,6 +35,7 @@ struct smb2_request *smb2_find_send(struct smb2_tree *tree, struct smb2_find *io
 
 	req = smb2_request_init_tree(tree, SMB2_OP_QUERY_DIRECTORY, 0x20, true, 0);
 	if (req == NULL) return NULL;
+	req->credit_charge = (MAX(io->in.max_response_size, 1) - 1)/ 65536 + 1;
 
 	SCVAL(req->out.body, 0x02, io->in.level);
 	SCVAL(req->out.body, 0x03, io->in.continue_flags);
-- 
2.13.6


From 39eee66252535419cf928b6114726378506dfcc7 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Tue, 20 Mar 2018 15:27:44 +0100
Subject: [PATCH 11/17] s3: libsmb: use smb2cli_conn_max_trans_size() in
 cli_smb2_list()

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
---
 source3/libsmb/cli_smb2_fnum.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c
index 1eb1bea7a72..4b9871c54df 100644
--- a/source3/libsmb/cli_smb2_fnum.c
+++ b/source3/libsmb/cli_smb2_fnum.c
@@ -903,6 +903,7 @@ NTSTATUS cli_smb2_list(struct cli_state *cli,
 	TALLOC_CTX *frame = talloc_stackframe();
 	TALLOC_CTX *subframe = NULL;
 	bool mask_has_wild;
+	uint32_t max_trans = smb2cli_conn_max_trans_size(cli->conn);
 
 	if (smbXcli_conn_has_async_calls(cli->conn)) {
 		/*
@@ -966,7 +967,7 @@ NTSTATUS cli_smb2_list(struct cli_state *cli,
 					ph->fid_persistent,
 					ph->fid_volatile,
 					mask,
-					0xffff,
+					max_trans,
 					subframe,
 					&dir_data,
 					&dir_data_length);
-- 
2.13.6


From 5e97e969dfb052ef25985556ee6e626031b9f09a Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Wed, 20 Jun 2018 10:54:04 +0200
Subject: [PATCH 12/17] vfs_default: fix async fsync idle/busy time profiling

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
---
 source3/include/smbprofile.h  |  2 +-
 source3/modules/vfs_default.c | 13 +++++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index 327c16ac2d9..e33f77e70e3 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -63,7 +63,7 @@ struct tevent_context;
 	SMBPROFILE_STATS_BYTES(syscall_recvfile) \
 	SMBPROFILE_STATS_BASIC(syscall_rename) \
 	SMBPROFILE_STATS_BASIC(syscall_rename_at) \
-	SMBPROFILE_STATS_BASIC(syscall_asys_fsync) \
+	SMBPROFILE_STATS_BYTES(syscall_asys_fsync) \
 	SMBPROFILE_STATS_BASIC(syscall_stat) \
 	SMBPROFILE_STATS_BASIC(syscall_fstat) \
 	SMBPROFILE_STATS_BASIC(syscall_lstat) \
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index cbe505dd1d1..f078cef9422 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -886,7 +886,7 @@ struct vfswrap_fsync_state {
 	int fd;
 
 	struct vfs_aio_state vfs_aio_state;
-	SMBPROFILE_BASIC_ASYNC_STATE(profile_basic);
+	SMBPROFILE_BYTES_ASYNC_STATE(profile_bytes);
 };
 
 static void vfs_fsync_do(void *private_data);
@@ -909,8 +909,9 @@ static struct tevent_req *vfswrap_fsync_send(struct vfs_handle_struct *handle,
 	state->ret = -1;
 	state->fd = fsp->fh->fd;
 
-	SMBPROFILE_BASIC_ASYNC_START(syscall_asys_fsync, profile_p,
-				     state->profile_basic);
+	SMBPROFILE_BYTES_ASYNC_START(syscall_asys_fsync, profile_p,
+				     state->profile_bytes, 0);
+	SMBPROFILE_BYTES_ASYNC_SET_IDLE(state->profile_bytes);
 
 	subreq = pthreadpool_tevent_job_send(
 		state, ev, handle->conn->sconn->pool, vfs_fsync_do, state);
@@ -931,6 +932,8 @@ static void vfs_fsync_do(void *private_data)
 	struct timespec start_time;
 	struct timespec end_time;
 
+	SMBPROFILE_BYTES_ASYNC_SET_BUSY(state->profile_bytes);
+
 	PROFILE_TIMESTAMP(&start_time);
 
 	do {
@@ -944,6 +947,8 @@ static void vfs_fsync_do(void *private_data)
 	PROFILE_TIMESTAMP(&end_time);
 
 	state->vfs_aio_state.duration = nsec_time_diff(&end_time, &start_time);
+
+	SMBPROFILE_BYTES_ASYNC_SET_IDLE(state->profile_bytes);
 }
 
 static int vfs_fsync_state_destructor(struct vfswrap_fsync_state *state)
@@ -961,7 +966,7 @@ static void vfs_fsync_done(struct tevent_req *subreq)
 
 	ret = pthreadpool_tevent_job_recv(subreq);
 	TALLOC_FREE(subreq);
-	SMBPROFILE_BASIC_ASYNC_END(state->profile_basic);
+	SMBPROFILE_BYTES_ASYNC_END(state->profile_bytes);
 	talloc_set_destructor(state, NULL);
 	if (tevent_req_error(req, ret)) {
 		return;
-- 
2.13.6


From 202a14a67a975b9952786010817c9032a22d9d8e Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Thu, 12 Jul 2018 14:43:55 +0200
Subject: [PATCH 13/17] s3: vfs: add missing tevent_req_received() to
 SMB_VFS_PREAD_RECV()

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
---
 source3/smbd/vfs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index ebe5ca5b869..84ef9eb23c7 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -1708,9 +1708,11 @@ ssize_t SMB_VFS_PREAD_RECV(struct tevent_req *req,
 		req, struct smb_vfs_call_pread_state);
 
 	if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
+		tevent_req_received(req);
 		return -1;
 	}
 	*vfs_aio_state = state->vfs_aio_state;
+	tevent_req_received(req);
 	return state->retval;
 }
 
-- 
2.13.6


From f9efb22480c6f162b05484e4008f3266112f522f Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Thu, 12 Jul 2018 14:44:27 +0200
Subject: [PATCH 14/17] s3: vfs: add missing tevent_req_received() to
 SMB_VFS_PWRITE_RECV()

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
---
 source3/smbd/vfs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 84ef9eb23c7..8036ffe5ef6 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -1782,9 +1782,11 @@ ssize_t SMB_VFS_PWRITE_RECV(struct tevent_req *req,
 		req, struct smb_vfs_call_pwrite_state);
 
 	if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
+		tevent_req_received(req);
 		return -1;
 	}
 	*vfs_aio_state = state->vfs_aio_state;
+	tevent_req_received(req);
 	return state->retval;
 }
 
-- 
2.13.6


From 516b38e9f4d78ecf5bbc14e6061a8327392628a0 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Thu, 12 Jul 2018 14:44:40 +0200
Subject: [PATCH 15/17] s3: vfs: add missing tevent_req_received() to
 SMB_VFS_FSYNC_RECV()

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
---
 source3/smbd/vfs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 8036ffe5ef6..a6f42802065 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -1877,9 +1877,11 @@ int SMB_VFS_FSYNC_RECV(struct tevent_req *req, struct vfs_aio_state *vfs_aio_sta
 		req, struct smb_vfs_call_fsync_state);
 
 	if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
+		tevent_req_received(req);
 		return -1;
 	}
 	*vfs_aio_state = state->vfs_aio_state;
+	tevent_req_received(req);
 	return state->retval;
 }
 
-- 
2.13.6


From e346ce86b97e95cd09619a57955d012cb92528cf Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Tue, 13 Mar 2018 16:17:27 +0100
Subject: [PATCH 16/17] s3: vfs: bump to version 39, Samba 4.9 will ship with
 that

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
---
 source3/include/vfs.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 4e5b7870903..8e2cbc3bc2d 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -245,6 +245,7 @@
 /* Version 37 - Rename SMB_VFS_STRICT_LOCK to
                 SMB_VFS_STRICT_LOCK_CHECK */
 /* Version 38 - Remove SMB_VFS_INIT_SEARCH_OP */
+/* Bump to version 39, Samba 4.9 will ship with that */
 /* Version 39 - Remove SMB_VFS_FSYNC
 		Only implement async versions. */
 /* Version 39 - Remove SMB_VFS_READ
-- 
2.13.6


From ffc616a097aee16e081105ada2e89053af91dc3f Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Tue, 13 Mar 2018 16:17:27 +0100
Subject: [PATCH 17/17] s3: vfs: bump to version 40, Samba 4.10 will ship with
 that

Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
---
 source3/include/vfs.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 8e2cbc3bc2d..90d39acd3fc 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -256,8 +256,9 @@
 /* Version 39 - Remove SMB_VFS_FCHMOD_ACL - no longer used. */
 /* Version 39 - Remove struct dfree_cached_info pointer from
 		connection struct */
+/* Bump to version 40, Samba 4.10 will ship with that */
 
-#define SMB_VFS_INTERFACE_VERSION 39
+#define SMB_VFS_INTERFACE_VERSION 40
 
 /*
     All intercepted VFS operations must be declared as static functions inside module source
-- 
2.13.6



More information about the samba-technical mailing list