[SCM] Samba Shared Repository - branch v4-12-test updated
Karolin Seeger
kseeger at samba.org
Tue Apr 7 09:37:03 UTC 2020
The branch, v4-12-test has been updated
via d0ca4d173cd testprogs: Add 'net ads join createupn' test also verifying the keytab
via dacbd35a11b s3:libads: Fix ads_get_upn()
via d6d93329b4c smbd: let delayed update handler also update on-disk timestamps
via 6d3279d01d9 smbd: let mark_file_modified() always call trigger_write_time_update()
via f09cb423ec6 torture/smb2: delayed timestamp updates test: more then one write
via 92b0555fcd7 torture/smb2: delayed timestamp update test: single write
via bd89299d2f7 smbd: remove stat call from mark_file_modified()
via 58723f78af0 s3: tests: Add samba3.blackbox.force-close-share
via a108dece4fb smbd: enforce AIO requests draining
via 680157b5338 s3: smbd: Remove file_close_pid().
via 824bc7f7f5b s3: smbd: Remove old synchronous SMB1 reply_exit().
via 2b32fdde692 s3: smbd: Add async internals of reply_exit().
via 83b4482828b s3: smbd: Remove old synchronous SMB1 reply_ulogoffX().
via aa58b41b8b9 s3: smbd: reply_ulogoffX() Update to modern coding standards.
via b619e2042a4 s3: smbd: In reply_ulogoffX(), replace req -> smb1req.
via f6bb69d9215 s3: smbd: Add async internals of reply_ulogoffX.
via 999a14c5cb7 s3: smbd: Remove old synchronous SMB1 reply_tdis().
via c613e113dbe s3: smbd: reply_tdis() Update to modern coding standards.
via 01450dece21 s3: smbd: In reply_tdis(), replace req -> smb1req.
via 83eace543fa s3: smbd: Add async internals of reply_tdis().
via b22e8c8c411 s3: smbd: Replace synchronous conn_force_tdis() with the async version.
via 97e136880ef s3: smbd: Add async internals of conn_force_tdis().
via 044cf379e54 s3: smbd: Don't allow force disconnect of a connection already being disconnected.
via efc902b29ee s3: smbd: Every place we check fsp->deferred_close, also check for fsp->closing.
via 49d50bedb8f s3: smbd: In async SMB1 reply_close() set fsp->closing = true, as we already do in SMB2 async close.
via 1ad202440c5 s3: smbd: Now we free fsp->aio_requests when it gets zero entries, talloc in chunks of 10 instead of 1.
via 8a6dc998ec6 s3: smbd: In aio_del_req_from_fsp() talloc_free(fsp->aio_requests[]) when fsp->num_aio_requests reaches zero.
via bb646d6b5b8 s3: VFS: vfs_aio_pthread: Make aio opens safe against connection teardown.
via ef91325978d s3: VFS: vfs_aio_pthread: Add a talloc context parameter to create_private_open_data().
via 35583c7b80c s3: VFS: vfs_aio_pthread. Move xconn into state struct (opd).
via addd33f6880 s3: VFS: vfs_aio_pthread: Replace state destructor with explicitly called teardown function.
via 7c6a0354736 s3: VFS: vfs_aio_pthread. Fix leak of state struct on error.
via 24ab1b46af3 smbd: avoid double chdir() in chdir_current_service()
via 8935fe7e034 torture/smb2: Windows 2019 15 ms timestamp resolution
via f6497e769ac smbd: flush pending writetime update when setting timestamps file
via a8b94620302 smbd: flush pending writetime update when flushing file
via 8d05e789320 smbd: always flush pending write time update when setting filesize
via f79e39158db torture/smb2: add a test verifying a setinfo(basicinfo) flushes a pending writetime update
via 6c7b69c7f2b torture/smb2: add a test verifying a flush flushes a pending writetime update
via 2d21f3c4b38 torture/smb2: mtime update logic with 2 handles: write io on handle 1, then set mtime on handle 2
via be695ae6e0e s4/torture: fix a timestamps test to work on ext filesystem
from a3157b958bf VERSION: Bump version up to 4.12.2...
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-12-test
- Log -----------------------------------------------------------------
commit d0ca4d173cd2153c7e2a25da22d712e89493c4db
Author: Andreas Schneider <asn at samba.org>
Date: Fri Apr 3 15:40:48 2020 +0200
testprogs: Add 'net ads join createupn' test also verifying the keytab
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14336
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Alexander Bokovoy <ab at samba.org>
Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Mon Apr 6 19:09:53 UTC 2020 on sn-devel-184
(cherry picked from commit c4be195da2845be4f64e47883e3c911dedd90e48)
Autobuild-User(v4-12-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-12-test): Tue Apr 7 09:36:45 UTC 2020 on sn-devel-184
commit dacbd35a11bef4c59df359e2ded01b2e28b02bbb
Author: Andreas Schneider <asn at samba.org>
Date: Fri Apr 3 15:58:28 2020 +0200
s3:libads: Fix ads_get_upn()
This adds the userPrincipalName to ads_find_machine_acct() which
fetches the data for us.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14336
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Alexander Bokovoy <ab at samba.org>
(cherry picked from commit ec69752cb963ae850568d3f4905d2941e485627e)
commit d6d93329b4c2eff0c041bfd11a471c3512709594
Author: Ralph Boehme <slow at samba.org>
Date: Sun Mar 15 08:30:21 2020 +0100
smbd: let delayed update handler also update on-disk timestamps
Let delayed update handler also update on-disk timestamps by calling
trigger_write_time_update_immediate().
trigger_write_time_update_immediate() sets fsp->update_write_time_on_close to
false which prevents updating the write-time on close if there was ever only one
write to the file.
Besides resetting fsp->update_write_time_on_close and setting the on-disk timestamps
trigger_write_time_update_immediate() takes the same steps as the removed code.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14320
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu Mar 19 03:05:40 UTC 2020 on sn-devel-184
(cherry picked from commit 81c1a14e3271aeed7ed4fe6311171b19ba963555)
commit 6d3279d01d9e75514fe8b7f070b32ed5b8d9e7c5
Author: Ralph Boehme <slow at samba.org>
Date: Sun Mar 15 08:30:21 2020 +0100
smbd: let mark_file_modified() always call trigger_write_time_update()
Preperatory change: the next commit will reset fsp->update_write_time_on_close
in the event handler, so this change ensures it gets set again for any
subsequent write.
This will NOT always result in a write-time update because
trigger_write_time_update() has its own only-once logic using the internal
variable fsp->update_write_time_triggered.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14320
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 53de2da7acfc24513082190502d93306c12b7434)
commit f09cb423ec6b66313a92c12543412aa0c4bf5596
Author: Ralph Boehme <slow at samba.org>
Date: Sun Mar 15 16:46:16 2020 +0100
torture/smb2: delayed timestamp updates test: more then one write
Verify a close updates the write-time for subsequent writes after an initial
write started the delayed update logic.
This covers a scenario that will become relevant with the two subsequent
commits. The next commit:
smbd: let mark_file_modified() always call trigger_write_time_update()
ensures that trigger_write_time_update() is not only called for the first write
on a file. Without that preaparatory change, the second commit:
smbd: let delayed update handler also update on-disk timestamps
alone would cause this test to fail.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14320
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 60aecca9a727555847aa1412415c5bbd927df4ff)
commit 92b0555fcd78d062fd993eb35441595f4aa96d96
Author: Ralph Boehme <slow at samba.org>
Date: Sat Mar 14 16:43:48 2020 +0100
torture/smb2: delayed timestamp update test: single write
Verify close only updates write-time when a delayed update is actually pending.
This scenario is not covered by basic.delaywrite.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14320
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 58fa7b4fd7b53d3100459a0c9c7ef4ca7481b58a)
commit bd89299d2f7ba27f65b901bbbab27677751d0d84
Author: Ralph Boehme <slow at samba.org>
Date: Sun Mar 15 15:51:18 2020 +0100
smbd: remove stat call from mark_file_modified()
This stat dates back to d03453864ab1bc5fd3b4a3abaf96176a006c102b where the call
to trigger_write_time_update() had been to the file IO codepath. It was present
there for other reasons: to setup the write-cache based on the file's size.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14320
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 2c19d27113036d607850f370bb9afd62856d671e)
commit 58723f78af08dac2959e14705f0023f5a6517a32
Author: Jeremy Allison <jra at samba.org>
Date: Tue Mar 3 13:31:18 2020 -0800
s3: tests: Add samba3.blackbox.force-close-share
Checks server stays up whilst writing to a force closed share.
Uses existing aio_delay_inject share to delay writes while
we force close the share.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Sun Mar 8 19:34:14 UTC 2020 on sn-devel-184
(cherry picked from commit bb22be08b077b7d5911ccdeb1012f4dea85647e5)
(cherry picked from commit 566658d914176c41942e3c6aba404ae369aeb123)
commit a108dece4fb11c36af321f5673097e76433c28ad
Author: Jeremy Allison <jra at samba.org>
Date: Mon Mar 2 13:11:06 2020 -0800
smbd: enforce AIO requests draining
Assert we have no aio on a close.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Combined squash of commits:
(cherry picked from commit 410e7599bd2ae9b35429f60a529bb7c4aa88df25)
(cherry picked from commit acb0b01761330864a23932f643f7ad4e3d374634)
(cherry picked from commit f94cd10a211e2eae966ba4bd26921556bbe513fc)
(cherry picked from commit 0ae4f368c6c8d2c8c7aa34069007a984055df0da)
(cherry picked from commit 86dd5a080969e14ab0d131d8cb1054ec624a41ba)
commit 680157b533808b3a09f31e703805c830e6d63349
Author: Jeremy Allison <jra at samba.org>
Date: Thu Mar 12 11:02:19 2020 -0700
s3: smbd: Remove file_close_pid().
The old synchronous reply_exit() was the only user.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 584933439c70af3d2fd047e62a3456c1c2eca45e)
commit 824bc7f7f5b8ce13e82a79d75b2550e239f60445
Author: Jeremy Allison <jra at samba.org>
Date: Thu Mar 12 11:01:05 2020 -0700
s3: smbd: Remove old synchronous SMB1 reply_exit().
SMB1 exit is now fully async.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 1de0daa715f3324e3620ae8152b7fbaeb40ee9d9)
commit 2b32fdde6929bcac49e9168a64c47a6bb31cd67b
Author: Jeremy Allison <jra at samba.org>
Date: Thu Mar 12 10:59:16 2020 -0700
s3: smbd: Add async internals of reply_exit().
Waits until all aio requests on all fsp's owned by this
vuid are finished before returning to the client.
Charges the profile time in the done function. Not strictly
correct but better than the other SMB1 async code that
double-charges profiling in both send and done at the
moment.
Done this way (commented out) so it is a clean
diff and it's clear what is being added.
A later commit will remove the old synchronous version.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 8f58feab58afbc7aa214fac2a1728dda68303c6b)
commit 83b4482828bba83a4b28994e59ed9aa7aa188e83
Author: Jeremy Allison <jra at samba.org>
Date: Thu Mar 12 10:19:31 2020 -0700
s3: smbd: Remove old synchronous SMB1 reply_ulogoffX().
SMB1 user logoff is now fully async.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 446b64ca66591d8ae5b4bf1aabdd46a1e8cb1c1c)
commit aa58b41b8b91f8b80ca505980d6809ff67ddbee9
Author: Jeremy Allison <jra at samba.org>
Date: Thu Mar 12 10:16:42 2020 -0700
s3: smbd: reply_ulogoffX() Update to modern coding standards.
Minimizes the diff in the later commits.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 9cda76ad29db0cfbffa3dbb0764ec5dda24490f9)
commit b619e2042a436e40ee445db102701c9dc9515492
Author: Jeremy Allison <jra at samba.org>
Date: Thu Mar 12 10:15:10 2020 -0700
s3: smbd: In reply_ulogoffX(), replace req -> smb1req.
Minimises the diff in later commits.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 5c073aa01b304f54a0039d9cd9dc74123191eb4b)
commit f6bb69d9215390ab2fd6ec689cb4afacf7e902bd
Author: Jeremy Allison <jra at samba.org>
Date: Thu Mar 12 10:11:14 2020 -0700
s3: smbd: Add async internals of reply_ulogoffX.
Waits until all aio requests on all fsp's owned by this
vuid are finished before returning to the client.
Charges the profile time in the done function. Not strictly
correct but better than the other SMB1 async code that
double-charges profiling in both send and done at the
moment.
Done this way (commented out) so it is a clean
diff and it's clear what is being added.
A later commit will remove the old synchronous version.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 4dd3012cb1b5e000ccf68d2601dbdbcb7ff538b5)
commit 999a14c5cb75006fee4ccd162b073347ad8456fd
Author: Jeremy Allison <jra at samba.org>
Date: Thu Mar 12 10:03:27 2020 -0700
s3: smbd: Remove old synchronous SMB1 reply_tdis().
SMB1 tree disconnect is now fully async.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 7613998e10c5f13c896667257fdef33824a45d2a)
commit c613e113dbe176e1bfc1e358cc7ba1e5d23af135
Author: Jeremy Allison <jra at samba.org>
Date: Thu Mar 12 09:59:47 2020 -0700
s3: smbd: reply_tdis() Update to modern coding standards.
Minimizes the diff in the next commit.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 71725f1c4adaa04ef04c0dd400c49399952ef5fa)
commit 01450dece2162d13a79cfeaa30220e17acf6fe38
Author: Jeremy Allison <jra at samba.org>
Date: Thu Mar 12 09:55:30 2020 -0700
s3: smbd: In reply_tdis(), replace req -> smb1req.
Minimises the diff in the next commit.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit ca4521f1dd97bc5a05e381c652b05ae1eb8bd29b)
commit 83eace543fad81b19a807c1da6490d508ed9798e
Author: Jeremy Allison <jra at samba.org>
Date: Thu Mar 12 09:51:53 2020 -0700
s3: smbd: Add async internals of reply_tdis().
Waits until all aio requests on all fsp's under this
conn struct are finished before returning to the client.
Charges the profile time in the done function. Not strictly
correct but better than the other SMB1 async code that
double-charges profiling in both send and done at the
moment.
Done this way (commented out) so it is a clean
diff and it's clear what is being added.
A later commit will remove the old synchronous version.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 86cc67d5a7de0a81131b11447dad57b2681d8e01)
commit b22e8c8c411cc34c1d0a4304cb50f6032fcbd861
Author: Jeremy Allison <jra at samba.org>
Date: Thu Mar 12 09:47:26 2020 -0700
s3: smbd: Replace synchronous conn_force_tdis() with the async version.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 7891302ab8eeba8261b92171a4d429e2f538b89a)
commit 97e136880efb0d5e4d579300f137599287e9792b
Author: Jeremy Allison <jra at samba.org>
Date: Thu Mar 12 09:28:21 2020 -0700
s3: smbd: Add async internals of conn_force_tdis().
Commented out so it can be seen complete as
a diff. The next commit will replace the old
synchronous conn_force_tdis() code with the
new async code.
Uses a wait_queue to cause the force close
requests to stay pending until all outstanding
aio is finished on all file handles opened
on the connection.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 4f9e0459cd06f0332083a4a465f49b5f258838fa)
commit 044cf379e541b574a2782945a607578e9687c279
Author: Jeremy Allison <jra at samba.org>
Date: Tue Mar 10 12:25:58 2020 -0700
s3: smbd: Don't allow force disconnect of a connection already being disconnected.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit ac800ca6bcb43c74a1a6ef508b900e2e6cb532dc)
commit efc902b29eee6085a5ea7862cf04bf737c7b5b87
Author: Jeremy Allison <jra at samba.org>
Date: Wed Mar 11 15:16:35 2020 -0700
s3: smbd: Every place we check fsp->deferred_close, also check for fsp->closing.
Eventually this will allow us to remove fsp->deferred_close
from the fsp struct (and also source3/lib/tevent_wait.[ch]).
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 4287ea138e82103cce0a939e504f9810636b4747)
commit 49d50bedb8f683b3e620f81ddacacd5d40ab50b9
Author: Jeremy Allison <jra at samba.org>
Date: Wed Mar 11 17:25:59 2020 -0700
s3: smbd: In async SMB1 reply_close() set fsp->closing = true, as we already do in SMB2 async close.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit b7d09b30ad14d51bbcbe368a11348754121f6ff8)
commit 1ad202440c5469a1855af416575bd0593d1a1344
Author: Jeremy Allison <jra at samba.org>
Date: Wed Mar 11 14:47:50 2020 -0700
s3: smbd: Now we free fsp->aio_requests when it gets zero entries, talloc in chunks of 10 instead of 1.
Prevents incremental +1 tallocs, and the original
idea of this array was that it wasn't freed for
io efficiency reasons. Add paranoia integer wrap
protection also.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit b90bc0f28918133badbf6810d5e298fc326bd1aa)
commit 8a6dc998ec6da2bfa19aea8b4060f27a1d2f11b9
Author: Jeremy Allison <jra at samba.org>
Date: Tue Mar 10 10:55:22 2020 -0700
s3: smbd: In aio_del_req_from_fsp() talloc_free(fsp->aio_requests[]) when fsp->num_aio_requests reaches zero.
The add code in aio_add_req_to_fsp() re-tallocs
this array on demand, and talloc freeing it here
allows it to be used as the parent for a tevent
wait queue, so callers can get notified when
all outstanding aio on an fsp is finished.
We'll deal with any performance issues in
the next commit.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
(cherry picked from commit 0c952bba1edf7c8173d05ccdc6fdaa7232d2c6aa)
commit bb646d6b5b8b08635720cf296de44b8e1bc4da42
Author: Jeremy Allison <jra at samba.org>
Date: Thu Mar 5 10:22:00 2020 -0800
s3: VFS: vfs_aio_pthread: Make aio opens safe against connection teardown.
Allocate state off fsp->conn, not NULL, and add a destructor
that catches deallocation of conn which happens
on connection shutdown or force close.
Note - We don't allocate off fsp as the passed in
fsp will get freed once we return EINPROGRESS/NT_STATUS_MORE_PROCESSING_REQUIRED.
A new fsp pointer gets allocated on every re-run of the
open code path.
The destructor allows us to NULL out the saved conn struct pointer
when conn is deallocated so we know not to access deallocated memory.
This matches the async teardown code changes for bug #14301
in pread/pwrite/fsync vfs_default.c and vfs_glusterfs.c
state is still correctly deallocated in all code
paths so no memory leaks.
This allows us to safely complete when the openat()
returns and then return the error NT_STATUS_NETWORK_NAME_DELETED
to the client open request.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 6b567e0c138d1cf2bcf58c84872ed2b0e89d628d)
commit ef91325978d38adc2ad05d095939fdec424c77e1
Author: Jeremy Allison <jra at samba.org>
Date: Fri Mar 6 09:30:26 2020 -0800
s3: VFS: vfs_aio_pthread: Add a talloc context parameter to create_private_open_data().
Pass in NULL for now so no behavior change.
We will be changing this from NULL to fsp->conn in a later commit.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit e566066605981549b670a5392683fbd81ce93d18)
commit 35583c7b80c7a5f2c82bb0579058fde2a190028d
Author: Jeremy Allison <jra at samba.org>
Date: Wed Mar 4 16:39:39 2020 -0800
s3: VFS: vfs_aio_pthread. Move xconn into state struct (opd).
We will need this in future to cause a pending open to
be rescheduled after the connection struct we're using
has been shut down with an aio open in flight. This will
allow a correct error reply to an awaiting client.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit ddb9038fe776b1d8239e563a4c9a70b4097645f3)
commit addd33f6880e5c785e2f92af3b80118abfc5baf6
Author: Jeremy Allison <jra at samba.org>
Date: Wed Mar 4 13:47:13 2020 -0800
s3: VFS: vfs_aio_pthread: Replace state destructor with explicitly called teardown function.
This will allow repurposing a real destructor to allow
connections structs to be freed whilst the aio open
request is in flight.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit 8db831a318cd4a10ec9c1d629ebff4ca35b8acfe)
commit 7c6a03547364ad04a023c79e6014321200033bb7
Author: Jeremy Allison <jra at samba.org>
Date: Wed Mar 4 13:29:08 2020 -0800
s3: VFS: vfs_aio_pthread. Fix leak of state struct on error.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
(cherry picked from commit a1e247c3ba579ecc6ee03f5aad9679ed79fac5ac)
commit 24ab1b46af32c3549fe4a52fde03007044bdca23
Author: Ralph Boehme <slow at samba.org>
Date: Wed Jan 22 10:52:39 2020 +0100
smbd: avoid double chdir() in chdir_current_service()
Since 8e81090789e4cc3ba9e5aa792d4e52971909c894 we're doing chdir() twice, first
into conn->connectpath, then into conn->origpath.
Before commit 8e81090789e4cc3ba9e5aa792d4e52971909c894 if
chdir(conn->connectpath) succeeded, we wouldn't do the second chdir().
While at it, simplify the logging logic: if chdir() fails in this core function,
just always log is as error including the unix token.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14256
RN: smbd does a chdir() twice per request
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Andreas Schneider <asn at samba.org>
Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Thu Feb 6 11:44:07 UTC 2020 on sn-devel-184
(cherry picked from commit f705629a171c1411131164f3adff36175154c093)
commit 8935fe7e0341008391dec06d2896f343f2e15e67
Author: Ralph Boehme <slow at samba.org>
Date: Fri Mar 6 16:21:47 2020 +0100
torture/smb2: Windows 2019 15 ms timestamp resolution
This test demonstrates that Windows has a timestamp resolution of ~15ms.
When a smaller amount of time than that has passed between modifying operations
on a file, it's not necessarily detectable on a Windows 2019 server that
implements immediate timestamp updates (no delayed magic).
Note that this test relies on a low latency SMB connection. Even with a low
latency connection of eg 1m there's a chance of 1/15 that the first part of the
test expecting no timestamp change fails as the writetime is updated.
Due to this timing dependency this test is skipped in Samba CI, but it is
preserved here for future SMB2 timestamps behaviour archealogists.
See also: https://lists.samba.org/archive/cifs-protocol/2019-December/003358.html
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 6f7d1d8a37bfb877b3f07423cbcffd15710e8d08)
commit f6497e769ac3ff38b23758ec90536c823febf9ee
Author: Ralph Boehme <slow at samba.org>
Date: Thu Mar 12 19:23:40 2020 +0100
smbd: flush pending writetime update when setting timestamps file
Cf the explanations in the previous commits.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14150
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 7b90fe69a865ae8648b6548eabbcf2fa8237ebd8)
commit a8b9462030296a3dff2c3bb36db5c41943d1162f
Author: Ralph Boehme <slow at samba.org>
Date: Thu Mar 12 19:23:40 2020 +0100
smbd: flush pending writetime update when flushing file
Cf the explanations in the previous commit.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14150
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit d99d5bf2c6d0a818ef2f3920e0c93fac38761c36)
commit 8d05e789320d5f091ec4216c707845f67197a692
Author: Ralph Boehme <slow at samba.org>
Date: Thu Mar 12 16:52:34 2020 +0100
smbd: always flush pending write time update when setting filesize
We need to flush a pending write time update even when we're setting the
filesize to current filesize.
Note that we're already doing it this way in the relevant places listed my
dochelp at MS in
https://lists.samba.org/archive/cifs-protocol/2019-December/003364.html
Cleanup (= Close)
SetBasicInfo
SetAllocationInfo
SetEndOfFileInfo
SetValidDataLengthInfo
Flush
FSCTL_SET_ENCRYPTION
FSCTL_OFFLOAD_WRITE
Cleanup (= Close):
Already implemented by update_write_time_on_close() and friends.
SetBasicInfo:
Currently doesn't flush pending updates. Fixed by a subsequent commit.
SetAllocationInfo:
smb_set_file_allocation_info() when setting a file's allocation size.
SetEndOfFileInfo:
Currently doesn't flush pending updates. Fixed by a subsequent commit.
SetValidDataLengthInfo:
Not implemented, returns NT_STATUS_NOT_SUPPORTED which seems wrong btw, as
SetValidDataLengthInfo IS listed in MS-SMB2 2.2.39.
Flush:
Currently doesn't flush pending updates. Fixed by subsequent commit.
FSCTL_SET_ENCRYPTION:
Windows 2016 doesn't flush a pending writetime update, verified with a
smbtorture test.
FSCTL_OFFLOAD_WRITE:
NT_STATUS_NOT_IMPLEMENTED
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14150
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 79d7d6b9d01b8547f16b74a62926d0b471f18c39)
commit f79e39158db0f11d770bf2269a284acb3dee22aa
Author: Ralph Boehme <slow at samba.org>
Date: Thu Mar 12 16:48:09 2020 +0100
torture/smb2: add a test verifying a setinfo(basicinfo) flushes a pending writetime update
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14150
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 4e3c2afbd6f12159252405f6efc6528fa9345f08)
commit 6c7b69c7f2bfc4da1353df320e125a46b6e88621
Author: Ralph Boehme <slow at samba.org>
Date: Thu Mar 12 16:48:09 2020 +0100
torture/smb2: add a test verifying a flush flushes a pending writetime update
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14150
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit c63d6c9e256cdf6a3620373ef0f595e61d43fa97)
commit 2d21f3c4b387e745b65bfc77bb003c7d3e23bb10
Author: Ralph Boehme <slow at samba.org>
Date: Fri Mar 6 11:50:57 2020 +0100
torture/smb2: mtime update logic with 2 handles: write io on handle 1, then set mtime on handle 2
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14150
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 47508c5ecf0713ef404d5226499a4269651dc020)
commit be695ae6e0e6f428771f80ac4a8d389db31e4598
Author: Ralph Boehme <slow at samba.org>
Date: Tue Mar 10 18:26:49 2020 +0100
s4/torture: fix a timestamps test to work on ext filesystem
ext filesystem has a time_t limit of 15032385535 (0x0x37fffffff). From
Documentation/filesystems/ext4/inodes.rst:
If the inode structure size ``sb->s_inode_size`` is larger than 128 bytes and
the ``i_inode_extra`` field is large enough to encompass the respective
``i_[cma]time_extra`` field, the ctime, atime, and mtime inode fields are
widened to 64 bits. Within this “extra” 32-bit field, the lower two bits are
used to extend the 32-bit seconds field to be 34 bit wide; the upper 30 bits
are used to provide nanosecond timestamp accuracy. Therefore, timestamps
should not overflow until May 2446. ...
Changing the test to use the value 0x37fffffff instead of 100000000000 allows
running the test locally on ext filesytems.
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
(cherry picked from commit 73fedf014bbe02a408360d48e35bce4a6dbc9c36)
-----------------------------------------------------------------------
Summary of changes:
selftest/skip | 2 +
source3/libads/ldap.c | 1 +
source3/modules/offload_token.c | 10 +
source3/modules/vfs_aio_pthread.c | 109 +++-
source3/script/tests/test_force_close_share.sh | 100 ++++
source3/selftest/tests.py | 9 +
source3/smbd/aio.c | 13 +-
source3/smbd/close.c | 80 +--
source3/smbd/conn_idle.c | 179 +++++-
source3/smbd/fileio.c | 17 +-
source3/smbd/files.c | 31 +-
source3/smbd/proto.h | 2 -
source3/smbd/reply.c | 650 +++++++++++++++++++--
source3/smbd/service.c | 67 +--
source3/smbd/smb2_flush.c | 7 +
source3/smbd/trans2.c | 32 +-
source4/torture/smb2/smb2.c | 1 +
source4/torture/smb2/timestamps.c | 775 ++++++++++++++++++++++++-
testprogs/blackbox/test_net_ads.sh | 17 +
19 files changed, 1869 insertions(+), 233 deletions(-)
create mode 100755 source3/script/tests/test_force_close_share.sh
Changeset truncated at 500 lines:
diff --git a/selftest/skip b/selftest/skip
index 11bf29599fa..549ba202021 100644
--- a/selftest/skip
+++ b/selftest/skip
@@ -75,6 +75,8 @@
^samba3.smb2.durable-open-disconnect # Not a test, but a way to create a disconnected durable
^samba3.smb2.scan # No tests
^samba3.smb2.oplock.levelii501 # No test yet
+^samba3.smb2.timestamp_resolution # See the comment on the test
+^samba4.smb2.timestamp_resolution
^samba3.rpc.samr.passwords.lockout\(ad_dc\) # No point running this version, it just waits 12 times longer the samba4 version of this test, covering the same code
^samba4.base.iometer
^samba4.base.casetable
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index a630c5a0345..f0fcf9fcd56 100755
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -1373,6 +1373,7 @@ char *ads_parent_dn(const char *dn)
"userAccountControl",
"DnsHostName",
"ServicePrincipalName",
+ "userPrincipalName",
"unicodePwd",
/* Additional attributes Samba checks */
diff --git a/source3/modules/offload_token.c b/source3/modules/offload_token.c
index 3fb84dabdff..03bb3309f38 100644
--- a/source3/modules/offload_token.c
+++ b/source3/modules/offload_token.c
@@ -280,6 +280,16 @@ NTSTATUS vfs_offload_token_check_handles(uint32_t fsctl,
return NT_STATUS_ACCESS_DENIED;
}
+ if (src_fsp->closing) {
+ DBG_INFO("copy chunk src handle with closing in progress.\n");
+ return NT_STATUS_ACCESS_DENIED;
+ }
+
+ if (dst_fsp->closing) {
+ DBG_INFO("copy chunk dst handle with closing in progress.\n");
+ return NT_STATUS_ACCESS_DENIED;
+ }
+
if (src_fsp->is_directory) {
DBG_INFO("copy chunk no read on src directory handle (%s).\n",
smb_fname_str_dbg(src_fsp->fsp_name));
diff --git a/source3/modules/vfs_aio_pthread.c b/source3/modules/vfs_aio_pthread.c
index d13ce2fdc63..1ccf89a6d8c 100644
--- a/source3/modules/vfs_aio_pthread.c
+++ b/source3/modules/vfs_aio_pthread.c
@@ -51,6 +51,7 @@ struct aio_open_private_data {
const char *fname;
char *dname;
connection_struct *conn;
+ struct smbXsrv_connection *xconn;
const struct security_unix_token *ux_tok;
uint64_t initial_allocation_size;
/* Returns. */
@@ -62,6 +63,7 @@ struct aio_open_private_data {
static struct aio_open_private_data *open_pd_list;
static void aio_open_do(struct aio_open_private_data *opd);
+static void opd_free(struct aio_open_private_data *opd);
/************************************************************************
Find the open private data by mid.
@@ -90,10 +92,40 @@ static void aio_open_handle_completion(struct tevent_req *subreq)
tevent_req_callback_data(subreq,
struct aio_open_private_data);
int ret;
- struct smbXsrv_connection *xconn;
ret = pthreadpool_tevent_job_recv(subreq);
TALLOC_FREE(subreq);
+
+ /*
+ * We're no longer in flight. Remove the
+ * destructor used to preserve opd so
+ * a talloc_free actually removes it.
+ */
+ talloc_set_destructor(opd, NULL);
+
+ if (opd->conn == NULL) {
+ /*
+ * We were shutdown closed in flight. No one
+ * wants the result, and state has been reparented
+ * to the NULL context, so just free it so we
+ * don't leak memory.
+ */
+ DBG_NOTICE("aio open request for %s/%s abandoned in flight\n",
+ opd->dname,
+ opd->fname);
+ if (opd->ret_fd != -1) {
+ close(opd->ret_fd);
+ opd->ret_fd = -1;
+ }
+ /*
+ * Find outstanding event and reschedule so the client
+ * gets an error message return from the open.
+ */
+ schedule_deferred_open_message_smb(opd->xconn, opd->mid);
+ opd_free(opd);
+ return;
+ }
+
if (ret != 0) {
bool ok;
@@ -127,15 +159,8 @@ static void aio_open_handle_completion(struct tevent_req *subreq)
opd->in_progress = false;
- /*
- * TODO: In future we need a proper algorithm
- * to find the correct connection for a fsp.
- * For now we only have one connection, so this is correct...
- */
- xconn = opd->conn->sconn->client->connections;
-
/* Find outstanding event and reschedule. */
- if (!schedule_deferred_open_message_smb(xconn, opd->mid)) {
+ if (!schedule_deferred_open_message_smb(opd->xconn, opd->mid)) {
/*
* Outstanding event didn't exist or was
* cancelled. Free up the fd and throw
@@ -145,7 +170,7 @@ static void aio_open_handle_completion(struct tevent_req *subreq)
close(opd->ret_fd);
opd->ret_fd = -1;
}
- TALLOC_FREE(opd);
+ opd_free(opd);
}
}
@@ -207,27 +232,28 @@ static void aio_open_do(struct aio_open_private_data *opd)
}
/************************************************************************
- Open private data destructor.
+ Open private data teardown.
***********************************************************************/
-static int opd_destructor(struct aio_open_private_data *opd)
+static void opd_free(struct aio_open_private_data *opd)
{
if (opd->dir_fd != -1) {
close(opd->dir_fd);
}
DLIST_REMOVE(open_pd_list, opd);
- return 0;
+ TALLOC_FREE(opd);
}
/************************************************************************
Create and initialize a private data struct for async open.
***********************************************************************/
-static struct aio_open_private_data *create_private_open_data(const files_struct *fsp,
+static struct aio_open_private_data *create_private_open_data(TALLOC_CTX *ctx,
+ const files_struct *fsp,
int flags,
mode_t mode)
{
- struct aio_open_private_data *opd = talloc_zero(NULL,
+ struct aio_open_private_data *opd = talloc_zero(ctx,
struct aio_open_private_data);
const char *fname = NULL;
@@ -244,13 +270,19 @@ static struct aio_open_private_data *create_private_open_data(const files_struct
.mid = fsp->mid,
.in_progress = true,
.conn = fsp->conn,
+ /*
+ * TODO: In future we need a proper algorithm
+ * to find the correct connection for a fsp.
+ * For now we only have one connection, so this is correct...
+ */
+ .xconn = fsp->conn->sconn->client->connections,
.initial_allocation_size = fsp->initial_allocation_size,
};
/* Copy our current credentials. */
opd->ux_tok = copy_unix_token(opd, get_current_utok(fsp->conn));
if (opd->ux_tok == NULL) {
- TALLOC_FREE(opd);
+ opd_free(opd);
return NULL;
}
@@ -262,12 +294,12 @@ static struct aio_open_private_data *create_private_open_data(const files_struct
fsp->fsp_name->base_name,
&opd->dname,
&fname) == false) {
- TALLOC_FREE(opd);
+ opd_free(opd);
return NULL;
}
opd->fname = talloc_strdup(opd, fname);
if (opd->fname == NULL) {
- TALLOC_FREE(opd);
+ opd_free(opd);
return NULL;
}
@@ -277,15 +309,30 @@ static struct aio_open_private_data *create_private_open_data(const files_struct
opd->dir_fd = open(opd->dname, O_RDONLY);
#endif
if (opd->dir_fd == -1) {
- TALLOC_FREE(opd);
+ opd_free(opd);
return NULL;
}
- talloc_set_destructor(opd, opd_destructor);
DLIST_ADD_END(open_pd_list, opd);
return opd;
}
+static int opd_inflight_destructor(struct aio_open_private_data *opd)
+{
+ /*
+ * Setting conn to NULL allows us to
+ * discover the connection was torn
+ * down which kills the fsp that owns
+ * opd.
+ */
+ DBG_NOTICE("aio open request for %s/%s cancelled\n",
+ opd->dname,
+ opd->fname);
+ opd->conn = NULL;
+ /* Don't let opd go away. */
+ return -1;
+}
+
/*****************************************************************
Setup an async open.
*****************************************************************/
@@ -297,7 +344,18 @@ static int open_async(const files_struct *fsp,
struct aio_open_private_data *opd = NULL;
struct tevent_req *subreq = NULL;
- opd = create_private_open_data(fsp, flags, mode);
+ /*
+ * Allocate off fsp->conn, not NULL or fsp. As we're going
+ * async fsp will get talloc_free'd when we return
+ * EINPROGRESS/NT_STATUS_MORE_PROCESSING_REQUIRED. A new fsp
+ * pointer gets allocated on every re-run of the
+ * open code path. Allocating on fsp->conn instead
+ * of NULL allows use to get notified via destructor
+ * if the conn is force-closed or we shutdown.
+ * opd is always safely freed in all codepath so no
+ * memory leaks.
+ */
+ opd = create_private_open_data(fsp->conn, fsp, flags, mode);
if (opd == NULL) {
DEBUG(10, ("open_async: Could not create private data.\n"));
return -1;
@@ -308,6 +366,7 @@ static int open_async(const files_struct *fsp,
fsp->conn->sconn->pool,
aio_open_worker, opd);
if (subreq == NULL) {
+ opd_free(opd);
return -1;
}
tevent_req_set_callback(subreq, aio_open_handle_completion, opd);
@@ -317,6 +376,12 @@ static int open_async(const files_struct *fsp,
opd->dname,
opd->fname));
+ /*
+ * Add a destructor to protect us from connection
+ * teardown whilst the open thread is in flight.
+ */
+ talloc_set_destructor(opd, opd_inflight_destructor);
+
/* Cause the calling code to reschedule us. */
errno = EINPROGRESS; /* Maps to NT_STATUS_MORE_PROCESSING_REQUIRED. */
return -1;
@@ -364,7 +429,7 @@ static bool find_completed_open(files_struct *fsp,
smb_fname_str_dbg(fsp->fsp_name)));
/* Now we can free the opd. */
- TALLOC_FREE(opd);
+ opd_free(opd);
return true;
}
diff --git a/source3/script/tests/test_force_close_share.sh b/source3/script/tests/test_force_close_share.sh
new file mode 100755
index 00000000000..da78b5a752e
--- /dev/null
+++ b/source3/script/tests/test_force_close_share.sh
@@ -0,0 +1,100 @@
+#!/bin/bash
+#
+# Test smbcontrol close-share command.
+#
+# Copyright (C) 2020 Volker Lendecke
+# Copyright (C) 2020 Jeremy Allison
+#
+# Note this is designed to be run against
+# the aio_delay_inject share which is preconfigured
+# with 2 second delays on pread/pwrite.
+
+if [ $# -lt 5 ]; then
+ echo Usage: test_share_force_close.sh \
+ SERVERCONFFILE SMBCLIENT SMBCONTROL IP aio_delay_inject_sharename
+exit 1
+fi
+
+CONF=$1
+SMBCLIENT=$2
+SMBCONTROL=$3
+SERVER=$4
+SHARE=$5
+
+incdir=$(dirname $0)/../../../testprogs/blackbox
+. $incdir/subunit.sh
+
+failed=0
+
+# Create the smbclient communication pipes.
+rm -f smbclient-stdin smbclient-stdout smbclient-stderr
+mkfifo smbclient-stdin smbclient-stdout smbclient-stderr
+
+# Create a large-ish testfile
+rm testfile
+head -c 20MB /dev/zero >testfile
+
+CLI_FORCE_INTERACTIVE=1; export CLI_FORCE_INTERACTIVE
+
+${SMBCLIENT} //${SERVER}/${SHARE} ${CONF} -U${USER}%${PASSWORD} \
+ < smbclient-stdin > smbclient-stdout 2>smbclient-stderr &
+CLIENT_PID=$!
+
+sleep 1
+
+exec 100>smbclient-stdin 101<smbclient-stdout 102<smbclient-stderr
+
+# consume the smbclient startup messages
+head -n 1 <&101
+head -n 1 <&102
+
+# Ensure we're putting a fresh file.
+echo "del testfile" >&100
+echo "put testfile" >&100
+
+sleep 1
+
+# Close the aio_delay_inject share whilst we have outstanding writes.
+
+testit "smbcontrol" ${SMBCONTROL} ${CONF} smbd close-share ${SHARE} ||
+ failed=$(expr $failed + 1)
+
+sleep 1
+
+# If we get one or more NT_STATUS_NETWORK_NAME_DELETED
+# or NT_STATUS_INVALID_HANDLE on stderr from the writes we
+# know the server stayed up and didn't crash when the
+# close-share removed the share.
+#
+# BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
+#
+COUNT=$(head -n 2 <&102 |
+ grep -e NT_STATUS_NETWORK_NAME_DELETED -e NT_STATUS_INVALID_HANDLE |
+ wc -l)
+
+testit "Verify close-share did cancel the file put" \
+ test $COUNT -ge 1 || failed=$(expr $failed + 1)
+
+kill ${CLIENT_PID}
+
+# Rerun smbclient to remove the testfile on the server.
+rm -f smbclient-stdin smbclient-stdout smbclient-stderr testfile
+mkfifo smbclient-stdin smbclient-stdout
+
+${SMBCLIENT} //${SERVER}/${SHARE} ${CONF} -U${USER}%${PASSWORD} \
+ < smbclient-stdin > smbclient-stdout &
+CLIENT_PID=$!
+
+sleep 1
+
+exec 100>smbclient-stdin 101<smbclient-stdout
+
+echo "del testfile" >&100
+
+sleep 1
+
+kill ${CLIENT_PID}
+
+rm -f smbclient-stdin smbclient-stdout testfile
+
+testok $0 $failed
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index dddcb03230c..6bdbb6f97a4 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -802,6 +802,15 @@ plantestsuite("samba3.blackbox.close-denied-share", "simpleserver:local",
'$SERVER_IP',
"tmp"])
+plantestsuite("samba3.blackbox.force-close-share", "simpleserver:local",
+ [os.path.join(samba3srcdir,
+ "script/tests/test_force_close_share.sh"),
+ configuration,
+ os.path.join(bindir(), "smbclient"),
+ os.path.join(bindir(), "smbcontrol"),
+ '$SERVER_IP',
+ "aio_delay_inject"])
+
plantestsuite("samba3.blackbox.open-eintr", "simpleserver:local",
[os.path.join(samba3srcdir,
"script/tests/test_open_eintr.sh"),
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index 0f824f5aa1f..cf35f3297ec 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -103,6 +103,7 @@ static int aio_del_req_from_fsp(struct aio_req_fsp_link *lnk)
if (fsp->num_aio_requests == 0) {
tevent_wait_done(fsp->deferred_close);
+ TALLOC_FREE(fsp->aio_requests);
}
return 0;
}
@@ -121,9 +122,19 @@ bool aio_add_req_to_fsp(files_struct *fsp, struct tevent_req *req)
if (array_len <= fsp->num_aio_requests) {
struct tevent_req **tmp;
+ if (fsp->num_aio_requests + 10 < 10) {
+ /* Integer wrap. */
+ TALLOC_FREE(lnk);
+ return false;
+ }
+
+ /*
+ * Allocate in blocks of 10 so we don't allocate
+ * on every aio request.
+ */
tmp = talloc_realloc(
fsp, fsp->aio_requests, struct tevent_req *,
- fsp->num_aio_requests+1);
+ fsp->num_aio_requests+10);
if (tmp == NULL) {
TALLOC_FREE(lnk);
return false;
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index f45371e656c..d5af62a277c 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -31,6 +31,7 @@
#include "auth.h"
#include "messages.h"
#include "../librpc/gen_ndr/open_files.h"
+#include "lib/util/tevent_ntstatus.h"
/****************************************************************************
Run a file if it is a magic script.
@@ -635,6 +636,20 @@ static NTSTATUS ntstatus_keeperror(NTSTATUS s1, NTSTATUS s2)
return s2;
}
+static void assert_no_pending_aio(struct files_struct *fsp,
+ enum file_close_type close_type)
+{
+ unsigned num_requests = fsp->num_aio_requests;
+
+ if (num_requests == 0) {
+ return;
+ }
+
+ DBG_ERR("fsp->num_aio_requests=%u\n", num_requests);
+ smb_panic("can not close with outstanding aio requests");
+ return;
+}
+
/****************************************************************************
Close a file.
@@ -651,45 +666,7 @@ static NTSTATUS close_normal_file(struct smb_request *req, files_struct *fsp,
connection_struct *conn = fsp->conn;
bool is_durable = false;
- if (fsp->num_aio_requests != 0) {
-
- if (close_type != SHUTDOWN_CLOSE) {
- /*
- * reply_close and the smb2 close must have
- * taken care of this. No other callers of
- * close_file should ever have created async
- * I/O.
- *
- * We need to panic here because if we close()
- * the fd while we have outstanding async I/O
- * requests, in the worst case we could end up
- * writing to the wrong file.
- */
- DEBUG(0, ("fsp->num_aio_requests=%u\n",
- fsp->num_aio_requests));
- smb_panic("can not close with outstanding aio "
--
Samba Shared Repository
More information about the samba-cvs
mailing list