From: Anthony Liguori <anthony@codemonkey.ws>
To: Avi Kivity <avi@redhat.com>
Cc: Uri Lublin <uril@qumranet.com>, kvm@vger.kernel.org
Subject: Re: [PATCH] qemu: qemu_fopen_fd: differentiate between reader and writer user
Date: Sun, 12 Oct 2008 13:09:17 -0500 [thread overview]
Message-ID: <48F23D4D.2050709@codemonkey.ws> (raw)
In-Reply-To: <48F22BF1.3000608@redhat.com>
Avi Kivity wrote:
> Uri Lublin wrote:
>> Currently qemu_fopen_ops accepts both get_buffer and put_buffer, but
>> if both are given (non NULL) we encounter problems:
>> 1. There is only one buffer and index, which may mean data corruption.
>> 2. qemu_flush (which is also called by qemu_fclose) is writing
>> ("flushing")
>> some of the data that was read (for the reader part).
>>
>> Currently qemu_fopen_fd registers both get_buffer and put_buffer
>> functions.
>>
>> This breaks migration for tcp and ssh migration protocols.
>>
>> The following patch fix the above by:
>> 1. It makes sure that at most one of get_buffer and put_buffer is
>> given to qemu_fopen_ops.
>> 2. It changes qemu_fopen_fd to register only get_buffer for a reader
>> and only put_buffer for a writer (adding a 'reader' parameter).
>> 3. The incoming fd migration code calls qemu_fopen_fd as a reader
>> only.
>>
>>
>
> Anthony, this is a problem with qemu-upstream so I'd like to solve it
> in a way that's acceptable for upstream.
>
> The proposed patch is less that ideal IMO as it introduces limitations
> on what you can do with a file. An alternative implementation would
> add a read/write mode to the buffer, based on the last access type.
> When switching from read to write, we drop the buffer, and when
> switching from write to read, we flush it and then drop it. This is
> more complex but results in a cleaner API.
I would think a better solution would introduce two buffers, one for
read and one for write. That way, you can have a proper bidirectional
stream.
Regards,
Anthony Liguori
next prev parent reply other threads:[~2008-10-12 18:09 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-12 16:30 [PATCH] qemu: qemu_fopen_fd: differentiate between reader and writer user Uri Lublin
2008-10-12 16:55 ` Avi Kivity
2008-10-12 18:09 ` Anthony Liguori [this message]
2008-10-12 18:17 ` Avi Kivity
2008-10-12 22:18 ` Anthony Liguori
2008-10-13 3:03 ` Anthony Liguori
2008-10-16 1:36 ` Uri Lublin
2008-10-16 4:14 ` Anthony Liguori
2008-10-16 8:13 ` Avi Kivity
2008-10-16 12:54 ` Anthony Liguori
2008-10-16 14:23 ` Uri Lublin
2008-10-16 14:32 ` Avi Kivity
2008-10-16 14:49 ` Uri Lublin
2008-10-17 2:47 ` Anthony Liguori
2008-10-19 13:46 ` Uri Lublin
2008-10-19 22:00 ` Anthony Liguori
2008-10-22 16:23 ` Uri Lublin
2008-10-16 10:52 ` Uri Lublin
2008-10-16 0:13 ` Uri Lublin
2008-10-16 4:10 ` Anthony Liguori
2008-10-16 8:16 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48F23D4D.2050709@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=uril@qumranet.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.