On Wed, 14 Mar 2012 07:28:44 -0600 Eric Blake <ebl...@redhat.com> wrote:
> On 03/14/2012 07:19 AM, Alon Levy wrote: > > >> Also, when returning the image via fd, we could offload its writing to > >> a bh. This would give us a poor man's async support, where the biggest > >> drawback would the lack of error detection (can this operation fail > >> anyway?). > >> > > > > It leaves detection of completion up to the user, so inotify / parsing > > the file to see if it's complete (header says size X, but file is still > > Y<X, not done..), which looks like as big a drawback. > > Notification on a pipe is easy - the reader gets EOF when the writer > closes the fd, with no need to use inotify. Oh, so I was right, it's a pipe. Alon confused me for a few seconds :-) > The only remaining issue is > whether the writer closes the fd early on error, so that the reader gets > an incomplete file. But then the client can tell after getting EOF > whether the image file is complete (read the header, final file size is > too small), without having to have the intermediate management app > parsing headers during the streaming, although it would be a bonus if > there were a way to tell the management app that an error occurred and > qemu closed the write end early. This is async support. Anything other than that is going to be a hack (which can or can not be accepted).