metze/samba/wip.git
11 months agoRevert "selftest: add some basic testing for the io_uring vfs module"
Stefan Metzmacher [Sat, 16 Sep 2023 18:14:34 +0000 (20:14 +0200)]
Revert "selftest: add some basic testing for the io_uring vfs module"

This reverts commit a0730dda352b2d09f7b9fd1e3a9791c1d61643cb.

11 months agopython/samba/tests/blackbox/smbcacls_basic.py try to make it more robust against...
Stefan Metzmacher [Thu, 12 Jan 2023 14:35:48 +0000 (15:35 +0100)]
python/samba/tests/blackbox/smbcacls_basic.py try to make it more robust against flakey tests

11 months agoRevert "source3/smbd/globals.h _vector[2]"
Stefan Metzmacher [Sat, 16 Sep 2023 13:39:54 +0000 (15:39 +0200)]
Revert "source3/smbd/globals.h _vector[2]"

This reverts commit 8dfad2585729aa483d8b0bf277b758f3ee06e3e0.

11 months agoRevert "HACK only one recvmsg..."
Stefan Metzmacher [Sat, 16 Sep 2023 13:39:54 +0000 (15:39 +0200)]
Revert "HACK only one recvmsg..."

This reverts commit f33815aa65691658f79b2531986fd22ac250ef0f.

11 months agoRevert "fix again source3/smbd/smb2_server.c v2 part2 vector2"
Stefan Metzmacher [Sat, 16 Sep 2023 13:39:54 +0000 (15:39 +0200)]
Revert "fix again source3/smbd/smb2_server.c v2 part2 vector2"

This reverts commit 892d0d9989b8bfdaf3133a7c149158dad3df454b.

11 months agoRevert "fix again source3/smbd/smb2_server.c v3 part3 vector2"
Stefan Metzmacher [Sat, 16 Sep 2023 13:39:54 +0000 (15:39 +0200)]
Revert "fix again source3/smbd/smb2_server.c v3 part3 vector2"

This reverts commit b459152dfa539b083233c30ba82a0bd2340f0f28.

11 months agofix again source3/smbd/smb2_server.c v3 part3 vector2
Stefan Metzmacher [Tue, 5 Sep 2023 14:14:22 +0000 (16:14 +0200)]
fix again source3/smbd/smb2_server.c v3 part3 vector2

11 months agofix again source3/smbd/smb2_server.c v2 part2 vector2
Stefan Metzmacher [Fri, 19 May 2023 14:03:36 +0000 (14:03 +0000)]
fix again source3/smbd/smb2_server.c v2 part2 vector2

11 months agoHACK only one recvmsg...
Stefan Metzmacher [Wed, 15 Feb 2023 09:27:21 +0000 (09:27 +0000)]
HACK only one recvmsg...

11 months agosource3/smbd/globals.h _vector[2]
Stefan Metzmacher [Fri, 2 Jun 2023 10:29:40 +0000 (12:29 +0200)]
source3/smbd/globals.h _vector[2]

11 months agosq lib/util/samba_io_uring.c
Stefan Metzmacher [Sat, 23 Sep 2023 11:00:25 +0000 (13:00 +0200)]
sq lib/util/samba_io_uring.c

11 months agoRevert "V2 P4.1: prepare smbd_smb2_flush_with_io_uring smb2srv:send_uring smb2srv...
Stefan Metzmacher [Wed, 20 Sep 2023 05:52:26 +0000 (07:52 +0200)]
Revert "V2 P4.1: prepare smbd_smb2_flush_with_io_uring smb2srv:send_uring smb2srv:send_uring_zc smb2srv:send_uring_async"

This reverts commit 3c156bc8cb2941ef050dc534ce5a89607a9c8508.

11 months agoRevert "IORING_NOTIF_USAGE_ZC_COPIED"
Stefan Metzmacher [Wed, 20 Sep 2023 05:52:14 +0000 (07:52 +0200)]
Revert "IORING_NOTIF_USAGE_ZC_COPIED"

This reverts commit 1c5de5ce14cabe7e3880e2c6b831a8214e3093a2.

11 months agoRevert "samba_io_uring_ev_hybrit_im_handler"
Stefan Metzmacher [Wed, 20 Sep 2023 05:52:14 +0000 (07:52 +0200)]
Revert "samba_io_uring_ev_hybrit_im_handler"

This reverts commit c3dbf9b168855c4bc9b523c5e5bc0fba1ae19e47.

11 months agoRevert "DEBUG SENDMSG"
Stefan Metzmacher [Wed, 20 Sep 2023 05:52:14 +0000 (07:52 +0200)]
Revert "DEBUG SENDMSG"

This reverts commit e81d9d5a53fb77df50e167036555e0d197108406.

11 months agoRevert "no IORING_SETUP_DEFER_TASKRUN"
Stefan Metzmacher [Wed, 20 Sep 2023 05:52:14 +0000 (07:52 +0200)]
Revert "no IORING_SETUP_DEFER_TASKRUN"

This reverts commit 10c0b6c04218a0ce69a5ab78aab8a5736549f738.

11 months agoRevert "Revert "DEBUG SENDMSG""
Stefan Metzmacher [Wed, 20 Sep 2023 05:52:14 +0000 (07:52 +0200)]
Revert "Revert "DEBUG SENDMSG""

This reverts commit f3b44642df4735daa3c2ef957eb8c5625181116c.

11 months agoRevert "source3/modules/vfs_io_uring.c pread noop DIRECT"
Stefan Metzmacher [Wed, 20 Sep 2023 05:52:14 +0000 (07:52 +0200)]
Revert "source3/modules/vfs_io_uring.c pread noop DIRECT"

This reverts commit f29466d41328b79c093211928248b7c4543967f6.

11 months agoRevert "Revert "source3/modules/vfs_io_uring.c pread noop DIRECT""
Stefan Metzmacher [Wed, 20 Sep 2023 05:52:14 +0000 (07:52 +0200)]
Revert "Revert "source3/modules/vfs_io_uring.c pread noop DIRECT""

This reverts commit 5db281e9ae5ba95b62377702cc31c72a62c2823e.

11 months agoRevert "source3/modules/vfs_io_uring.c pread noop DIRECT"
Stefan Metzmacher [Wed, 20 Sep 2023 04:15:45 +0000 (04:15 +0000)]
Revert "source3/modules/vfs_io_uring.c pread noop DIRECT"

This reverts commit f29466d41328b79c093211928248b7c4543967f6.

11 months agosource3/modules/vfs_io_uring.c pread noop DIRECT
Stefan Metzmacher [Wed, 20 Sep 2023 04:15:10 +0000 (04:15 +0000)]
source3/modules/vfs_io_uring.c pread noop DIRECT

11 months agoRevert "DEBUG SENDMSG"
Stefan Metzmacher [Wed, 20 Sep 2023 03:08:58 +0000 (03:08 +0000)]
Revert "DEBUG SENDMSG"

This reverts commit e81d9d5a53fb77df50e167036555e0d197108406.

11 months agono IORING_SETUP_DEFER_TASKRUN
Stefan Metzmacher [Wed, 20 Sep 2023 03:08:26 +0000 (03:08 +0000)]
no IORING_SETUP_DEFER_TASKRUN

11 months agoDEBUG SENDMSG
Stefan Metzmacher [Wed, 20 Sep 2023 03:07:50 +0000 (03:07 +0000)]
DEBUG SENDMSG

11 months agosamba_io_uring_ev_hybrit_im_handler
Stefan Metzmacher [Wed, 20 Sep 2023 03:06:53 +0000 (03:06 +0000)]
samba_io_uring_ev_hybrit_im_handler

11 months agoIORING_NOTIF_USAGE_ZC_COPIED
Stefan Metzmacher [Wed, 20 Sep 2023 02:01:19 +0000 (02:01 +0000)]
IORING_NOTIF_USAGE_ZC_COPIED

11 months agoHACK test_smb2_bench_path_contention_shared uncontented
Stefan Metzmacher [Mon, 18 Sep 2023 06:17:29 +0000 (06:17 +0000)]
HACK test_smb2_bench_path_contention_shared uncontented

11 months agolib/tevent/testsuite.c 10.000.000
Stefan Metzmacher [Thu, 13 Apr 2023 13:17:07 +0000 (13:17 +0000)]
lib/tevent/testsuite.c 10.000.000

