Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Mar 1999 16:58:18 -0800
From:      John Plevyak <jplevyak@inktomi.com>
To:        hackers@FreeBSD.org
Subject:   aio_read/write pread/pwrite
Message-ID:  <19990304165818.A20680@proxydev.inktomi.com>

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

In investigating the lack of pread/pwrite, I found the bug
report kern/8011, and the patch therein.

This patch mashes fd->f_offset around the 
(*fp->f_ops->fo_read)(fp, &auio, fp->f_cred) and then resets
it to achieve a sort of poor-mans pread/pwrite.

This breaks multi-threaded programs.  The same problem exists
for aio_read/aio_write.

The simple solution would be to use 'auio.uio_offset' directly
(which is what aio_read/aio_write do), but alas, 
vn_read() mangles fp->f_offset anyway.

Moreover, vn_write totally ignores auio.uio_offset == -1.

The correct solution seems to be to recognize (aio.uio_offset != -1)
as indicating 'don't mess with fp->f_offset at all!' since this is
really what is intended in the places where it is set to non-zero.

I have a patch for this which I am attaching to kern/8011, but
I think it is more generally applicable since it should also
fix aio_XXXX.

Is anyone interested in it?

john


-- 
John Bradley Plevyak,    PhD,    jplevyak@inktomi.com,     PGP KeyID: 051130BD
Inktomi Corporation,  1900 S. Norfolk Street,  Suite 110,  San Mateo, CA 94403
W:(415)653-2830 F:(415)653-2801 P:(888)491-1332/5103192436.4911332@pagenet.net


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




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