From nobody Tue Feb 10 20:24:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1559035150; cv=none; d=zoho.com; s=zohoarc; b=gOIhkAMq7IDokdG1wB62Q7dVQnogGR08zpjhqORYS9+Utw1qmCEGZiI9E+YcfKL2rbIKMYI/xim9dupC5UiTFYN8TXD8gqsDGwiE78y6EoDclXSUXLzRspAoiyCBBOCydM1BNJnsdFlVIjFnyYsvBi8VkGgX4oivDimWeGgXYsE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559035150; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=fmm0CBegjwWwxb5NlfKFVUIZY18/bRhqKfHWFNzVly0=; b=QZcUidZQd+gr/HqyjxLqNO1R0FB9DwL/p1YZLvb0sroX321J56dKrf5zEG+CI077Y3O843wITrmiE4pZ3ekYpf9wQLtW14Q+ssxOKzBlZnrYk4cQqgAJOSvCO4rJ6QPZU6Son5sDnZum1JtRjElx16/6fLzW7SsrJy0eGHXpQNU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1559035150967254.36077757480552; Tue, 28 May 2019 02:19:10 -0700 (PDT) Received: from localhost ([127.0.0.1]:59626 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVYG7-0007nl-Ve for importer@patchew.org; Tue, 28 May 2019 05:19:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVYE5-0006hW-6A for qemu-devel@nongnu.org; Tue, 28 May 2019 05:16:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hVYE4-00012M-9J for qemu-devel@nongnu.org; Tue, 28 May 2019 05:16:57 -0400 Received: from forwardcorp1j.mail.yandex.net ([5.45.199.163]:47742) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hVYE0-0000zu-Qx for qemu-devel@nongnu.org; Tue, 28 May 2019 05:16:56 -0400 Received: from mxbackcorp1o.mail.yandex.net (mxbackcorp1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::301]) by forwardcorp1j.mail.yandex.net (Yandex) with ESMTP id 40CB42E0A7B; Tue, 28 May 2019 12:16:47 +0300 (MSK) Received: from smtpcorp1o.mail.yandex.net (smtpcorp1o.mail.yandex.net [2a02:6b8:0:1a2d::30]) by mxbackcorp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id g9EKz4MfV7-GkTGcSZ1; Tue, 28 May 2019 12:16:47 +0300 Received: from dynamic-red.dhcp.yndx.net (dynamic-red.dhcp.yndx.net [2a02:6b8:0:40c:5d26:9eea:30af:86bd]) by smtpcorp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id JeN6ka38JZ-GklmvRps; Tue, 28 May 2019 12:16:46 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) Precedence: bulk DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1559035007; bh=BgafXq1yLUfjONcCa6U3rZBoyWG4Spe0j9SKZXPnh8Q=; h=In-Reply-To:Message-Id:References:Date:Subject:To:From:Cc; b=dt/BGtWWz8JuhSr0W4RpvVaKvViSp6YWlU9c4F30ntTbIHyuPg6FlvqgmNtwxvMoR pPto+vsW1n0FniFZmjT+n81+V0xpQm6rjDxHT2W+Sl9IQ3SHalYHxXaCYY0iIzF7G2 K9hfos2Q99qMW+LDq/wrHMzrA7pTVjfqL06H0k5k= Authentication-Results: mxbackcorp1o.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Yury Kotov To: Juan Quintela , "Dr. David Alan Gilbert" , Thomas Huth , Laurent Vivier , Paolo Bonzini Date: Tue, 28 May 2019 12:16:32 +0300 Message-Id: <20190528091633.12246-2-yury-kotov@yandex-team.ru> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190528091633.12246-1-yury-kotov@yandex-team.ru> References: <20190528091633.12246-1-yury-kotov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 5.45.199.163 Subject: [Qemu-devel] [PATCH v2 1/2] migration: Fix fd protocol for incoming defer X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:All patches CC here" , yc-core@yandex-team.ru Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Currently, incoming migration through fd supports only command-line case: E.g. fork(); fd =3D open(); exec("qemu ... -incoming fd:%d", fd); It's possible to use add-fd commands to pass fd for migration, but it's invalid case. add-fd works with fdset but not with particular fds. To work with getfd in incoming defer it's enough to use monitor_fd_param instead of strtol. monitor_fd_param supports both cases: * fd:123 * fd:fd_name (added by getfd). And also the use of monitor_fd_param improves error messages. Signed-off-by: Yury Kotov Reviewed-by: Juan Quintela --- migration/fd.c | 8 +++++--- migration/fd.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/migration/fd.c b/migration/fd.c index a7c13df4ad..0a29ecdebf 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -52,12 +52,14 @@ static gboolean fd_accept_incoming_migration(QIOChannel= *ioc, return G_SOURCE_REMOVE; } =20 -void fd_start_incoming_migration(const char *infd, Error **errp) +void fd_start_incoming_migration(const char *fdname, Error **errp) { QIOChannel *ioc; - int fd; + int fd =3D monitor_fd_param(cur_mon, fdname, errp); + if (fd =3D=3D -1) { + return; + } =20 - fd =3D strtol(infd, NULL, 0); trace_migration_fd_incoming(fd); =20 ioc =3D qio_channel_new_fd(fd, errp); diff --git a/migration/fd.h b/migration/fd.h index a14a63ce2e..b901bc014e 100644 --- a/migration/fd.h +++ b/migration/fd.h @@ -16,7 +16,7 @@ =20 #ifndef QEMU_MIGRATION_FD_H #define QEMU_MIGRATION_FD_H -void fd_start_incoming_migration(const char *path, Error **errp); +void fd_start_incoming_migration(const char *fdname, Error **errp); =20 void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp); --=20 2.21.0