qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Fabiano Rosas <farosas@suse.de>
Cc: qemu-devel@nongnu.org, Juan Quintela <quintela@redhat.com>,
	Wei Wang <wei.w.wang@intel.com>,
	Leonardo Bras <leobras@redhat.com>,
	Lukas Straub <lukasstraub2@web.de>
Subject: Re: [PATCH v5 8/8] migration: Add a wrapper to cleanup migration files
Date: Fri, 1 Sep 2023 12:05:09 -0400	[thread overview]
Message-ID: <ZPILtYXBVVCKDlWX@x1n> (raw)
In-Reply-To: <20230831183916.13203-9-farosas@suse.de>

On Thu, Aug 31, 2023 at 03:39:16PM -0300, Fabiano Rosas wrote:
> @@ -1166,16 +1183,9 @@ static void migrate_fd_cleanup(MigrationState *s)
>          qemu_mutex_lock_iothread();
>  
>          multifd_save_cleanup();
> -        qemu_mutex_lock(&s->qemu_file_lock);
> -        tmp = s->to_dst_file;
> -        s->to_dst_file = NULL;
> -        qemu_mutex_unlock(&s->qemu_file_lock);
> -        /*
> -         * Close the file handle without the lock to make sure the
> -         * critical section won't block for long.
> -         */
> -        migration_ioc_unregister_yank_from_file(tmp);
> -        qemu_fclose(tmp);
> +
> +        migration_ioc_unregister_yank_from_file(s->to_dst_file);

I think you suggested that we should always take the file lock when
operating on them, so this is slightly going backwards to not hold any lock
when doing it. But doing so in migrate_fd_cleanup() is probably fine (as it
serializes with bql on all the rest qmp commands, neither should migration
thread exist at this point).  Your call; it's still much cleaner.

Reviewed-by: Peter Xu <peterx@redhat.com>

-- 
Peter Xu



  reply	other threads:[~2023-09-01 16:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-31 18:39 [PATCH v5 0/8] Fix segfault on migration return path Fabiano Rosas
2023-08-31 18:39 ` [PATCH v5 1/8] migration: Fix possible race when setting rp_state.error Fabiano Rosas
2023-08-31 18:39 ` [PATCH v5 2/8] migration: Fix possible races when shutting down the return path Fabiano Rosas
2023-08-31 18:39 ` [PATCH v5 3/8] migration: Fix possible race when shutting down to_dst_file Fabiano Rosas
2023-08-31 18:39 ` [PATCH v5 4/8] migration: Remove redundant cleanup of postcopy_qemufile_src Fabiano Rosas
2023-08-31 18:39 ` [PATCH v5 5/8] migration: Consolidate return path closing code Fabiano Rosas
2023-08-31 18:39 ` [PATCH v5 6/8] migration: Replace the return path retry logic Fabiano Rosas
2023-08-31 18:39 ` [PATCH v5 7/8] migration: Move return path cleanup to main migration thread Fabiano Rosas
2023-08-31 18:39 ` [PATCH v5 8/8] migration: Add a wrapper to cleanup migration files Fabiano Rosas
2023-09-01 16:05   ` Peter Xu [this message]
2023-09-01 18:29     ` Fabiano Rosas
2023-09-05 15:34       ` Peter Xu
2023-09-05 17:25         ` Fabiano Rosas

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=ZPILtYXBVVCKDlWX@x1n \
    --to=peterx@redhat.com \
    --cc=farosas@suse.de \
    --cc=leobras@redhat.com \
    --cc=lukasstraub2@web.de \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=wei.w.wang@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).