From nobody Wed May 14 02:32:30 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1528629323922681.6569541640528; Sun, 10 Jun 2018 04:15:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A297E356D2; Sun, 10 Jun 2018 11:15:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 42EEF811BF; Sun, 10 Jun 2018 11:15:21 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B8AED180BA80; Sun, 10 Jun 2018 11:15:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5ABErco008030 for ; Sun, 10 Jun 2018 07:14:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 82FB82010D99; Sun, 10 Jun 2018 11:14:53 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 783192010D98 for ; Sun, 10 Jun 2018 11:14:50 +0000 (UTC) Received: from mail-wr0-f177.google.com (mail-wr0-f177.google.com [209.85.128.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A0A90883C1 for ; Sun, 10 Jun 2018 11:14:39 +0000 (UTC) Received: by mail-wr0-f177.google.com with SMTP id o12-v6so17444606wrm.12 for ; Sun, 10 Jun 2018 04:14:39 -0700 (PDT) Received: from rst.Home ([2a02:c7d:692a:c500:1ebc:73f3:5f60:b131]) by smtp.gmail.com with ESMTPSA id f2-v6sm6869448wre.16.2018.06.10.04.14.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 10 Jun 2018 04:14:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uUlqCHBTAtkpVGcmLNoJqASeHhLi4eal/zkGZ+RUVks=; b=VWwtl9ac1DLTV2g8U9FBzEFoTTwH3D/mQzVTDA1jOKi5RwBPczeph1M7OqLNNEFxCZ iqnz5L+WmiPP4jh3F5vw4ejpoVRc8dpbr2qXzwa3oXSt5dS0Si8U1QJl2mM1fp2q5dve yR3H2mOETQybE6J9TAbYAeaW8OwK9HHqN4QvSvDbJTeRXX4cFaHPbCbBY1TMyF6EOP3e MqN5twS+uGJRmJMNuO2JCJwnLMuZaqY0mz/21+i6Ddtu/ZiE1y/mh1O9K9UoXbySfXVA p6gbkCIC2mwjX0ptpqywKaXDjUzoyRbjYo/P9h7Wh2jeTi6EVioj1SjIPg+REfrcG9DL s9GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=uUlqCHBTAtkpVGcmLNoJqASeHhLi4eal/zkGZ+RUVks=; b=FsXzr4uevSgXOmAGnASgVRCpjW4rjHq0TkpRHTlquYBWNx1bZMllUPHZOXCKko9mvv 56xvGVXP2tlqDY/jyJ1+w739jmadbU2JDL2qL6Kgqzsm7M0iUfn9MnNjyUvrHuq70ziF d6XMMrEzeEx2XUbdy1Cr9wanurNCNPHdK55uV48Bd2pzUeiJz/59Kj4EzG1tVdww1UA2 jrjDdmc7UN2sEFdLgTQ+8gj35oQeLcmG6lHPd7PgN9lldQmfH1Xj+R03BHoDBXVQ+S6R XEfYl3U+kgIOf5OUVFtK08kV3kK0NcwA8ZwSAZSaYbg1mFGKOId4bOynMyGn1Cp3s7tZ hRnw== X-Gm-Message-State: APt69E3XTw0SDUKjtd67sZUn3ZPe213lOCXzPFVdwW1mRfhUeEGsBKxA CHSSsgrLfPZnfFnGmLetdgQoFC3p X-Google-Smtp-Source: ADUXVKLcJp7CS6lEXM+pgciLhbNvu5YrxUv4/9JDcwNWVoXpFcMRs+yhqE8fOVX41OXAgDnySpCZFw== X-Received: by 2002:adf:e285:: with SMTP id v5-v6mr9257167wri.54.1528629278103; Sun, 10 Jun 2018 04:14:38 -0700 (PDT) From: Radostin Stoyanov To: libvir-list@redhat.com Date: Sun, 10 Jun 2018 12:14:26 +0100 Message-Id: <20180610111426.5211-5-rstoyanov1@gmail.com> In-Reply-To: <20180610111426.5211-1-rstoyanov1@gmail.com> References: <20180610111426.5211-1-rstoyanov1@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sun, 10 Jun 2018 11:14:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sun, 10 Jun 2018 11:14:39 +0000 (UTC) for IP:'209.85.128.177' DOMAIN:'mail-wr0-f177.google.com' HELO:'mail-wr0-f177.google.com' FROM:'rstoyanov1@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.55 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS, T_DKIM_INVALID) 209.85.128.177 mail-wr0-f177.google.com 209.85.128.177 mail-wr0-f177.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Cc: Radostin Stoyanov Subject: [libvirt] [RFC v2 4/4] lxc: Remove unused lxcContainerPrepareRoot X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sun, 10 Jun 2018 11:15:22 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" lxcContainerPrepareRoot was introduced with commit 8dbe858 Ensure root filesystem is mounted if a file/block mount. For a root filesystem with type=3Dfile or type=3Dblock, the LXC container was forgetting to actually mount it, before doing the pivot root step. However, this method is no-longer needed because in the cases when the container root file system is of type 'file' or 'block', it will be mounted= by virLXCControllerSetupNBDDeviceFS. Therefore the function lxcContainerPrepareRoot will always be called with: root->type =3D VIR_DOMAIN_FS_TYPE_MOUNT Which makes the following condition tautology: if (root->type =3D=3D VIR_DOMAIN_FS_TYPE_MOUNT) return 0; Signed-off-by: Radostin Stoyanov --- src/lxc/lxc_container.c | 53 ----------------------------------------- 1 file changed, 53 deletions(-) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 3f6be9f44d..3360c608ff 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -658,55 +658,6 @@ static int lxcContainerResolveSymlinks(virDomainFSDefP= tr fs, bool gentle) return 0; } =20 -static int lxcContainerPrepareRoot(virDomainDefPtr def, - virDomainFSDefPtr root, - const char *sec_mount_options) -{ - char *dst; - char *tmp; - - VIR_DEBUG("Prepare root %d", root->type); - - if (root->type =3D=3D VIR_DOMAIN_FS_TYPE_MOUNT) - return 0; - - if (root->type =3D=3D VIR_DOMAIN_FS_TYPE_FILE) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unexpected root filesystem without loop device")= ); - return -1; - } - - if (root->type !=3D VIR_DOMAIN_FS_TYPE_BLOCK) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported root filesystem type %s"), - virDomainFSTypeToString(root->type)); - return -1; - } - - if (lxcContainerResolveSymlinks(root, false) < 0) - return -1; - - if (virAsprintf(&dst, "%s/%s.root", - LXC_STATE_DIR, def->name) < 0) - return -1; - - tmp =3D root->dst; - root->dst =3D dst; - - if (lxcContainerMountFSBlock(root, "", sec_mount_options) < 0) { - root->dst =3D tmp; - VIR_FREE(dst); - return -1; - } - - root->dst =3D tmp; - root->type =3D VIR_DOMAIN_FS_TYPE_MOUNT; - VIR_FREE(root->src->path); - root->src->path =3D dst; - - return 0; -} - static int lxcContainerPivotRoot(virDomainFSDefPtr root) { int ret; @@ -1755,10 +1706,6 @@ static int lxcContainerSetupPivotRoot(virDomainDefPt= r vmDef, if (virFileResolveAllLinks(LXC_STATE_DIR, &stateDir) < 0) goto cleanup; =20 - /* Ensure the root filesystem is mounted */ - if (lxcContainerPrepareRoot(vmDef, root, sec_mount_options) < 0) - goto cleanup; - /* Gives us a private root, leaving all parent OS mounts on /.oldroot = */ if (lxcContainerPivotRoot(root) < 0) goto cleanup; --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list