Revert "TODO: smb_request_done() aio..."
authorStefan Metzmacher <metze@samba.org>
Mon, 15 Sep 2014 00:16:57 +0000 (02:16 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 10 Feb 2020 13:50:20 +0000 (14:50 +0100)
This reverts commit 267d79bb8a9d448bb4e5df9054d7698fdbba9e61.

source3/smbd/aio.c

index 2030fa34f0a88780c2c7d07f995c5a08dec5bee8..0f824f5aa1f69171e7fb71f8c4ec099c313e4cde 100644 (file)
@@ -30,7 +30,6 @@
 *****************************************************************************/
 
 struct aio_extra {
-       uint64_t mid;
        files_struct *fsp;
        struct smb_request *smbreq;
        DATA_BLOB outbuf;
@@ -238,7 +237,6 @@ static void aio_pread_smb1_done(struct tevent_req *req)
 {
        struct aio_extra *aio_ex = tevent_req_callback_data(
                req, struct aio_extra);
-       struct smb_request *smbreq = NULL;
        files_struct *fsp = aio_ex->fsp;
        size_t outsize;
        char *outbuf = (char *)aio_ex->outbuf.data;
@@ -259,9 +257,6 @@ static void aio_pread_smb1_done(struct tevent_req *req)
                return;
        }
 
-       smbreq = talloc_move(talloc_tos(), &aio_ex->smbreq);
-       smbreq->outbuf = (char *)talloc_move(smbreq, &aio_ex->outbuf.data);
-
        if (nread < 0) {
                DEBUG( 3, ("handle_aio_read_complete: file %s nread == %d. "
                           "Error = %s\n", fsp_str_dbg(fsp), (int)nread,
@@ -290,6 +285,12 @@ static void aio_pread_smb1_done(struct tevent_req *req)
        _smb_setlen_large(outbuf, outsize);
 
        show_msg(outbuf);
+       if (!srv_send_smb(aio_ex->smbreq->xconn, outbuf,
+                         true, aio_ex->smbreq->seqnum+1,
+                         IS_CONN_ENCRYPTED(fsp->conn), NULL)) {
+               exit_server_cleanly("handle_aio_read_complete: srv_send_smb "
+                                   "failed.");
+       }
 
        DEBUG(10, ("handle_aio_read_complete: scheduled aio_read completed "
                   "for file %s, offset %.0f, len = %u\n",
@@ -297,8 +298,6 @@ static void aio_pread_smb1_done(struct tevent_req *req)
                   (unsigned int)nread));
 
        TALLOC_FREE(aio_ex);
-
-       smb_request_done(smbreq);
 }
 
 struct pwrite_fsync_state {
@@ -512,7 +511,6 @@ static void aio_pwrite_smb1_done(struct tevent_req *req)
 {
        struct aio_extra *aio_ex = tevent_req_callback_data(
                req, struct aio_extra);
-       struct smb_request *smbreq = NULL;
        files_struct *fsp = aio_ex->fsp;
        char *outbuf = (char *)aio_ex->outbuf.data;
        ssize_t numtowrite = aio_ex->nbyte;
@@ -561,9 +559,6 @@ static void aio_pwrite_smb1_done(struct tevent_req *req)
                return;
        }
 
-       smbreq = talloc_move(talloc_tos(), &aio_ex->smbreq);
-       smbreq->outbuf = (char *)talloc_move(smbreq, &aio_ex->outbuf.data);
-
        /* We don't need outsize or set_message here as we've already set the
           fixed size length when we set up the aio call. */
 
@@ -590,6 +585,13 @@ static void aio_pwrite_smb1_done(struct tevent_req *req)
        }
 
        show_msg(outbuf);
+       if (!srv_send_smb(aio_ex->smbreq->xconn, outbuf,
+                         true, aio_ex->smbreq->seqnum+1,
+                         IS_CONN_ENCRYPTED(fsp->conn),
+                         NULL)) {
+               exit_server_cleanly("handle_aio_write_complete: "
+                                   "srv_send_smb failed.");
+       }
 
        DEBUG(10, ("handle_aio_write_complete: scheduled aio_write completed "
                   "for file %s, offset %.0f, requested %u, written = %u\n",
@@ -597,8 +599,6 @@ static void aio_pwrite_smb1_done(struct tevent_req *req)
                   (unsigned int)numtowrite, (unsigned int)nwritten));
 
        TALLOC_FREE(aio_ex);
-
-       smb_request_done(smbreq);
 }
 
 bool cancel_smb2_aio(struct smb_request *smbreq)