From 2802be75e38d5ae64ad5ec36e46d0799c77eec30 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 14 Nov 2011 09:52:47 +0100 Subject: s3:smbd/aio: add cancel_smb2_aio() metze --- source3/smbd/aio.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'source3/smbd/aio.c') diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c index 98a35ed206..a978c4f87c 100644 --- a/source3/smbd/aio.c +++ b/source3/smbd/aio.c @@ -380,6 +380,37 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn, return NT_STATUS_OK; } +bool cancel_smb2_aio(struct smb_request *smbreq) +{ + struct smbd_smb2_request *smb2req = smbreq->smb2req; + struct aio_extra *aio_ex = NULL; + int ret; + + if (smbreq) { + smb2req = smbreq->smb2req; + } + + if (smb2req) { + aio_ex = talloc_get_type(smbreq->async_priv, + struct aio_extra); + } + + if (aio_ex == NULL) { + return false; + } + + if (aio_ex->fsp == NULL) { + return false; + } + + ret = SMB_VFS_AIO_CANCEL(aio_ex->fsp, &aio_ex->acb); + if (ret != AIO_CANCELED) { + return false; + } + + return true; +} + /**************************************************************************** Set up an aio request from a SMB2 read call. *****************************************************************************/ @@ -476,6 +507,7 @@ NTSTATUS schedule_smb2_aio_read(connection_struct *conn, /* We don't need talloc_move here as both aio_ex and * smbreq are children of smbreq->smb2req. */ aio_ex->smbreq = smbreq; + smbreq->async_priv = aio_ex; DEBUG(10,("smb2: scheduled aio_read for file %s, " "offset %.0f, len = %u (mid = %u)\n", @@ -576,6 +608,7 @@ NTSTATUS schedule_aio_smb2_write(connection_struct *conn, /* We don't need talloc_move here as both aio_ex and * smbreq are children of smbreq->smb2req. */ aio_ex->smbreq = smbreq; + smbreq->async_priv = aio_ex; /* This should actually be improved to span the write. */ contend_level2_oplocks_begin(fsp, LEVEL2_CONTEND_WRITE); @@ -1039,6 +1072,11 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn, return NT_STATUS_RETRY; } +bool cancel_smb2_aio(struct smb_request *smbreq) +{ + return false; +} + NTSTATUS schedule_smb2_aio_read(connection_struct *conn, struct smb_request *smbreq, files_struct *fsp, -- cgit