NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/45441: aio_write and aio_read connected to one pipe don't make progress



The following reply was made to PR kern/45441; it has been noted by GNATS.

From: Marc Balmer <mbalmer%NetBSD.org@localhost>
To: Alexander Nasonov <alnsn%yandex.ru@localhost>
Cc: gnats-bugs%NetBSD.org@localhost, kern-bug-people%NetBSD.org@localhost, 
gnats-admin%NetBSD.org@localhost,
        netbsd-bugs%NetBSD.org@localhost
Subject: Re: kern/45441: aio_write and aio_read connected to one pipe don't
 make progress
Date: Tue, 01 Nov 2011 08:53:16 +0100

 Am 12.10.11 22:26, schrieb Alexander Nasonov:
 > alnsn%NetBSD.org@localhost wrote:
 >> If you initialize two aiocb structs to connect to one pipe and call 
 >> aio_read before aio_write, then aio_error() calls will always be returning 
 >> EINPROGRESS.
 > ...
 >> Fix:
 >> not known
 > 
 > The best fix, I think, is return ESPIPE for non-seekable fildes rather
 > than silently ignoring aio_offset. This would indirectly solve the issue
 > described in this PR.
 
 IMO, this is just a hack.  aio ist fundamentally broken, or rather not
 working at the moment due to it's design.  There is another aio PR open,
 see there for details.
 
 > 
 > Any objections if I commit the patch below? (I'll document ESPIPE as well)
 > Alex
 > 
 > 
 > Index: sys/kern/sys_aio.c
 > ===================================================================
 > RCS file: /cvsroot/src/sys/kern/sys_aio.c,v
 > retrieving revision 1.37
 > diff -p -u -u -r1.37 sys_aio.c
 > --- sys/kern/sys_aio.c       17 Feb 2011 19:02:50 -0000      1.37
 > +++ sys/kern/sys_aio.c       12 Oct 2011 20:15:34 -0000
 > @@ -360,6 +360,7 @@ aio_process(struct aio_job *a_job)
 >      struct proc *p = curlwp->l_proc;
 >      struct aiocb *aiocbp = &a_job->aiocbp;
 >      struct file *fp;
 > +    struct vnode *vp;
 >      int fd = aiocbp->aio_fildes;
 >      int error = 0;
 >  
 > @@ -380,6 +381,13 @@ aio_process(struct aio_job *a_job)
 >                      goto done;
 >              }
 >  
 > +            vp = (struct vnode *)fp->f_data;
 > +            if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO) {
 > +                    fd_putfile(fd);
 > +                    error = ESPIPE;
 > +                    goto done;
 > +            }
 > +
 >              aiov.iov_base = (void *)(uintptr_t)aiocbp->aio_buf;
 >              aiov.iov_len = aiocbp->aio_nbytes;
 >              auio.uio_iov = &aiov;
 > @@ -427,7 +435,6 @@ aio_process(struct aio_job *a_job)
 >              /*
 >               * Perform a file Sync operation
 >               */
 > -            struct vnode *vp;
 >  
 >              if ((error = fd_getvnode(fd, &fp)) != 0)
 >                      goto done; 
 
 
 -- 
   \~~~~~.                The NetBSD Foundation
    \~~~~~'               Marc Balmer, Developer / Marketing
   NetBSD
      \                   mbalmer%NetBSD.org@localhost   http://www.NetBSD.org/
 


Home | Main Index | Thread Index | Old Index