summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2012-04-12 13:48:29 -0700
committerJeremy Allison <jra@samba.org>2012-04-12 15:06:58 -0700
commit95839102ad9c1b052924a99ee938991a305d1add (patch)
tree43058333b78a078c8a9af1c253a9279a1b8c1996 /source3
parent80a4e38d6465d8ae47ca113027421af852d34316 (diff)
downloadsamba-95839102ad9c1b052924a99ee938991a305d1add.tar.gz
samba-95839102ad9c1b052924a99ee938991a305d1add.tar.bz2
samba-95839102ad9c1b052924a99ee938991a305d1add.zip
Move the counting of outstanding_aio_calls into the lifecycle of the aio_extra struct.
This way we can't end up with a mismatch between outstanding events and the counter. We may still have problems with canceling and not correctly freeing the aio struct, but at least the counter won't get out of sync anymore.
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/aio.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index e5347a45a4..8050e99498 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -106,6 +106,7 @@ static int handle_aio_smb2_write_complete(struct aio_extra *aio_ex, int errcode)
static int aio_extra_destructor(struct aio_extra *aio_ex)
{
DLIST_REMOVE(aio_list_head, aio_ex);
+ outstanding_aio_calls--;
return 0;
}
@@ -138,6 +139,7 @@ static struct aio_extra *create_aio_extra(TALLOC_CTX *mem_ctx,
DLIST_ADD(aio_list_head, aio_ex);
talloc_set_destructor(aio_ex, aio_extra_destructor);
aio_ex->fsp = fsp;
+ outstanding_aio_calls++;
return aio_ex;
}
@@ -231,7 +233,6 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
return NT_STATUS_RETRY;
}
- outstanding_aio_calls++;
aio_ex->smbreq = talloc_move(aio_ex, &smbreq);
DEBUG(10,("schedule_aio_read_and_X: scheduled aio_read for file %s, "
@@ -337,7 +338,6 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
return NT_STATUS_RETRY;
}
- outstanding_aio_calls++;
aio_ex->smbreq = talloc_move(aio_ex, &smbreq);
/* This should actually be improved to span the write. */
@@ -487,7 +487,6 @@ NTSTATUS schedule_smb2_aio_read(connection_struct *conn,
return NT_STATUS_RETRY;
}
- outstanding_aio_calls++;
/* We don't need talloc_move here as both aio_ex and
* smbreq are children of smbreq->smb2req. */
aio_ex->smbreq = smbreq;
@@ -584,7 +583,6 @@ NTSTATUS schedule_aio_smb2_write(connection_struct *conn,
return NT_STATUS_RETRY;
}
- outstanding_aio_calls++;
/* We don't need talloc_move here as both aio_ex and
* smbreq are children of smbreq->smb2req. */
aio_ex->smbreq = smbreq;
@@ -894,8 +892,6 @@ void smbd_aio_complete_aio_ex(struct aio_extra *aio_ex)
files_struct *fsp = NULL;
int ret = 0;
- outstanding_aio_calls--;
-
DEBUG(10,("smbd_aio_complete_mid: mid[%llu]\n",
(unsigned long long)aio_ex->smbreq->mid));