Re: [PATCH] 2.6.10 - direct-io async short read bug

From: Suparna Bhattacharya
Date: Wed Mar 09 2005 - 10:12:13 EST


On Tue, Mar 08, 2005 at 08:07:57PM -0800, Joel Becker wrote:
> On Tue, Mar 08, 2005 at 03:54:04PM -0800, Badari Pulavarty wrote:
> > > 1. return EINVAL if the DIO goes past EOF.
> > >
> > > 2. truncate the request to file size (which is what your patch does)
> > > and if it works, it works.
> > >
> > > 3. truncate the request to a size that actually works - like a multiple
> > > of 512.
> > >
> > > 4. Do the full i/o since the user buffer is big enough, truncate the
> > > result returned to file size (and clear out the user buffer where it
> > > read past EOF).
> > >
> > > Number 4 would make it easy on the user-level code, but AIO DIO might be
> > > a bit tricky and might be a security hole since the data would be dma'ed
> > > there and then cleared. I need to look at the code some more.
>
> Solaris, which does forcedirectio as a mount option, actually
> will do buffered I/O on the trailing part. Consider it like a bounce
> buffer. That way they don't DMA the trailing data and succeed the I/O.
> The I/O returns actual bytes till EOF, just like read(2) is supposed to.
> Either this or a fully DMA'd number 4 is really what we should
> do. If security can only be solved via a bounce buffer, who cares? If
> the user created themselves a non-aligned file to open O_DIRECT, that's
> their problem if the last part-sector is negligably slower.

If writes/truncates take care of zeroing out the rest of the sector
on disk, might we still be OK without having to do the bounce buffer
thing ?

Regards
Suparna

>
> --
>
> Life's Little Instruction Book #3
>
> "Watch a sunrise at least once a year."
>
> Joel Becker
> Senior Member of Technical Staff
> Oracle
> E-mail: joel.becker@xxxxxxxxxx
> Phone: (650) 506-8127
> --
> To unsubscribe, send a message with 'unsubscribe linux-aio' in
> the body to majordomo@xxxxxxxxxx For more info on Linux AIO,
> see: http://www.kvack.org/aio/
> Don't email: <a href=mailto:"aart@xxxxxxxxx";>aart@xxxxxxxxx</a>

--
Suparna Bhattacharya (suparna@xxxxxxxxxx)
Linux Technology Center
IBM Software Lab, India

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/