From toor@vast1.dev.skycache.com  Fri May  5 13:39:31 2000
Return-Path: <toor@vast1.dev.skycache.com>
Received: from vast1.dev.skycache.com (ll-nat1.skycache.com [207.239.230.245])
	by hub.freebsd.org (Postfix) with ESMTP id 3D31A37B79B
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  5 May 2000 13:39:30 -0700 (PDT)
	(envelope-from toor@vast1.dev.skycache.com)
Received: (from root@localhost)
	by vast1.dev.skycache.com (8.9.3/8.9.3) id QAA00410;
	Fri, 5 May 2000 16:39:28 -0400 (EDT)
	(envelope-from toor)
Message-Id: <200005052039.QAA00410@vast1.dev.skycache.com>
Date: Fri, 5 May 2000 16:39:28 -0400 (EDT)
From: mdiclaud@cidera.com
Sender: toor@vast1.dev.skycache.com
Reply-To: mdiclaud@cidera.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: panic in aio_process
X-Send-Pr-Version: 3.2

>Number:         18402
>Category:       kern
>Synopsis:       panic in aio_process
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 07 01:10:02 PDT 2000
>Closed-Date:    Fri Jan 18 08:14:39 PST 2002
>Last-Modified:  Fri Jan 18 08:15:28 PST 2002
>Originator:     Mike DiClaudio
>Release:        FreeBSD 3.4-RELEASE i386
>Organization:
Cidera, Inc
>Environment:

* all sysctl values relating to AIO are untouched

* uname -a >> FreeBSD vast1.dev.skycache.com 3.4-RELEASE FreeBSD 3.4-RELEASE #2: Mon Apr  3 14:52:24 EDT 2000     toor@flash.skycache.com:/usr/src/sys/compile/VAST_DEBUG  i386

>Description:

the system panics with fatal trap 12 in aio_process when the file is
close(2)'ed and there are outstanding aio requests.

>How-To-Repeat:

the problem occurred in a program i'm developing and the aio is mixed
in with lots of other stuff.  this code-like sample illustrates what
i'm doing which is causing the problem.  the code is zeroing the disk.
if you need the exact code, let me now

struct aiocb x[100];
int outstanding[100];

open(/dev/rda0)
for(i=0;i<100;i++)
{
  /* setup x[ i ] values */
  aio_write(&x[i]);
  outstanding[i]=1;
}

close(/dev/rda0);       /* bad thing to do here */
while( requests outstanding )
 for(i=0;i<100;i++)
 {
   if( aio_error(&x[i]) == EINPROGRESS )
     continue;

   if( outstanding[i] )
   {
     aio_return(&x[i]);
     outstanding[i]=0;
     /* setup array for aio_suspend */
   }
 }
 aio_suspend();
}
exit();


>Fix:

it works fine if close is called after the loop that is doing the aio_error
and aio_return calls, which is where it belongs to begin with.

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: mike 
State-Changed-When: Sat Jul 21 18:58:27 PDT 2001 
State-Changed-Why:  

Does this problem still occur in newer versions of FreeBSD, 
such as 4.3-RELEASE? 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=18402 
State-Changed-From-To: feedback->closed 
State-Changed-By: sheldonh 
State-Changed-When: Fri Jan 18 08:14:39 PST 2002 
State-Changed-Why:  
Automatic feedback timeout.  If additional feedback that warrants 
the re-opening of this PR is available but not included in the 
audit trail, please include the feedback in a reply to this message 
(preserving the Subject line) and ask that the PR be re-opened. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=18402 
>Unformatted:
