Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Jan 2000 12:36:06 -0800 (PST)
From:      adrian@freebsd.org
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   kern/16163: posix AIO broken for normal files
Message-ID:  <200001172036.MAA22032@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help


>Number:         16163
>Category:       kern
>Synopsis:       posix AIO broken for normal files
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 17 12:40:03 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Adrian Chadd
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
>Environment:

4.0-CURRENT box built about 8 hours before this PR..

>Description:

Trying to use aio_* on a normal file (not a socket or a device) gives 
ENOTBLK.

The code calls aio_qphysio() which it expects to fall through with
a return value of -1 if it can't queue it the non-thread way. This
routine is only valid for VCHRs. However, the vn_isdisk() call
isn't checked to see if the return is ENOTBLK, and any error triggers
a return which causes the aio_* routines to error out without
queueing the IO request the "normal" way.

>How-To-Repeat:

Try to write some AIO code, that talks to normal disk files, and not
special stuff (sockets or VCHRs).

>Fix:
	

Index: vfs_aio.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/vfs_aio.c,v
retrieving revision 1.65
diff -u -r1.65 vfs_aio.c
--- vfs_aio.c	2000/01/14 02:53:26	1.65
+++ vfs_aio.c	2000/01/17 20:26:54
@@ -944,8 +944,16 @@
 
 	vp = (struct vnode *)fp->f_data;
 
+	/*
+	 * If its not a disk, we don't want to return a positive error.
+	 * It causes the aio code to not fall through to try the thread
+	 * way when you're talking to a regular file.
+	 */
 	if (!vn_isdisk(vp, &error))
-		return (error);
+		if (error == ENOTBLK)
+			return -1;
+		else
+			return (error);
 
  	if (cb->aio_nbytes % vp->v_rdev->si_bsize_phys)
 		return (-1);

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001172036.MAA22032>