changeset 10011:c75cad68670b

6598629 pxfs aio scate test failures with EBUSY errors on nevada
author Prakash Sangappa <Prakash.Sangappa@Sun.COM>
date Wed, 01 Jul 2009 14:02:39 -0700
parents 7433b2a78ba0
children 5655ac301a3f
files usr/src/lib/libc/port/aio/posix_aio.c usr/src/uts/common/os/aio.c
diffstat 2 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/lib/libc/port/aio/posix_aio.c	Wed Jul 01 13:42:47 2009 -0700
+++ b/usr/src/lib/libc/port/aio/posix_aio.c	Wed Jul 01 14:02:39 2009 -0700
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -632,6 +632,7 @@
 aio_error(const aiocb_t *aiocbp)
 {
 	const aio_result_t *resultp = &aiocbp->aio_resultp;
+	aio_req_t *reqp;
 	int error;
 
 	if ((error = resultp->aio_errno) == EINPROGRESS) {
@@ -650,6 +651,18 @@
 		} else if (aiocbp->aio_state == CHECKED) {
 			((aiocb_t *)aiocbp)->aio_state = CHECK;
 		}
+	} else if (aiocbp->aio_state == USERAIO) {
+		sig_mutex_lock(&__aio_mutex);
+		if ((reqp = _aio_hash_del((aio_result_t *)resultp)) == NULL) {
+			sig_mutex_unlock(&__aio_mutex);
+			((aiocb_t *)aiocbp)->aio_state = CHECKED;
+		} else {
+			((aiocb_t *)aiocbp)->aio_state = NOCHECK;
+			ASSERT(reqp->req_head == NULL);
+			(void) _aio_req_remove(reqp);
+			sig_mutex_unlock(&__aio_mutex);
+			_aio_req_free(reqp);
+		}
 	}
 	return (error);
 }
--- a/usr/src/uts/common/os/aio.c	Wed Jul 01 13:42:47 2009 -0700
+++ b/usr/src/uts/common/os/aio.c	Wed Jul 01 14:02:39 2009 -0700
@@ -2515,7 +2515,7 @@
 	if (aio_hash_insert(reqp, aiop)) {
 		reqp->aio_req_next = aiop->aio_free;
 		aiop->aio_free = reqp;
-		return (EINVAL);
+		return (EBUSY);
 	}
 	*nreqp = reqp;
 	return (0);