Re: [PATCH 2/5] migration: Fix race on qemu_file_shutdown()

2022-09-23 Thread Peter Xu
On Fri, Sep 23, 2022 at 08:14:25AM +0100, Daniel P. Berrangé wrote: > > Besides that, do you have anything else in mind that would make > > QIOChannelCached better than qemufile (e.g. on how we do caching)? > > Depends what you mean by better ? I think the caching code would be > a bit easier to

Re: [PATCH 2/5] migration: Fix race on qemu_file_shutdown()

2022-09-23 Thread Daniel P . Berrangé
On Thu, Sep 22, 2022 at 03:37:11PM -0400, Peter Xu wrote: > On Thu, Sep 22, 2022 at 05:58:25PM +0100, Daniel P. Berrangé wrote: > > On Tue, Sep 20, 2022 at 06:37:57PM -0400, Peter Xu wrote: > > > In qemu_file_shutdown(), there's a possible race if with current order of > > > operation. There're

Re: [PATCH 2/5] migration: Fix race on qemu_file_shutdown()

2022-09-22 Thread Peter Xu
On Thu, Sep 22, 2022 at 05:58:25PM +0100, Daniel P. Berrangé wrote: > On Tue, Sep 20, 2022 at 06:37:57PM -0400, Peter Xu wrote: > > In qemu_file_shutdown(), there's a possible race if with current order of > > operation. There're two major things to do: > > > > (1) Do real shutdown() (e.g.

Re: [PATCH 2/5] migration: Fix race on qemu_file_shutdown()

2022-09-22 Thread Daniel P . Berrangé
On Tue, Sep 20, 2022 at 06:37:57PM -0400, Peter Xu wrote: > In qemu_file_shutdown(), there's a possible race if with current order of > operation. There're two major things to do: > > (1) Do real shutdown() (e.g. shutdown() syscall on socket) > (2) Update qemufile's last_error > > We must

Re: [PATCH 2/5] migration: Fix race on qemu_file_shutdown()

2022-09-22 Thread Dr. David Alan Gilbert
* Peter Xu (pet...@redhat.com) wrote: > In qemu_file_shutdown(), there's a possible race if with current order of > operation. There're two major things to do: > > (1) Do real shutdown() (e.g. shutdown() syscall on socket) > (2) Update qemufile's last_error > > We must do (2) before (1)

[PATCH 2/5] migration: Fix race on qemu_file_shutdown()

2022-09-20 Thread Peter Xu
In qemu_file_shutdown(), there's a possible race if with current order of operation. There're two major things to do: (1) Do real shutdown() (e.g. shutdown() syscall on socket) (2) Update qemufile's last_error We must do (2) before (1) otherwise there can be a race condition like: