]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: vfs_aio_pthread. Move xconn into state struct (opd).
authorJeremy Allison <jra@samba.org>
Thu, 5 Mar 2020 00:39:39 +0000 (16:39 -0800)
committerJeremy Allison <jra@samba.org>
Sun, 8 Mar 2020 18:07:44 +0000 (18:07 +0000)
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@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/modules/vfs_aio_pthread.c

index 820e1b89c44a3676123964df2cf7f0e3e7149358..d5919f83b3f16d00255567e85866baf2d7b0268d 100644 (file)
@@ -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,
        };