From nobody Mon Feb 9 15:10:57 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.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=openvz.org ARC-Seal: i=1; a=rsa-sha256; t=1592324515; cv=none; d=zohomail.com; s=zohoarc; b=QPb5YsOckdwIDSvWFr+DP7V/W3FuCp2AwsoOxYQ3qQktc+pajyDBEten/AmZuLIhvIjHMzypI7NPW4tuTfK1UX/nAoIwGFN1RW6IqD8Trn1Jy8XfZSE1hs/7BNoP64Y/0pJRHc7EiOaCeaEcFIvoXuiXN+4kEC4o3EXIh2Vnh7Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592324515; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=xR2iDBmRNEGOG0AihtQ6XiID8kIoajN6VaLn7vqhUIg=; b=SLK/zr/lkUURlYwuV0WH9PnxFQOhO8ccEJATvc3y402C3N3yUnm+BTZezQ9xVudnz3oOktCdEME2k/1nQX7yDKhna5lRHdQm0Cg/qufld5gGRLqPNBX9kNrVrq+rG450DLrifz0bKB0bAuUrdJb5P7Y1RgPPbTfBrbo0fQ3zTJ0= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.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 1592324515604802.5680179591725; Tue, 16 Jun 2020 09:21:55 -0700 (PDT) Received: from localhost ([::1]:53566 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlELS-0006Xl-1K for importer@patchew.org; Tue, 16 Jun 2020 12:21:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlEKL-0004vI-AD; Tue, 16 Jun 2020 12:20:45 -0400 Received: from relay.sw.ru ([185.231.240.75]:43696 helo=relay3.sw.ru) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlEKJ-0006Zz-3D; Tue, 16 Jun 2020 12:20:45 -0400 Received: from [192.168.15.172] (helo=iris.lishka.ru) by relay3.sw.ru with esmtp (Exim 4.93) (envelope-from ) id 1jlEK1-0003Pf-2F; Tue, 16 Jun 2020 19:20:25 +0300 From: "Denis V. Lunev" To: qemu-block@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 1/5] migration/savevm: respect qemu_fclose() error code in save_snapshot() Date: Tue, 16 Jun 2020 19:20:31 +0300 Message-Id: <20200616162035.29857-2-den@openvz.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200616162035.29857-1-den@openvz.org> References: <20200616162035.29857-1-den@openvz.org> Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=185.231.240.75; envelope-from=den@openvz.org; helo=relay3.sw.ru X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/16 12:20:39 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Fam Zheng , Juan Quintela , Max Reitz , Denis Plotnikov , Stefan Hajnoczi , "Denis V. Lunev" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" qemu_fclose() could return error, f.e. if bdrv_co_flush() will return the error. This validation will become more important once we will start waiting of asynchronous IO operations, started from bdrv_write_vmstate(), which are coming soon. Signed-off-by: Denis V. Lunev Reviewed-by: "Dr. David Alan Gilbert" Reviewed-by: Vladimir Sementsov-Ogievskiy CC: Kevin Wolf CC: Max Reitz CC: Stefan Hajnoczi CC: Fam Zheng CC: Juan Quintela CC: Denis Plotnikov --- migration/savevm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index b979ea6e7f..da3dead4e9 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2628,7 +2628,7 @@ int save_snapshot(const char *name, Error **errp) { BlockDriverState *bs, *bs1; QEMUSnapshotInfo sn1, *sn =3D &sn1, old_sn1, *old_sn =3D &old_sn1; - int ret =3D -1; + int ret =3D -1, ret2; QEMUFile *f; int saved_vm_running; uint64_t vm_state_size; @@ -2712,10 +2712,14 @@ int save_snapshot(const char *name, Error **errp) } ret =3D qemu_savevm_state(f, errp); vm_state_size =3D qemu_ftell(f); - qemu_fclose(f); + ret2 =3D qemu_fclose(f); if (ret < 0) { goto the_end; } + if (ret2 < 0) { + ret =3D ret2; + goto the_end; + } =20 /* The bdrv_all_create_snapshot() call that follows acquires the AioCo= ntext * for itself. BDRV_POLL_WHILE() does not support nested locking beca= use --=20 2.17.1