11 months agoRevert "source4/torture/smb2/bench.c tcon/tdis"
Stefan Metzmacher [Thu, 13 Apr 2023 13:25:12 +0000 (13:25 +0000)]
Revert "source4/torture/smb2/bench.c tcon/tdis"

This reverts commit f2820e5f3d01fa536e6abd9a0b77783fc93117d3.

11 months agosource4/torture/smb2/bench.c tcon/tdis
Stefan Metzmacher [Mon, 20 Mar 2023 15:37:22 +0000 (15:37 +0000)]
source4/torture/smb2/bench.c tcon/tdis

11 months agoV2 P4.1: prepare smbd_smb2_flush_with_io_uring smb2srv:send_uring smb2srv:send_uring_...
Stefan Metzmacher [Wed, 30 Sep 2020 21:23:56 +0000 (23:23 +0200)]
V2 P4.1: prepare smbd_smb2_flush_with_io_uring smb2srv:send_uring smb2srv:send_uring_zc smb2srv:send_uring_async

11 months agosq revert IORING_OP_SENDMSG_ZC and debug
Stefan Metzmacher [Tue, 19 Sep 2023 01:23:22 +0000 (03:23 +0200)]
sq revert IORING_OP_SENDMSG_ZC and debug

11 months agosmb2_server: teardown in smbd_smb2_flush_send_queue() already
Stefan Metzmacher [Tue, 19 Sep 2023 00:49:27 +0000 (02:49 +0200)]
smb2_server: teardown in smbd_smb2_flush_send_queue() already

Moving this from smbd_smb2_flush_with_sendmsg() to smbd_smb2_flush_send_queue()
means it will also be used for io_uring in future.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agorevert IORING_OP_SENDMSG_ZC and debug
Stefan Metzmacher [Mon, 18 Sep 2023 23:48:01 +0000 (01:48 +0200)]
revert IORING_OP_SENDMSG_ZC and debug

