From nobody Tue Nov 18 07:46:12 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1608569659; cv=none; d=zohomail.com; s=zohoarc; b=SFpyl5Oh+97Ro8JyziCM88w7EtADmdwDFkDBZajLVzZJTa28T461K8sINxKEP/woKGhRrXv/fm7eSeWN3hRYCm0yzjKFpFKyAFDlZMl53Xa/PPty0xML625pyw0eYGJSRfE+G74x7o2+cW5BAZ0bqx1Tl3qjYD1vZEz/8rrQqAQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608569659; 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; bh=DkwI9dCU6NXQr8SjjklzWJqUn1CCicWkPekF5NJhljo=; b=AP74EHinM/ent7D17nfz+lZgEhUbK6PieBlnztG6azK46d2yvhQ7PLIyYiWxSS6tWpUha/0OFfTy3dgvEjyOnT0KXqvEeNNMYB711B+ojIdW9zAwR0g3JViVg2kxpB84G9MrmE71pHh1fBoCYzfp60R/s2Mf4lMgErPhNgMwT+w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 1608569659468846.1089221717808; Mon, 21 Dec 2020 08:54:19 -0800 (PST) Received: from localhost ([::1]:42228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1krLdF-0007cz-Eg for importer@patchew.org; Mon, 21 Dec 2020 08:53:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krLZL-0002F9-E3; Mon, 21 Dec 2020 08:49:47 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:54332) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krLZF-00050B-KA; Mon, 21 Dec 2020 08:49:47 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0BLDiYpB080274; Mon, 21 Dec 2020 13:49:36 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 35h8xqwcj4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 21 Dec 2020 13:49:36 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0BLDkX6s143436; Mon, 21 Dec 2020 13:49:36 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 35huevsagy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 21 Dec 2020 13:49:36 +0000 Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0BLDnZBD008130; Mon, 21 Dec 2020 13:49:35 GMT Received: from disaster-area.hh.sledj.net (/81.187.26.238) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 21 Dec 2020 05:49:35 -0800 Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 3752b0f6; Mon, 21 Dec 2020 13:49:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=DkwI9dCU6NXQr8SjjklzWJqUn1CCicWkPekF5NJhljo=; b=b3XdTwoTXH94YSMao6KRzxVLhqrZaLiKUsdX0wTU7Qovdk8matYSnc48dxUEWwRxNPTD Q72PSBc/ByR9kMkwTsrakZAosR9BmpESoLJcGzivKVpssXVy8AOWnY6iipdxPge4s9GM xAac17RBgf4Khw6SeZHqkv7Ej4abWI3DEJfGcZXh4eGU88ccLAZscINHZK+H5l6L42pK Ge/KCOYSC0ujT2IthUrsC4xUp1JIVK/4dkMwkczYj4cmqxBk5zHRQjKqzI700YINSGze hSJNEJ8bAOKqj+qA9P0Uk87Wn3zRG5kdjbaYRnCnrP8s/6hNJlKsBOJVV13lDJZAF2k6 EQ== From: David Edmondson To: qemu-devel@nongnu.org Subject: [PATCH v2 1/2] block: report errno when flock fcntl fails Date: Mon, 21 Dec 2020 13:49:30 +0000 Message-Id: <20201221134931.1194806-2-david.edmondson@oracle.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201221134931.1194806-1-david.edmondson@oracle.com> References: <20201221134931.1194806-1-david.edmondson@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9841 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012210098 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9841 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 clxscore=1015 priorityscore=1501 mlxscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 impostorscore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012210098 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=156.151.31.86; envelope-from=david.edmondson@oracle.com; helo=userp2130.oracle.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no 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 , David Edmondson , qemu-block@nongnu.org, Max Reitz 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" When a call to fcntl(2) for the purpose of manipulating file locks fails, report the error returned by fcntl. Signed-off-by: David Edmondson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- block/file-posix.c | 20 +++++----- tests/qemu-iotests/153.out | 76 +++++++++++++++++++------------------- tests/qemu-iotests/182.out | 2 +- 3 files changed, 49 insertions(+), 49 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index 9804681d5c..f866fc9742 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -836,7 +836,7 @@ static int raw_apply_lock_bytes(BDRVRawState *s, int fd, if ((perm_lock_bits & bit) && !(locked_perm & bit)) { ret =3D qemu_lock_fd(fd, off, 1, false); if (ret) { - error_setg(errp, "Failed to lock byte %d", off); + error_setg_errno(errp, -ret, "Failed to lock byte %d", off= ); return ret; } else if (s) { s->locked_perm |=3D bit; @@ -844,7 +844,7 @@ static int raw_apply_lock_bytes(BDRVRawState *s, int fd, } else if (unlock && (locked_perm & bit) && !(perm_lock_bits & bit= )) { ret =3D qemu_unlock_fd(fd, off, 1); if (ret) { - error_setg(errp, "Failed to unlock byte %d", off); + error_setg_errno(errp, -ret, "Failed to unlock byte %d", o= ff); return ret; } else if (s) { s->locked_perm &=3D ~bit; @@ -857,7 +857,7 @@ static int raw_apply_lock_bytes(BDRVRawState *s, int fd, if ((shared_perm_lock_bits & bit) && !(locked_shared_perm & bit)) { ret =3D qemu_lock_fd(fd, off, 1, false); if (ret) { - error_setg(errp, "Failed to lock byte %d", off); + error_setg_errno(errp, -ret, "Failed to lock byte %d", off= ); return ret; } else if (s) { s->locked_shared_perm |=3D bit; @@ -866,7 +866,7 @@ static int raw_apply_lock_bytes(BDRVRawState *s, int fd, !(shared_perm_lock_bits & bit)) { ret =3D qemu_unlock_fd(fd, off, 1); if (ret) { - error_setg(errp, "Failed to unlock byte %d", off); + error_setg_errno(errp, -ret, "Failed to unlock byte %d", o= ff); return ret; } else if (s) { s->locked_shared_perm &=3D ~bit; @@ -890,9 +890,9 @@ static int raw_check_lock_bytes(int fd, uint64_t perm, = uint64_t shared_perm, ret =3D qemu_lock_fd_test(fd, off, 1, true); if (ret) { char *perm_name =3D bdrv_perm_names(p); - error_setg(errp, - "Failed to get \"%s\" lock", - perm_name); + error_setg_errno(errp, -ret, + "Failed to get \"%s\" lock", + perm_name); g_free(perm_name); return ret; } @@ -905,9 +905,9 @@ static int raw_check_lock_bytes(int fd, uint64_t perm, = uint64_t shared_perm, ret =3D qemu_lock_fd_test(fd, off, 1, true); if (ret) { char *perm_name =3D bdrv_perm_names(p); - error_setg(errp, - "Failed to get shared \"%s\" lock", - perm_name); + error_setg_errno(errp, -ret, + "Failed to get shared \"%s\" lock", + perm_name); g_free(perm_name); return ret; } diff --git a/tests/qemu-iotests/153.out b/tests/qemu-iotests/153.out index fcaa71aeee..c1f8494a63 100644 --- a/tests/qemu-iotests/153.out +++ b/tests/qemu-iotests/153.out @@ -11,11 +11,11 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D335= 54432 backing_file=3DTEST_DIR/t =3D=3D Launching QEMU, opts: '' =3D=3D =20 =3D=3D Launching another QEMU, opts: '' =3D=3D -QEMU_PROG: -drive file=3DTEST_DIR/t.qcow2,if=3Dnone,: Failed to get "write= " lock +QEMU_PROG: -drive file=3DTEST_DIR/t.qcow2,if=3Dnone,: Failed to get "write= " lock: Resource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 =3D=3D Launching another QEMU, opts: 'read-only=3Don' =3D=3D -QEMU_PROG: -drive file=3DTEST_DIR/t.qcow2,if=3Dnone,read-only=3Don: Failed= to get shared "write" lock +QEMU_PROG: -drive file=3DTEST_DIR/t.qcow2,if=3Dnone,read-only=3Don: Failed= to get shared "write" lock: Resource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 =3D=3D Launching another QEMU, opts: 'read-only=3Don,force-share=3Don' =3D= =3D @@ -23,77 +23,77 @@ Is another process using the image [TEST_DIR/t.qcow2]? =3D=3D Running utility commands =3D=3D =20 _qemu_io_wrapper -c read 0 512 TEST_DIR/t.qcow2 -qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock: R= esource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_io_wrapper -r -c read 0 512 TEST_DIR/t.qcow2 -qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get shared "write" = lock +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get shared "write" = lock: Resource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_io_wrapper -c open TEST_DIR/t.qcow2 -c read 0 512 -qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock: R= esource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? no file open, try 'help open' =20 _qemu_io_wrapper -c open -r TEST_DIR/t.qcow2 -c read 0 512 -qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get shared "write" = lock +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get shared "write" = lock: Resource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? no file open, try 'help open' =20 _qemu_img_wrapper info TEST_DIR/t.qcow2 -qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get shared "write" = lock +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get shared "write" = lock: Resource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_img_wrapper check TEST_DIR/t.qcow2 -qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get shared "write" = lock +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get shared "write" = lock: Resource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_img_wrapper compare TEST_DIR/t.qcow2 TEST_DIR/t.qcow2 -qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get shared "write" = lock +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get shared "write" = lock: Resource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_img_wrapper map TEST_DIR/t.qcow2 -qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get shared "write" = lock +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get shared "write" = lock: Resource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_img_wrapper amend -o size=3D32M TEST_DIR/t.qcow2 -qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock: R= esource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_img_wrapper commit TEST_DIR/t.qcow2 -qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock: R= esource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_img_wrapper resize TEST_DIR/t.qcow2 32M -qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock: R= esource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_img_wrapper rebase TEST_DIR/t.qcow2 -b TEST_DIR/t.qcow2.base -F qcow2 -qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock: R= esource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_img_wrapper snapshot -l TEST_DIR/t.qcow2 -qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get shared "write" = lock +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get shared "write" = lock: Resource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_img_wrapper convert TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.convert -qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get shared "write" = lock +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get shared "write" = lock: Resource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_img_wrapper dd if=3DTEST_DIR/t.qcow2 of=3DTEST_DIR/t.qcow2.convert b= s=3D512 count=3D1 -qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get shared "write" = lock +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get shared "write" = lock: Resource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_img_wrapper bench -c 1 TEST_DIR/t.qcow2 -qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get shared "write" = lock +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get shared "write" = lock: Resource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_img_wrapper bench -w -c 1 TEST_DIR/t.qcow2 -qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock: R= esource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_img_wrapper create -f qcow2 TEST_DIR/t.qcow2 -b TEST_DIR/t.qcow2.bas= e -F qcow2 -qemu-img: TEST_DIR/t.qcow2: Failed to get "write" lock +qemu-img: TEST_DIR/t.qcow2: Failed to get "write" lock: Resource temporari= ly unavailable Is another process using the image [TEST_DIR/t.qcow2]? file format: IMGFMT backing file format: IMGFMT @@ -132,7 +132,7 @@ qemu-img: unrecognized option '-U' Try 'qemu-img --help' for more information =20 _qemu_img_wrapper rebase -U TEST_DIR/t.qcow2 -b TEST_DIR/t.qcow2.base -F q= cow2 -qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock: R= esource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_img_wrapper snapshot -l -U TEST_DIR/t.qcow2 @@ -158,7 +158,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D335= 54432 backing_file=3DTEST_DIR/t =3D=3D Launching QEMU, opts: 'read-only=3Don' =3D=3D =20 =3D=3D Launching another QEMU, opts: '' =3D=3D -QEMU_PROG: -drive file=3DTEST_DIR/t.qcow2,if=3Dnone,: Failed to get "write= " lock +QEMU_PROG: -drive file=3DTEST_DIR/t.qcow2,if=3Dnone,: Failed to get "write= " lock: Resource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 =3D=3D Launching another QEMU, opts: 'read-only=3Don' =3D=3D @@ -168,13 +168,13 @@ Is another process using the image [TEST_DIR/t.qcow2]? =3D=3D Running utility commands =3D=3D =20 _qemu_io_wrapper -c read 0 512 TEST_DIR/t.qcow2 -qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock: R= esource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_io_wrapper -r -c read 0 512 TEST_DIR/t.qcow2 =20 _qemu_io_wrapper -c open TEST_DIR/t.qcow2 -c read 0 512 -qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock: R= esource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? no file open, try 'help open' =20 @@ -189,19 +189,19 @@ _qemu_img_wrapper compare TEST_DIR/t.qcow2 TEST_DIR/t= .qcow2 _qemu_img_wrapper map TEST_DIR/t.qcow2 =20 _qemu_img_wrapper amend -o size=3D32M TEST_DIR/t.qcow2 -qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock: R= esource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_img_wrapper commit TEST_DIR/t.qcow2 -qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock: R= esource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_img_wrapper resize TEST_DIR/t.qcow2 32M -qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock: R= esource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_img_wrapper rebase TEST_DIR/t.qcow2 -b TEST_DIR/t.qcow2.base -F qcow2 -qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock: R= esource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_img_wrapper snapshot -l TEST_DIR/t.qcow2 @@ -213,11 +213,11 @@ _qemu_img_wrapper dd if=3DTEST_DIR/t.qcow2 of=3DTEST_= DIR/t.qcow2.convert bs=3D512 coun _qemu_img_wrapper bench -c 1 TEST_DIR/t.qcow2 =20 _qemu_img_wrapper bench -w -c 1 TEST_DIR/t.qcow2 -qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock: R= esource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_img_wrapper create -f qcow2 TEST_DIR/t.qcow2 -b TEST_DIR/t.qcow2.bas= e -F qcow2 -qemu-img: TEST_DIR/t.qcow2: Failed to get "write" lock +qemu-img: TEST_DIR/t.qcow2: Failed to get "write" lock: Resource temporari= ly unavailable Is another process using the image [TEST_DIR/t.qcow2]? file format: IMGFMT backing file format: IMGFMT @@ -256,7 +256,7 @@ qemu-img: unrecognized option '-U' Try 'qemu-img --help' for more information =20 _qemu_img_wrapper rebase -U TEST_DIR/t.qcow2 -b TEST_DIR/t.qcow2.base -F q= cow2 -qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock +qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get "write" lock: R= esource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 _qemu_img_wrapper snapshot -l -U TEST_DIR/t.qcow2 @@ -377,17 +377,17 @@ qemu-img: Could not open 'TEST_DIR/t.qcow2': force-sh= are=3Don can only be used wit Round done =20 =3D=3D Two devices with the same image (read-only=3Doff - read-only=3Doff)= =3D=3D -QEMU_PROG: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2,read-only=3Doff: Faile= d to get "write" lock +QEMU_PROG: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2,read-only=3Doff: Faile= d to get "write" lock: Resource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 =3D=3D Two devices with the same image (read-only=3Doff - read-only=3Don) = =3D=3D -QEMU_PROG: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2,read-only=3Don: Failed= to get shared "write" lock +QEMU_PROG: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2,read-only=3Don: Failed= to get shared "write" lock: Resource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 =3D=3D Two devices with the same image (read-only=3Doff - read-only=3Don,f= orce-share=3Don) =3D=3D =20 =3D=3D Two devices with the same image (read-only=3Don - read-only=3Doff) = =3D=3D -QEMU_PROG: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2,read-only=3Doff: Faile= d to get "write" lock +QEMU_PROG: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2,read-only=3Doff: Faile= d to get "write" lock: Resource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 =3D=3D Two devices with the same image (read-only=3Don - read-only=3Don) = =3D=3D @@ -408,13 +408,13 @@ Formatting 'TEST_DIR/t.IMGFMT.c', fmt=3DIMGFMT size= =3D33554432 backing_file=3DTEST_DIR =3D=3D Two devices sharing the same file in backing chain =3D=3D =20 =3D=3D Backing image also as an active device =3D=3D -QEMU_PROG: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2: Failed to get "write"= lock +QEMU_PROG: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2: Failed to get "write"= lock: Resource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 =3D=3D Backing image also as an active device (ro) =3D=3D =20 =3D=3D Symbolic link =3D=3D -QEMU_PROG: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2: Failed to get "write"= lock +QEMU_PROG: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2: Failed to get "write"= lock: Resource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 =3D=3D Active commit to intermediate layer should work when base in use = =3D=3D @@ -429,7 +429,7 @@ Adding drive {"return": "OKrn"} =20 _qemu_io_wrapper TEST_DIR/t.qcow2 -c write 0 512 -qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock: R= esource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? Creating overlay with qemu-img when the guest is running should be allowed =20 @@ -450,7 +450,7 @@ _qemu_img_wrapper info TEST_DIR/t.qcow2 {"return": ""} =20 _qemu_io_wrapper TEST_DIR/t.qcow2 -c write 0 512 -qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock +qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock: R= esource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? Closing the other { 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'driv= e_del d1' } } diff --git a/tests/qemu-iotests/182.out b/tests/qemu-iotests/182.out index ce23340670..63b7ecb325 100644 --- a/tests/qemu-iotests/182.out +++ b/tests/qemu-iotests/182.out @@ -3,7 +3,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D33554432 Starting QEMU =20 Starting a second QEMU using the same image should fail -QEMU_PROG: -drive file=3DTEST_DIR/t.qcow2,if=3Dnone,id=3Ddrive0,file.locki= ng=3Don: Failed to get "write" lock +QEMU_PROG: -drive file=3DTEST_DIR/t.qcow2,if=3Dnone,id=3Ddrive0,file.locki= ng=3Don: Failed to get "write" lock: Resource temporarily unavailable Is another process using the image [TEST_DIR/t.qcow2]? =20 =3D=3D=3D Testing reopen =3D=3D=3D --=20 2.29.2 From nobody Tue Nov 18 07:46:12 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1608569259; cv=none; d=zohomail.com; s=zohoarc; b=YQ+JWSjygjsyxQ9jL9g4Ls0AWJ4+f81snTH67IR5EMj4QkzgVMHrU61szRVmUoLB4gOxJLHEEprn1qht6EoFti/e1aIRgzEXYFvOglFplpsWQIYBo+hERTy2o2Hqc2M5GBna6y7wXc3axHcpr++55uAk/lKivaBIZknHqgfdmzc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608569259; 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; bh=t/TwPb1FJb1F48YUIj8G53YcNrZ3C8R3Q7FgKxLTmlE=; b=XY+EGjlUOUWLpLQeDPp87tUGgxOxG821dHNB86rTQvTn8fz0wmUhgxOmOrQCcktmyIfx6IOD3iW8Dl0eTy+gBqWe1XCd+jPbgWkg8ah8XtDUv2x5ipKrhGAXyAVSWa45egOwUGcJtMx0ZSOaAZVsDnA3Q8ndQ6BFerJnzfcg/2g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 1608569259673693.7842160390301; Mon, 21 Dec 2020 08:47:39 -0800 (PST) Received: from localhost ([::1]:35282 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1krLbh-0004pW-2Y for importer@patchew.org; Mon, 21 Dec 2020 08:52:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59252) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krLZK-0002CR-Gg; Mon, 21 Dec 2020 08:49:46 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:54340) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krLZF-00050d-KX; Mon, 21 Dec 2020 08:49:45 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0BLDj91T080739; Mon, 21 Dec 2020 13:49:38 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 35h8xqwcj6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 21 Dec 2020 13:49:38 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0BLDkXf4143466; Mon, 21 Dec 2020 13:49:38 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 35huevsajv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 21 Dec 2020 13:49:38 +0000 Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0BLDnaic028015; Mon, 21 Dec 2020 13:49:37 GMT Received: from disaster-area.hh.sledj.net (/81.187.26.238) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 21 Dec 2020 05:49:36 -0800 Received: from localhost (disaster-area.hh.sledj.net [local]) by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 05da8e5d; Mon, 21 Dec 2020 13:49:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=t/TwPb1FJb1F48YUIj8G53YcNrZ3C8R3Q7FgKxLTmlE=; b=C/CLAIF3N8QpzJe+I4g9bIn4tlShpVrkkKbWu42h8lG5VLS7tCqdtehPdRra6BDYvR7z 9UlMP0p0gQ5lakvJ6f4T+0pJW2iGtTz5pvuFHE+cUzMkA1JeqrZPtrR47Zlsgt1QANOz 8hmKBOjILtP2eH5vz1wc4SoTZFsAFNc3UGfuNxcvIiBly2kOduxkMwUD17DuXHKz7cnN Gprgo4DzJpzUmn4ke5qpWochj1vxMUzT69ii7BphGaIb9OCply377dVOe/EhoiGZ1Nay OfNvK/Qhk/RW/TQEVgzluEPHt2nSOhsxb9LP2saWVa9HQdrqtV9QJGeWxgG8XXiDEZhh kA== From: David Edmondson To: qemu-devel@nongnu.org Subject: [PATCH v2 2/2] tests: Collapse echoed JSON input to a single line Date: Mon, 21 Dec 2020 13:49:31 +0000 Message-Id: <20201221134931.1194806-3-david.edmondson@oracle.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201221134931.1194806-1-david.edmondson@oracle.com> References: <20201221134931.1194806-1-david.edmondson@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9841 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012210098 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9841 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 clxscore=1015 priorityscore=1501 mlxscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 impostorscore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012210098 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=156.151.31.86; envelope-from=david.edmondson@oracle.com; helo=userp2130.oracle.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no 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 , David Edmondson , qemu-block@nongnu.org, Max Reitz 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" When sending JSON to running qemu, qemu-io, etc. instances, flatten the echoed input to a single line to ensure that comparisons with the expected input (which is always a single line) are successful. Signed-off-by: David Edmondson --- tests/qemu-iotests/common.filter | 6 ++++++ tests/qemu-iotests/common.qemu | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.f= ilter index 172ea5752e..d51df59769 100644 --- a/tests/qemu-iotests/common.filter +++ b/tests/qemu-iotests/common.filter @@ -332,5 +332,11 @@ for fname in fnames: sys.stdout.write(result)' } =20 +# Convert multi-line input to a single line. +_filter_collapse_lines() +{ + (tr -d '\n'; echo) +} + # make sure this script returns success true diff --git a/tests/qemu-iotests/common.qemu b/tests/qemu-iotests/common.qemu index de680cf1c7..9604c78b8a 100644 --- a/tests/qemu-iotests/common.qemu +++ b/tests/qemu-iotests/common.qemu @@ -159,7 +159,7 @@ _send_qemu_cmd() # input back to output); decide based on leading '{' if [ -z "$silent" ] && [ -z "$mismatch_only" ] && [ "$cmd" !=3D "${cmd#\{}" ]; then - echo "${cmd}" | _filter_testdir | _filter_imgfmt + echo "${cmd}" | _filter_testdir | _filter_imgfmt | _filter_collaps= e_lines fi while [ ${count} -gt 0 ] do --=20 2.29.2