From nobody Thu Nov 14 07:08:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1621520876; cv=pass; d=zohomail.com; s=zohoarc; b=a1Qk9peeoCYu1DFctErMjxIWyvWAb5f0Rf+f3UuMg8Dmi92MJiGUIhomFI2j3kon7rguB5uhQSin8z2hctd1TKREOUKgzmpkGkW3KmZbnhA5Pd7vv5OHBZpOkcPo2GCuUE3RS9glc7qmMXMDOzVpnet8uGzEEvjX6JJv5SpPjk8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621520876; h=Content-Type: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=vFZ2N8HbuZD1E5/sueLbbBtUq4xdCLJaWlsPftjA7no=; b=H/4jkOqjIZxLw6lL0m6IpaRYWI0FN2MDZi8Idr/+CKHIbsRne+zcJteDpd/WA8SDHiD2oI3Ju3Qo8V0FjU34j3RqNBusqZSr41AssjIzGEsMWuY/xkmTnHb4I8ubfsEPT9wAeGPiyG7jOrhLmV1nhRDP23Myjw4YirPeXN/GeO0= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine 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 1621520876473716.0165175337975; Thu, 20 May 2021 07:27:56 -0700 (PDT) Received: from localhost ([::1]:55668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljjeU-0007Wl-8a for importer@patchew.org; Thu, 20 May 2021 10:27:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljjZm-0005qc-RR; Thu, 20 May 2021 10:23:04 -0400 Received: from mail-eopbgr00128.outbound.protection.outlook.com ([40.107.0.128]:8320 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljjZe-0005ij-I3; Thu, 20 May 2021 10:23:02 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB3544.eurprd08.prod.outlook.com (2603:10a6:20b:4e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25; Thu, 20 May 2021 14:22:38 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133%7]) with mapi id 15.20.4129.033; Thu, 20 May 2021 14:22:38 +0000 Received: from localhost.localdomain (185.215.60.197) by HE1P190CA0034.EURP190.PROD.OUTLOOK.COM (2603:10a6:7:52::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.23 via Frontend Transport; Thu, 20 May 2021 14:22:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T3BHxCTY+pAE/rjX1Kgpgfm72MucrENZpeiMjQQ9UAVyIKvoLuzV+xWeJbenmG38sytnwbXTxjD8t6Za1C2XAyuEIR2JWnmrsAHFHzjbio6dpx01MM0nezpiuCslJ3z12E7TAtI/h/hFc2brCYfA1gn9RMIrAzF0tqmTdtlcu+wi7Lk0LlyfjxRmqsUyDhrzuQUzgTwTh7GYNW1kM/p8dOd8Ubpftq0r7PGdKfEqboOlJjx9DoZ4pHzFBC+zdDZDeqa7HO9dzKqNJDiRRMN2dLEhQ//k/2YFQipCTvplWZCwPYgRyfkt5R1OQ25sHw3QlDUsObxp0VU3bmKCCnn0cA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vFZ2N8HbuZD1E5/sueLbbBtUq4xdCLJaWlsPftjA7no=; b=dQuoDXhu/MRzd/5J+Y4r5m51gIWNX61Am3mcN6uVVoq35weWQt4i+LvKrbawIVDCUFtvONGBeGI1rzhiWRxJW2mhgrh4iR9+1SAngxkxYqWaM6Lyh14yoki4/NLZh4qAWMj4gm7KmNYkPHSJYWxA7MalRAJgmNIPDTdaWDzB3UaZE+RIHfomEQTR/nb1U52fhPfCQLe2VTyGFKoaAG/PppCqGBA9WtwqHqozWQn3UlRjUTwi0EVED7jHr76XW9evklRbhAhb+jXjB9bxD0Ddy7nkCIn6JBdCAzg08IVcgQ9kjTqDilu3TWkkQfu075gi3HMLZg4hK1ecROJdkYNVBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vFZ2N8HbuZD1E5/sueLbbBtUq4xdCLJaWlsPftjA7no=; b=R3DsTEb4QvtdQC+m4jNEuoiWbXuTRFiH0RZ9tJu8VU1t6XdcgEcsvvvAnKRWjoTNUHkNYh/QcCf+TALvucDuBDbbvCwDCkU6UxXWzXDiYIkN/UZqdV2BFr86e04HYNJ8XgTg9u2zopA+r6vrYd9UHXlzY6u1iBvgfjLVpDmd4Vw= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, eblake@redhat.com, armbru@redhat.com, crosa@redhat.com, ehabkost@redhat.com, berrange@redhat.com, pbonzini@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, mreitz@redhat.com, kwolf@redhat.com, den@openvz.org Subject: [PATCH v2 11/33] block/copy-before-write: relax permission requirements when no parents Date: Thu, 20 May 2021 17:21:43 +0300 Message-Id: <20210520142205.607501-12-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210520142205.607501-1-vsementsov@virtuozzo.com> References: <20210520142205.607501-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.197] X-ClientProxiedBy: HE1P190CA0034.EURP190.PROD.OUTLOOK.COM (2603:10a6:7:52::23) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1bd68a64-dbea-4f34-14ac-08d91b9ab84f X-MS-TrafficTypeDiagnostic: AM6PR08MB3544: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6Em3VFMXvcuc49C/Ixstyx9I+BSe32uoQ9J5dVsZY5I7hz5JT+KMI24SqeXZU7csClcxvH/XO/2JDlFQcCOVBN5IuX0XCmmE8ppDDJC+hvM7cRiBGUuYh/cOW+w/HS1uPU+yOtGNwVc7BF10j8b/g9Iy3Itrh+SKLlHvUdPFzRZH4Ju6yMMLpcmr7KK7K/u0hglg7dsCvS6wNQLIPP1VlwDufy8NVjWt0VA5KVwU5ewMBlh2r24sI2z0EVLHV7Iqikk+06Os6lvcEYrX+FElPwVW1kDg2chCcE7ZBsr0LU5EsMHABsB85bfwjK8uZxy2WngYn4R2/hVRrLcZMj6/p8GJflhphgFrnq8ZXSggVvsU7tmvo1tlLsgJuwE3MaEOR5hJ7CREPNHIBBxxmh51Q8LSg3BuNyjog7VHAQnbhKx261tyUMjYUtC4itZpj/o1KmrxUQY7qnyYCRDx48RE8MQQR4FckhydK/wZGj1Q6KUbu6WzdFnomR8NG/dHIMTRHsECYaEsYi+br73FHyxLg3psUjGP9aODNnstvPmIf17Rw/DCGXOjbvh/92KDDWFTnuy1dGizjw+ai279SWvRtW03x3E4qxXelSpOGVnu7Gltd3iZBKJZTdWglZkD5eoBAfYomRGqXGOvzSteUGdFPLR4WTJHPAOdXO+9MOckrMXwidJPfVrSZHyX70coiUpO X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(346002)(376002)(396003)(136003)(39830400003)(478600001)(1076003)(52116002)(86362001)(66946007)(66476007)(4326008)(6486002)(2616005)(66556008)(956004)(26005)(5660300002)(6506007)(107886003)(7416002)(38100700002)(2906002)(8936002)(36756003)(186003)(316002)(6916009)(6512007)(8676002)(16526019)(6666004)(38350700002)(83380400001)(69590400013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?68G5Wb9clwyRdbwoNCUFKOHetPhLJ9TIvGIGsybjJg1NKmdCMv2edkWj8h/j?= =?us-ascii?Q?7hmcoxggj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3t0NwjY9/glE5AEILC9f50dflsA9OMx4G?= =?us-ascii?Q?EzunGGtTKphwoU/X1rEU0QKn+M+cu689C5KRS+k/65NB+eTtygimmgYNzrtD?= =?us-ascii?Q?OJCAHoJ2/I7Kl29xk9rk5pm/loSMiuXO6fnH6PYxfrBPdaN668Zd+f5MHUFp?= =?us-ascii?Q?m65QVKZ2ieVJHyfG+zBpFhy9zEMqE1OxtWVc6knaD4yOk0pScp11QEIOs0Jk?= =?us-ascii?Q?nM9TqENZ0RRv8YmHWxgdkgY7oQYutEqw4+Qu9U0KUDqQ8ZXauPHuXANiqdhT?= =?us-ascii?Q?6duhnQWGb7G38p0hDLC+0KVkzzyG7Vv0ENB341moe13Ua7SMs7FEA+CtnoOz?= =?us-ascii?Q?Kt40qvc0SuebHw38XLkaCFnOrkUGWA5EyRYzyf5NIwH3jJ9mVLrkMeHzzcfG?= =?us-ascii?Q?6yfSOBzkZVMwmHt0+E2fESrL?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1bd68a64-dbea-4f34-14ac-08d91b9ab84f X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2021 14:22:38.2073 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UCZBDrMsq2wdlNFsgY63uzipcEVX4rR9h7IBZn1uOHAUWhN8sdvWha7JJ2Cmd+wrFScuEsBUJFT80Kfe2E6CN5B3MoTHiVfGFHj45ccpZSQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3544 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=40.107.0.128; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-obe.outbound.protection.outlook.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Type: text/plain; charset="utf-8" We are going to publish copy-before-write filter. So, user should be able to create it with blockdev-add first, specifying both filtered and target children. And then do blockdev-reopen, to actually insert the filter where needed. Currently, filter unshares write permission unconditionally on source node. It's good, but it will not allow to do blockdev-add. So, let's relax restrictions when filter doesn't have any parent. Test output is modified, as now permission conflict happens only when job creates a blk parent for filter node. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- block/copy-before-write.c | 8 +++++--- tests/qemu-iotests/283.out | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/block/copy-before-write.c b/block/copy-before-write.c index a7996d54db..2a51cc64e4 100644 --- a/block/copy-before-write.c +++ b/block/copy-before-write.c @@ -142,10 +142,12 @@ static void cbw_child_perm(BlockDriverState *bs, Bdrv= Child *c, bdrv_default_perms(bs, c, role, reopen_queue, perm, shared, nperm, nshared); =20 - if (perm & BLK_PERM_WRITE) { - *nperm =3D *nperm | BLK_PERM_CONSISTENT_READ; + if (!QLIST_EMPTY(&bs->parents)) { + if (perm & BLK_PERM_WRITE) { + *nperm =3D *nperm | BLK_PERM_CONSISTENT_READ; + } + *nshared &=3D ~(BLK_PERM_WRITE | BLK_PERM_RESIZE); } - *nshared &=3D ~(BLK_PERM_WRITE | BLK_PERM_RESIZE); } } =20 diff --git a/tests/qemu-iotests/283.out b/tests/qemu-iotests/283.out index e08f807dab..d5350ce7a7 100644 --- a/tests/qemu-iotests/283.out +++ b/tests/qemu-iotests/283.out @@ -5,7 +5,7 @@ {"execute": "blockdev-add", "arguments": {"driver": "blkdebug", "image": "= base", "node-name": "other", "take-child-perms": ["write"]}} {"return": {}} {"execute": "blockdev-backup", "arguments": {"device": "source", "sync": "= full", "target": "target"}} -{"error": {"class": "GenericError", "desc": "Cannot append copy-before-wri= te filter: Conflicts with use by source as 'image', which does not allow 'w= rite' on base"}} +{"error": {"class": "GenericError", "desc": "Conflicts with use by source = as 'image', which does not allow 'write' on base"}} =20 =3D=3D=3D copy-before-write filter should be gone after job-finalize =3D= =3D=3D =20 --=20 2.29.2