11 months agosq io_uring.pending_zc => if (samba_io_uring_completion_pending(&e->io_uring.completi...
Stefan Metzmacher [Wed, 19 Oct 2022 11:48:51 +0000 (13:48 +0200)]
sq io_uring.pending_zc => if (samba_io_uring_completion_pending(&e->io_uring.completion) == 0) {

11 months agosq P4.1: prepare smbd_smb2_flush_with_io_uring smb2srv:send_uring smb2srv:send_uring_...
Stefan Metzmacher [Mon, 24 Oct 2022 12:02:51 +0000 (14:02 +0200)]
sq P4.1: prepare smbd_smb2_flush_with_io_uring smb2srv:send_uring smb2srv:send_uring_zc smb2srv:send_uring_async

11 months agosq P4.1: prepare smbd_smb2_flush_with_io_uring smb2srv:send_uring smb2srv:send_uring_...
Stefan Metzmacher [Tue, 27 Sep 2022 18:40:08 +0000 (20:40 +0200)]
sq P4.1: prepare smbd_smb2_flush_with_io_uring smb2srv:send_uring smb2srv:send_uring_zc smb2srv:send_uring_async

11 months agosq P4.1: prepare smbd_smb2_flush_with_io_uring smb2srv:send_uring smb2srv:send_uring_...
Stefan Metzmacher [Tue, 27 Sep 2022 17:58:08 +0000 (19:58 +0200)]
sq P4.1: prepare smbd_smb2_flush_with_io_uring smb2srv:send_uring smb2srv:send_uring_zc smb2srv:send_uring_async

11 months agoP4.1: prepare smbd_smb2_flush_with_io_uring smb2srv:send_uring smb2srv:send_uring_zc...
Stefan Metzmacher [Wed, 30 Sep 2020 21:23:56 +0000 (23:23 +0200)]
P4.1: prepare smbd_smb2_flush_with_io_uring smb2srv:send_uring smb2srv:send_uring_zc smb2srv:send_uring_async

11 months agosq P4.X: xconn->send_uring queue_entry->io_uring
Stefan Metzmacher [Tue, 27 Sep 2022 18:38:38 +0000 (20:38 +0200)]
sq P4.X: xconn->send_uring queue_entry->io_uring

11 months agoP4.X: xconn->send_uring queue_entry->io_uring
Stefan Metzmacher [Wed, 30 Sep 2020 12:01:06 +0000 (14:01 +0200)]
P4.X: xconn->send_uring queue_entry->io_uring

11 months agosource3/wscript_build smbd_base => samba-io-uring
Stefan Metzmacher [Thu, 22 Sep 2022 14:44:40 +0000 (16:44 +0200)]
source3/wscript_build smbd_base => samba-io-uring

11 months agoP4.0: source3/smbd/globals.h lib/util/samba_io_uring.h
Stefan Metzmacher [Wed, 30 Sep 2020 12:01:06 +0000 (14:01 +0200)]
P4.0: source3/smbd/globals.h lib/util/samba_io_uring.h

11 months agoxconn->smb2.request_read_state->xconn = xconn
Stefan Metzmacher [Tue, 27 Sep 2022 13:23:55 +0000 (15:23 +0200)]
xconn->smb2.request_read_state->xconn = xconn

11 months agoTODO xconn->smb2.request_read_state talloced TODO really needed ??? costs 0,1%
Stefan Metzmacher [Tue, 27 Sep 2022 11:01:14 +0000 (13:01 +0200)]
TODO xconn->smb2.request_read_state talloced TODO really needed ??? costs 0,1%

11 months agoTODO-LATER?? P2.x: smbd_smb2_send_queue->xconn
Stefan Metzmacher [Wed, 30 Sep 2020 22:06:39 +0000 (00:06 +0200)]
TODO-LATER?? P2.x: smbd_smb2_send_queue->xconn

11 months agovfs_io_uring_request_submitted,completed optimized inline
Stefan Metzmacher [Mon, 18 Sep 2023 17:21:14 +0000 (17:21 +0000)]
vfs_io_uring_request_submitted,completed optimized inline

11 months agosq source3/modules/vfs_io_uring.c samba_io_uring_completion_bypass_epoll
Stefan Metzmacher [Mon, 18 Sep 2023 07:57:11 +0000 (07:57 +0000)]
sq source3/modules/vfs_io_uring.c samba_io_uring_completion_bypass_epoll

11 months agovfs_io_uring: add "io_uring:discard_writes_to_dev_null" option for testing
Stefan Metzmacher [Mon, 19 Apr 2021 23:35:50 +0000 (23:35 +0000)]
vfs_io_uring: add "io_uring:discard_writes_to_dev_null" option for testing

We want to be able to test the overhead we have for SMB2 write calls,
which are typically bound to the filesystem/store capabilities.

11 months agoP1.6: source3/modules/vfs_io_uring.c force_async.{read,write}_threshhold
Stefan Metzmacher [Tue, 29 Sep 2020 21:09:56 +0000 (23:09 +0200)]
P1.6: source3/modules/vfs_io_uring.c force_async.{read,write}_threshhold

11 months agoP1.4: TODO FIXME io_uring:sqpoll
Stefan Metzmacher [Tue, 7 Sep 2021 22:11:56 +0000 (00:11 +0200)]
P1.4: TODO FIXME io_uring:sqpoll

11 months agoP1.3: vfs_io_uring: make use of samba_io_uring infrastructure
Stefan Metzmacher [Tue, 7 Sep 2021 15:14:48 +0000 (17:14 +0200)]
P1.3: vfs_io_uring: make use of samba_io_uring infrastructure

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agoP1.0: BUG??? vfs_io_uring: handle EINTR like EAGAIN and EBUSY
Stefan Metzmacher [Thu, 15 Apr 2021 15:33:10 +0000 (15:33 +0000)]
P1.0: BUG??? vfs_io_uring: handle EINTR like EAGAIN and EBUSY

With EINTR we should just retry as well...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agosamba_tevent_context_init try samba_io_uring_ev if available
Stefan Metzmacher [Wed, 16 Nov 2022 22:55:24 +0000 (23:55 +0100)]
samba_tevent_context_init try samba_io_uring_ev if available

11 months agosource4/torture/local/local.c call samba_io_uring_ev_register()
Stefan Metzmacher [Mon, 19 Sep 2022 23:12:11 +0000 (01:12 +0200)]
source4/torture/local/local.c call samba_io_uring_ev_register()

11 months agosamba_tevent_context_init() call samba_io_uring_ev_register()
Stefan Metzmacher [Wed, 21 Sep 2022 09:45:47 +0000 (11:45 +0200)]
samba_tevent_context_init() call samba_io_uring_ev_register()

11 months agosamba_io_uring_completion_bypass_epoll
Stefan Metzmacher [Mon, 18 Sep 2023 07:54:16 +0000 (07:54 +0000)]
samba_io_uring_completion_bypass_epoll

11 months agosamba_io_uring_completion->wait_for_poll
Stefan Metzmacher [Mon, 18 Sep 2023 07:48:39 +0000 (07:48 +0000)]
samba_io_uring_completion->wait_for_poll

11 months agolib/util/samba_io_uring.c if0 debugging code
Stefan Metzmacher [Mon, 18 Sep 2023 07:42:20 +0000 (07:42 +0000)]
lib/util/samba_io_uring.c if0 debugging code

11 months agolib/util/samba_io_uring.c syscalls as before
Stefan Metzmacher [Mon, 18 Sep 2023 07:36:38 +0000 (07:36 +0000)]
lib/util/samba_io_uring.c syscalls as before

11 months agosource4/torture/smb2/bench.c start requests after creation all connections
Stefan Metzmacher [Mon, 18 Sep 2023 06:27:33 +0000 (06:27 +0000)]
source4/torture/smb2/bench.c start requests after creation all connections

11 months agoTODO lib/util/samba_io_uring.c SAMBA_IO_URING_COMPLETION_GENERATION_SHIFT
Stefan Metzmacher [Sat, 16 Sep 2023 16:26:46 +0000 (18:26 +0200)]
TODO lib/util/samba_io_uring.c SAMBA_IO_URING_COMPLETION_GENERATION_SHIFT

11 months agosq lib/util/samba_io_uring 6.2/6.3 features
Stefan Metzmacher [Thu, 7 Sep 2023 08:50:55 +0000 (10:50 +0200)]
sq lib/util/samba_io_uring 6.2/6.3 features

11 months agosq lib/util/samba_io_uring.h
Stefan Metzmacher [Tue, 23 May 2023 05:40:21 +0000 (07:40 +0200)]
sq lib/util/samba_io_uring.h

11 months agolib/util/samba_io_uring.c _Static_assert()
Stefan Metzmacher [Wed, 8 Feb 2023 14:30:21 +0000 (15:30 +0100)]
lib/util/samba_io_uring.c _Static_assert()

11 months agolib/util/samba_io_uring.c USING_SYSTEM_TEVENT no needed
Stefan Metzmacher [Wed, 11 Jan 2023 13:47:15 +0000 (14:47 +0100)]
lib/util/samba_io_uring.c USING_SYSTEM_TEVENT no needed

11 months agolib/util/samba_io_uring.c no tevent_set_default_backend("samba_io_uring_ev_hybrit");
Stefan Metzmacher [Wed, 16 Nov 2022 22:50:03 +0000 (23:50 +0100)]
lib/util/samba_io_uring.c no tevent_set_default_backend("samba_io_uring_ev_hybrit");

io_uring_register(5, IORING_REGISTER_PROBE) and close() take a lot of time on (at least 5.4) kernels...
It's fast on 5.15 similar to all other syscalls.

13693 23:51:10.295204 syscall_0x1a9(0x20, 0x56109f1a2c00, 0x20, 0x56109eee7010, 0, 0) = 0x5 <0.000026>
13693 23:51:10.295252 mmap(NULL, 1472, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_POPULATE, 5, 0) = 0x7ff40f147000 <0.000011>
13693 23:51:10.295276 mmap(NULL, 2048, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_POPULATE, 5, 0x10000000) = 0x7ff40f146000 <0.000008>
13693 23:51:10.295296 madvise(0x7ff40f146000, 2048, MADV_DONTFORK) = 0 <0.000004>
13693 23:51:10.295312 madvise(0x7ff40f147000, 1472, MADV_DONTFORK) = 0 <0.000004>
13693 23:51:10.295345 syscall_0x1ab(0x5, 0x8, 0x56109f236150, 0x100, 0x77, 0) = -1 (errno 22) <0.011981>
...

13693 23:51:10.337035 munmap(0x7ff41b88c000, 2048) = 0 <0.000009>
13693 23:51:10.337056 munmap(0x7ff41b88d000, 1472) = 0 <0.000007>
13693 23:51:10.337074 close(3)          = 0 <0.010263>

11 months agosamba_io_uring_destructor ring->self_mem_ctx = NULL;
Stefan Metzmacher [Sat, 12 Nov 2022 17:13:58 +0000 (17:13 +0000)]
samba_io_uring_destructor ring->self_mem_ctx = NULL;

11 months agoP1.2: lib/util: add samba_io_uring.* abstraction
Stefan Metzmacher [Tue, 29 Sep 2020 21:09:59 +0000 (23:09 +0200)]
P1.2: lib/util: add samba_io_uring.* abstraction

This will allow us to use io_uring also outside of
vfs_io_uring.c, which will be converted to use this new code
in the following commits.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agothird_party: import liburing-2.4
Stefan Metzmacher [Thu, 16 Sep 2021 10:46:38 +0000 (12:46 +0200)]
third_party: import liburing-2.4

This makes it much easier to cope with
pushd third_party/liburing/ && ./update.sh 2.4; popd

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agoP1.1: wafsamba: improve CHECK_SIZEOF() to have lib= and fallback to CHECK_VALUEOF()
Stefan Metzmacher [Wed, 30 Sep 2020 11:59:15 +0000 (13:59 +0200)]
P1.1: wafsamba: improve CHECK_SIZEOF() to have lib= and fallback to CHECK_VALUEOF()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agoP0.X: s3:param: add lp_parm_bytes() it's similar to lpcfg_parm_bytes()
Stefan Metzmacher [Tue, 29 Sep 2020 21:09:55 +0000 (23:09 +0200)]
P0.X: s3:param: add lp_parm_bytes() it's similar to lpcfg_parm_bytes()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agolib/util: support SO_SNDBUFFORCE/SO_RCVBUFFORCE in "socket options"
Stefan Metzmacher [Mon, 19 Apr 2021 07:48:13 +0000 (07:48 +0000)]
lib/util: support SO_SNDBUFFORCE/SO_RCVBUFFORCE in "socket options"

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agosmb2_server: monitor connections with TEVENT_FD_ERROR
Stefan Metzmacher [Thu, 12 Jan 2023 10:35:30 +0000 (11:35 +0100)]
smb2_server: monitor connections with TEVENT_FD_ERROR

By asking for TEVENT_FD_ERROR we're able to fail early
when a connection to a client is broken.

In that case it does not make any sense to process
pending requests in the recv queue as it's not
possible to deliver the response to the client anyway.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agos3:rpc_server: make use of tstream_bsd_fail_readv_first_error(true)
Stefan Metzmacher [Thu, 12 Jan 2023 09:49:13 +0000 (10:49 +0100)]
s3:rpc_server: make use of tstream_bsd_fail_readv_first_error(true)

This avoids doing useless work in case the client connection
is already broken.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agos4:rpc_server: make use of tstream_bsd_fail_readv_first_error(true)
Stefan Metzmacher [Thu, 12 Jan 2023 09:48:22 +0000 (10:48 +0100)]
s4:rpc_server: make use of tstream_bsd_fail_readv_first_error(true)

This avoids doing useless work in case the client connection
is already broken.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agos4:service_named_pipe: make use of tstream_bsd_fail_readv_first_error(true)
Stefan Metzmacher [Thu, 12 Jan 2023 09:46:56 +0000 (10:46 +0100)]
s4:service_named_pipe: make use of tstream_bsd_fail_readv_first_error(true)

This avoids doing useless work in case the client connection
is already broken.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agolibcli/named_pipe_auth: let tstream_npa_existing_socket use tstream_bsd_fail_readv_fi...
Stefan Metzmacher [Thu, 12 Jan 2023 09:44:25 +0000 (10:44 +0100)]
libcli/named_pipe_auth: let tstream_npa_existing_socket use tstream_bsd_fail_readv_first_error(true)

This avoids doing useless work in case the client connection
is already broken.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agos4:wrepl_server: make use of tstream_bsd_fail_readv_first_error(true)
Stefan Metzmacher [Thu, 12 Jan 2023 09:46:20 +0000 (10:46 +0100)]
s4:wrepl_server: make use of tstream_bsd_fail_readv_first_error(true)

This avoids doing useless work in case the client connection
is already broken.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agos4:libcli/wrepl: make use of tstream_bsd_fail_readv_first_error(false)
Stefan Metzmacher [Thu, 12 Jan 2023 09:43:21 +0000 (10:43 +0100)]
s4:libcli/wrepl: make use of tstream_bsd_fail_readv_first_error(false)

As a client we want recv pending responses even if the server
already closed the connection.

While tstream_bsd_fail_readv_first_error(false) is the default for
tstream_bsd, the wins replication protocol is special as it has
a way to switch server and client roles on an existing tcp connection.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agos4:ntp_signd: make use of tstream_bsd_fail_readv_first_error(true)
Stefan Metzmacher [Thu, 12 Jan 2023 09:42:14 +0000 (10:42 +0100)]
s4:ntp_signd: make use of tstream_bsd_fail_readv_first_error(true)

This avoids doing useless work in case the client connection
is already broken.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agos3:libsmb: the unexpected handler use tstream_bsd_fail_readv_first_error(true)
Stefan Metzmacher [Thu, 12 Jan 2023 09:41:04 +0000 (10:41 +0100)]
s3:libsmb: the unexpected handler use tstream_bsd_fail_readv_first_error(true)

This avoids doing useless work in case the client connection
is already broken.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agos4:dns_server: make use of tstream_bsd_fail_readv_first_error(true)
Stefan Metzmacher [Thu, 12 Jan 2023 09:40:13 +0000 (10:40 +0100)]
s4:dns_server: make use of tstream_bsd_fail_readv_first_error(true)

This avoids doing useless work in case the client connection
is already broken.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agos4:ldap_server: make use of tstream_bsd_fail_readv_first_error(true)
Stefan Metzmacher [Thu, 12 Jan 2023 09:39:48 +0000 (10:39 +0100)]
s4:ldap_server: make use of tstream_bsd_fail_readv_first_error(true)

This avoids doing useless work in case the client connection
is already broken.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agos4:kdc: make use of tstream_bsd_fail_readv_first_error(true)
Stefan Metzmacher [Thu, 12 Jan 2023 09:38:53 +0000 (10:38 +0100)]
s4:kdc: make use of tstream_bsd_fail_readv_first_error(true)

This avoids doing useless work in case the client connection
is already broken.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agolib/tsocket: add tstream_bsd_fail_readv_first_error()
Stefan Metzmacher [Thu, 12 Jan 2023 09:08:56 +0000 (10:08 +0100)]
lib/tsocket: add tstream_bsd_fail_readv_first_error()

This gives the caller the option to fail immediately if
TEVENT_FD_ERROR appear even with pending bytes in the
recv queue.

Servers typically want to activate this in order to avoid
pointless work, while clients typically want to read
pending responses from the recv queue.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agolib/tsocket: make use of TEVENT_FD_ERROR in tstream_bsd_fde_handler()
Stefan Metzmacher [Wed, 11 Jan 2023 19:17:06 +0000 (20:17 +0100)]
lib/tsocket: make use of TEVENT_FD_ERROR in tstream_bsd_fde_handler()

This makes the logic introduced to fix bug #15202 simpler.

While developing this I noticed that a lot of callers
rely on the fact that they can read the pending bytes out
of the recv queue before EOF is reported.

So I changed the code handle TEVENT_FD_ERROR together with
TEVENT_FD_READ in a way that keep the existing callers happy.

In the next step we'll add a way to let callers opt-in in order
to fail immediately if TEVENT_FD_ERROR appears (even if there
are pending bytes remaining in the recv queue).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15202

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agolib/tsocket: let tstream_bsd_connect_send() use TEVENT_FD_ERROR instead of TEVENT_FD_READ
Stefan Metzmacher [Wed, 11 Jan 2023 19:15:33 +0000 (20:15 +0100)]
lib/tsocket: let tstream_bsd_connect_send() use TEVENT_FD_ERROR instead of TEVENT_FD_READ

This mostly cosmetic, but now that we have TEVENT_FD_ERROR we should use it.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agolib/async_req: let writev_send/recv use TEVENT_FD_ERROR
Stefan Metzmacher [Thu, 12 Jan 2023 11:54:33 +0000 (12:54 +0100)]
lib/async_req: let writev_send/recv use TEVENT_FD_ERROR

Unless err_on_readability is true, we use TEVENT_FD_READ only
to detect errors. Now that we have TEVENT_FD_ERROR we should use it.

As a side effect it makes the code much simpler and clearer, as
we can directly map TEVENT_FD_ERROR to EPIPE.

In addition the err_on_readability=true case is now also
clearer, where we just map TEVENT_FD_READ to EPIPE.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agolib/async_req: let async_connect_send use TEVENT_FD_ERROR instead of TEVENT_FD_READ
Stefan Metzmacher [Wed, 11 Jan 2023 19:04:26 +0000 (20:04 +0100)]
lib/async_req: let async_connect_send use TEVENT_FD_ERROR instead of TEVENT_FD_READ

This mostly cosmetic, but now that we have TEVENT_FD_ERROR we should use it.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agolib/tsocket: make use of samba_socket_sock_error()
Stefan Metzmacher [Thu, 12 Jan 2023 10:35:11 +0000 (11:35 +0100)]
lib/tsocket: make use of samba_socket_sock_error()

This is nicer than calling getsockopt(state->fd, SOL_SOCKET, SO_ERROR)
directly.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agolib/tsocket: make use of samba_socket_poll_or_sock_error()
Stefan Metzmacher [Thu, 12 Jan 2023 10:35:11 +0000 (11:35 +0100)]
lib/tsocket: make use of samba_socket_poll_or_sock_error()

This is just a copy of the existing code...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agolib/util: add samba_socket_{poll,sock,poll_or_sock}_error()
Stefan Metzmacher [Thu, 12 Jan 2023 10:14:06 +0000 (11:14 +0100)]
lib/util: add samba_socket_{poll,sock,poll_or_sock}_error()

These are copies of the static functions in lib/tsocket/tsocket_bsd.c,
which we will replace in the next commit.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 months agos4/torture: fix exit status of raw.bench-lookup
Oleg Kravtsov [Fri, 6 Oct 2023 09:20:05 +0000 (12:20 +0300)]
s4/torture: fix exit status of raw.bench-lookup

Use correct value of 'result' when the test passes.

Signed-off-by: Oleg Kravtsov <oleg@tuxera.com>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Oct 16 02:01:17 UTC 2023 on atb-devel-224

11 months agogpdupate: Implement Drive Maps Client Side Extension
David Mulder [Fri, 10 Mar 2023 21:30:17 +0000 (14:30 -0700)]
gpdupate: Implement Drive Maps Client Side Extension

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agogpupdate: Test Drive Maps Client Side Extension
David Mulder [Fri, 10 Mar 2023 21:29:24 +0000 (14:29 -0700)]
gpupdate: Test Drive Maps Client Side Extension

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
11 months agotevent: version 0.16.0 samba-upstream/tags/tevent-0.16.0
Stefan Metzmacher [Wed, 19 Jul 2023 21:04:01 +0000 (23:04 +0200)]
tevent: version 0.16.0

- the epoll backend is no longer limited to 2 event handlers
  per low level fd.
- finally add support for TEVENT_FD_ERROR

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Oct 13 10:45:51 UTC 2023 on atb-devel-224

11 months agotevent: add support for TEVENT_FD_ERROR
Stefan Metzmacher [Wed, 13 Jul 2011 07:46:26 +0000 (09:46 +0200)]
tevent: add support for TEVENT_FD_ERROR

After 12 years we finally got TEVENT_FD_ERROR support :-)

TEVENT_FD_WRITE event handlers never get errors reported
instead the event handler is silently disabled.
There are likely callers relying on that behavior, so
we are not able to chance it.

Now TEVENT_FD_WRITE can be used together with TEVENT_FD_ERROR
in order to get errors reported without waiting for TEVENT_FD_READ.

TEVENT_FD_ERROR can also be used alone in order to detect errors
on sockets in order to cleanup resources.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
11 months agotevent: add test_event_fd3
Stefan Metzmacher [Wed, 28 Dec 2022 15:54:24 +0000 (16:54 +0100)]
tevent: add test_event_fd3

The tests the interaction of multiple event handlers on
the same low level fd.

It shows that poll and epoll backends behave in the
same fair way.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
11 months agotevent: add test_fd_speed3
Stefan Metzmacher [Mon, 24 Apr 2023 14:37:38 +0000 (14:37 +0000)]
tevent: add test_fd_speed3

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>