From: Jeremy Allison Date: Thu, 5 Mar 2020 00:39:39 +0000 (-0800) Subject: s3: VFS: vfs_aio_pthread. Move xconn into state struct (opd). X-Git-Tag: ldb-2.2.0~1489 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ddb9038fe776b1d8239e563a4c9a70b4097645f3;p=thirdparty%2Fsamba.git 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 Reviewed-by: Volker Lendecke --- diff --git a/source3/modules/vfs_aio_pthread.c b/source3/modules/vfs_aio_pthread.c index 820e1b89c44..d5919f83b3f 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. */ @@ -91,7 +92,6 @@ 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); @@ -128,15 +128,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 @@ -245,6 +238,12 @@ 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, };