1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-28 01:58:17 +03:00

s3: smbd: Allow a SHUTDOWN_CLOSE on a file with outstanding aio if there are no client connections alive.

The process is exiting now so pthreads will never complete to cause
problems.

Remove the knownfail.d/aio_outstanding entry.

Followup-bugfix for:

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jun 24 20:14:15 UTC 2020 on sn-devel-184
This commit is contained in:
Jeremy Allison 2020-06-16 15:01:49 -07:00
parent c7a4a7f103
commit 2056537320
2 changed files with 26 additions and 2 deletions

View File

@ -1,2 +0,0 @@
samba3.blackbox.aio-outstanding

View File

@ -639,12 +639,38 @@ static NTSTATUS ntstatus_keeperror(NTSTATUS s1, NTSTATUS s2)
static void assert_no_pending_aio(struct files_struct *fsp,
enum file_close_type close_type)
{
struct smbXsrv_client *client = global_smbXsrv_client;
size_t num_connections_alive;
unsigned num_requests = fsp->num_aio_requests;
if (num_requests == 0) {
return;
}
num_connections_alive = smbXsrv_client_valid_connections(client);
if (close_type == SHUTDOWN_CLOSE && num_connections_alive == 0) {
/*
* fsp->aio_requests and the contents (fsp->aio_requests[x])
* are both independently owned by fsp and are not in a
* talloc heirarchy. This allows the fsp->aio_requests array to
* be reallocated independently of the array contents so it can
* grow on demand.
*
* This means we must ensure order of deallocation
* on a SHUTDOWN_CLOSE by deallocating the fsp->aio_requests[x]
* contents first, as their destructors access the
* fsp->aio_request array. If we don't deallocate them
* first, when fsp is deallocated fsp->aio_requests
* could have been deallocated *before* its contents
* fsp->aio_requests[x], causing a crash.
*/
while (fsp->num_aio_requests != 0) {
TALLOC_FREE(fsp->aio_requests[0]);
}
return;
}
DBG_ERR("fsp->num_aio_requests=%u\n", num_requests);
smb_panic("can not close with outstanding aio requests");
return;