The branch, master has been updated
       via  096a3d3... Make aio_ex owned by a talloc context, not neccessarily 
on the null context.
       via  d70413f... Move "write_though" into aio_ex struct.
      from  5da783f... s3:smbd add utility function to check if there are open 
pipes

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 096a3d3eea60d514a5d8fe8a35b3e463238b3766
Author: Jeremy Allison <j...@samba.org>
Date:   Mon Jun 7 16:26:30 2010 -0700

    Make aio_ex owned by a talloc context, not neccessarily on the null context.

commit d70413fa0cba9338fbf2adad0db6e4b88da9ad65
Author: Jeremy Allison <j...@samba.org>
Date:   Mon Jun 7 16:25:18 2010 -0700

    Move "write_though" into aio_ex struct.

-----------------------------------------------------------------------

Summary of changes:
 source3/smbd/aio.c |   30 +++++++++++++++++-------------
 1 files changed, 17 insertions(+), 13 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index ab88b12..bce95be 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -46,6 +46,7 @@ struct aio_extra {
        struct smb_request *smbreq;
        DATA_BLOB outbuf;
        struct lock_struct lock;
+       bool write_through;
        int (*handle_completion)(struct aio_extra *ex, int errcode);
 };
 
@@ -99,9 +100,11 @@ static int aio_extra_destructor(struct aio_extra *aio_ex)
  of the aio call.
 *****************************************************************************/
 
-static struct aio_extra *create_aio_extra(files_struct *fsp, size_t buflen)
+static struct aio_extra *create_aio_extra(TALLOC_CTX *mem_ctx,
+                                       files_struct *fsp,
+                                       size_t buflen)
 {
-       struct aio_extra *aio_ex = TALLOC_ZERO_P(NULL, struct aio_extra);
+       struct aio_extra *aio_ex = TALLOC_ZERO_P(mem_ctx, struct aio_extra);
 
        if (!aio_ex) {
                return NULL;
@@ -111,10 +114,12 @@ static struct aio_extra *create_aio_extra(files_struct 
*fsp, size_t buflen)
           the smb return buffer. The buffer used in the acb
           is the start of the reply data portion of that buffer. */
 
-       aio_ex->outbuf = data_blob_talloc(aio_ex, NULL, buflen);
-       if (!aio_ex->outbuf.data) {
-               TALLOC_FREE(aio_ex);
-               return NULL;
+       if (buflen) {
+               aio_ex->outbuf = data_blob_talloc(aio_ex, NULL, buflen);
+               if (!aio_ex->outbuf.data) {
+                       TALLOC_FREE(aio_ex);
+                       return NULL;
+               }
        }
        DLIST_ADD(aio_list_head, aio_ex);
        talloc_set_destructor(aio_ex, aio_extra_destructor);
@@ -174,7 +179,7 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
 
        bufsize = smb_size + 12 * 2 + smb_maxcnt;
 
-       if ((aio_ex = create_aio_extra(fsp, bufsize)) == NULL) {
+       if ((aio_ex = create_aio_extra(NULL, fsp, bufsize)) == NULL) {
                DEBUG(10,("schedule_aio_read_and_X: malloc fail.\n"));
                return NT_STATUS_NO_MEMORY;
        }
@@ -239,7 +244,6 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
        struct aio_extra *aio_ex;
        SMB_STRUCT_AIOCB *a;
        size_t bufsize;
-       bool write_through = BITSETW(smbreq->vwv+7,0);
        size_t min_aio_write_size = lp_aio_write_size(SNUM(conn));
        int ret;
 
@@ -262,7 +266,7 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
                return NT_STATUS_RETRY;
        }
 
-       /* Only do this on non-chained and non-chaining reads not using the
+       /* Only do this on non-chained and non-chaining writes not using the
         * write cache. */
         if (req_is_in_chain(smbreq) || (lp_write_cache_size(SNUM(conn)) != 0)) 
{
                return NT_STATUS_RETRY;
@@ -283,11 +287,12 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
 
        bufsize = smb_size + 6*2;
 
-       if (!(aio_ex = create_aio_extra(fsp, bufsize))) {
+       if (!(aio_ex = create_aio_extra(NULL, fsp, bufsize))) {
                DEBUG(0,("schedule_aio_write_and_X: malloc fail.\n"));
                return NT_STATUS_NO_MEMORY;
        }
        aio_ex->handle_completion = handle_aio_write_complete;
+       aio_ex->write_through = BITSETW(smbreq->vwv+7,0);
 
        construct_reply_common_req(smbreq, (char *)aio_ex->outbuf.data);
        srv_set_message((char *)aio_ex->outbuf.data, 6, 0, True);
@@ -331,7 +336,7 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
        contend_level2_oplocks_begin(fsp, LEVEL2_CONTEND_WRITE);
        contend_level2_oplocks_end(fsp, LEVEL2_CONTEND_WRITE);
 
-       if (!write_through && !lp_syncalways(SNUM(fsp->conn))
+       if (!aio_ex->write_through && !lp_syncalways(SNUM(fsp->conn))
            && fsp->aio_write_behind) {
                /* Lie to the client and immediately claim we finished the
                 * write. */
@@ -465,7 +470,6 @@ static int handle_aio_write_complete(struct aio_extra 
*aio_ex, int errcode)
                ERROR_NT(map_nt_error_from_unix(errcode));
                srv_set_message(outbuf,0,0,true);
         } else {
-               bool write_through = BITSETW(aio_ex->smbreq->vwv+7,0);
                NTSTATUS status;
 
                SSVAL(outbuf,smb_vwv2,nwritten);
@@ -477,7 +481,7 @@ static int handle_aio_write_complete(struct aio_extra 
*aio_ex, int errcode)
 
                DEBUG(3,("handle_aio_write: fnum=%d num=%d wrote=%d\n",
                         fsp->fnum, (int)numtowrite, (int)nwritten));
-               status = sync_file(fsp->conn,fsp, write_through);
+               status = sync_file(fsp->conn,fsp, aio_ex->write_through);
                if (!NT_STATUS_IS_OK(status)) {
                        errcode = errno;
                        ERROR_BOTH(map_nt_error_from_unix(errcode),


-- 
Samba Shared Repository

Reply via email to