Re: [PATCH v2 2/5] migration: Make from_dst_file accesses thread-safe

2021-07-22 Thread Dr. David Alan Gilbert
* Peter Xu (pet...@redhat.com) wrote: > Accessing from_dst_file is potentially racy in current code base like below: > > if (s->from_dst_file) > do_something(s->from_dst_file); > > Because from_dst_file can be reset right after the check in another > thread (rp_thread). One example is migr

Re: [PATCH v2 2/5] migration: Make from_dst_file accesses thread-safe

2021-07-22 Thread Peter Xu
On Wed, Jul 21, 2021 at 04:15:27PM -0500, Eric Blake wrote: > On Wed, Jul 21, 2021 at 03:34:06PM -0400, Peter Xu wrote: > > Accessing from_dst_file is potentially racy in current code base like below: > > > > if (s->from_dst_file) > > do_something(s->from_dst_file); > > > > Because from_dst

Re: [PATCH v2 2/5] migration: Make from_dst_file accesses thread-safe

2021-07-21 Thread Eric Blake
On Wed, Jul 21, 2021 at 03:34:06PM -0400, Peter Xu wrote: > Accessing from_dst_file is potentially racy in current code base like below: > > if (s->from_dst_file) > do_something(s->from_dst_file); > > Because from_dst_file can be reset right after the check in another > thread (rp_thread).

[PATCH v2 2/5] migration: Make from_dst_file accesses thread-safe

2021-07-21 Thread Peter Xu
Accessing from_dst_file is potentially racy in current code base like below: if (s->from_dst_file) do_something(s->from_dst_file); Because from_dst_file can be reset right after the check in another thread (rp_thread). One example is migrate_fd_cancel(). Use the same qemu_file_lock to pro