From patchwork Fri Jun 29 09:16:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Hesse X-Patchwork-Id: 662 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id 74E42522AC6D for ; Fri, 29 Jun 2018 09:17:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on apollo X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=DKIM_SIGNED=0.1, MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_MED=-2.3,T_DKIM_INVALID=1 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-BL-Results: [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Fri, 29 Jun 2018 09:17:09 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 60550B74587A6; Fri, 29 Jun 2018 09:17:03 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [5.9.250.164]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS; Fri, 29 Jun 2018 09:17:03 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 2E9A72BC85; Fri, 29 Jun 2018 09:17:03 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=eworm.de header.i=@eworm.de header.b=D7Fo3i6z Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id BE3082CF0E for ; Fri, 29 Jun 2018 09:16:59 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by luna.archlinux.org (Postfix) with ESMTPS for ; Fri, 29 Jun 2018 09:16:59 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 4D62DB74587A2 for ; Fri, 29 Jun 2018 09:16:53 +0000 (UTC) Received: from mx.mylinuxtime.de (mx.mylinuxtime.de [195.201.174.144]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS for ; Fri, 29 Jun 2018 09:16:53 +0000 (UTC) Received: from leda.eworm.de (unknown [87.190.244.126]) (using TLSv1.2 with cipher DHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx.mylinuxtime.de (Postfix) with ESMTPSA id 0BA7A303A; Fri, 29 Jun 2018 11:16:53 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.10.3 mx.mylinuxtime.de 0BA7A303A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eworm.de; s=mail; t=1530263813; bh=QXPjhUzfVIZxcK+yDDV+eK2/bVF2jX9vqNkKPB6wqRA=; h=From:To:Cc:Subject:Date; b=D7Fo3i6zkoWOrtUYxLiChMgDO328jX28F1CcRvAzJo5la/8+y9qYXwO+R6Qee4ymE t+YQH6FNU2aQgynjXyeOI0NX3aM8Ty7HD5VVTtgr4DlaxyphUnabIa76c+iGF+FREE VC0XJc7OGFbPuFas1kgFQjK4cwwFXhkuTS0PVQ0k= Received: by leda.eworm.de (Postfix, from userid 1000) id B2174101479; Fri, 29 Jun 2018 11:16:22 +0200 (CEST) From: Christian Hesse To: arch-releng@archlinux.org Date: Fri, 29 Jun 2018 11:16:19 +0200 Message-Id: <20180629091619.26172-1-list@eworm.de> X-Mailer: git-send-email 2.18.0 Subject: [arch-releng] [PATCH 1/1] Remove cow file early for non-persistent systems X-BeenThere: arch-releng@archlinux.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Arch Linux Release Engineering List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Arch Linux Release Engineering Cc: Christian Hesse Errors-To: arch-releng-bounces@archlinux.org Sender: "arch-releng" From: Christian Hesse The kernel has an open file handle after setting up the mapping. We can remove it early to make sure it is gone on shutdown. This helps to keep the cow_device clean for non-persistent systems where cow_directory contains a version specific string. Signed-off-by: Christian Hesse --- archiso/initcpio/hooks/archiso | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/archiso/initcpio/hooks/archiso b/archiso/initcpio/hooks/archiso index 753e3da..5c56561 100644 --- a/archiso/initcpio/hooks/archiso +++ b/archiso/initcpio/hooks/archiso @@ -33,6 +33,10 @@ _mnt_dmsnapshot() { dmsetup create ${dm_snap_name} --table "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} ${cow_persistent} ${cow_chunksize}" + if [[ "${cow_persistent}" != "P" ]]; then + rm -f "/run/archiso/cowspace/${cow_directory}/${img_name}.cow" + fi + _mnt_dev "/dev/mapper/${dm_snap_name}" "${newroot}${mnt}" "-w" "defaults" echo $(readlink -f /dev/mapper/${dm_snap_name}) >> /run/archiso/used_block_devices }