svn commit: samba r7622 - in trunk/source/smbd: .
jra at samba.org
jra at samba.org
Wed Jun 15 21:45:09 GMT 2005
Author: jra
Date: 2005-06-15 21:45:09 +0000 (Wed, 15 Jun 2005)
New Revision: 7622
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7622
Log:
Turns out aio_error must return != EINPROGRESS before you can
safely call aio_return.
Jeremy
Modified:
trunk/source/smbd/aio.c
Changeset:
Modified: trunk/source/smbd/aio.c
===================================================================
--- trunk/source/smbd/aio.c 2005-06-15 21:03:43 UTC (rev 7621)
+++ trunk/source/smbd/aio.c 2005-06-15 21:45:09 UTC (rev 7622)
@@ -373,16 +373,8 @@
int outsize;
char *outbuf = aio_ex->outbuf;
char *data = smb_buf(outbuf);
- ssize_t nread;
+ ssize_t nread = SMB_VFS_AIO_RETURN(aio_ex->fsp,&aio_ex->acb);
- if (aio_ex->fsp == NULL) {
- /* file was closed whilst I/O was outstanding. Just ignore. */
- DEBUG( 3,( "handle_aio_read_complete: file closed whilst read outstanding.\n"));
- srv_cancel_sign_response(aio_ex->mid);
- return 0;
- }
-
- nread = SMB_VFS_AIO_RETURN(aio_ex->fsp,&aio_ex->acb);
if (nread < 0) {
/* We're relying here on the fact that if the fd is
closed then the aio will complete and aio_return
@@ -436,17 +428,8 @@
files_struct *fsp = aio_ex->fsp;
char *outbuf = aio_ex->outbuf;
ssize_t numtowrite = aio_ex->acb.aio_nbytes;
- ssize_t nwritten;
+ ssize_t nwritten = SMB_VFS_AIO_RETURN(fsp,&aio_ex->acb);
- if (fsp == NULL) {
- /* file was closed whilst I/O was outstanding. Just ignore. */
- DEBUG( 3,( "handle_aio_read_complete: file closed whilst read outstanding.\n"));
- srv_cancel_sign_response(aio_ex->mid);
- return 0;
- }
-
- nwritten = SMB_VFS_AIO_RETURN(fsp,&aio_ex->acb);
-
if (fsp->aio_write_behind) {
if (nwritten != numtowrite) {
if (nwritten == -1) {
@@ -532,6 +515,7 @@
for (i = 0; i < signals_received; i++) {
int err = 0;
uint16 mid = aio_pending_array[i];
+ files_struct *fsp = NULL;
struct aio_extra *aio_ex = find_aio_ex(mid);
if (!aio_ex) {
@@ -541,6 +525,20 @@
continue;
}
+ fsp = aio_ex->fsp;
+ if (fsp == NULL) {
+ /* file was closed whilst I/O was outstanding. Just ignore. */
+ DEBUG( 3,( "process_aio_queue: file closed whilst aio outstanding.\n"));
+ srv_cancel_sign_response(mid);
+ continue;
+ }
+
+ /* Ensure the operation has really completed. */
+ if (SMB_VFS_AIO_ERROR(fsp,&aio_ex->acb) == EINPROGRESS) {
+ DEBUG( 3,( "process_aio_queue: operation still in process for file %s\n", fsp->fsp_name ));
+ continue;
+ }
+
if (aio_ex->read_req) {
err = handle_aio_read_complete(aio_ex);
} else {
More information about the samba-cvs
mailing list