From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6487873763254730752 X-Received: by 10.223.164.206 with SMTP id h14mr1684460wrb.2.1510645716341; Mon, 13 Nov 2017 23:48:36 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 10.28.74.23 with SMTP id x23ls1307180wma.10.gmail; Mon, 13 Nov 2017 23:48:35 -0800 (PST) X-Google-Smtp-Source: AGs4zMZMepMYQ/+nii48PD7+zx+EevtUNLeT/C3OEkRR4Cv2c/y84WlDS8ph15jtGeejvGj7SILh X-Received: by 10.28.175.10 with SMTP id y10mr898742wme.11.1510645715970; Mon, 13 Nov 2017 23:48:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510645715; cv=none; d=google.com; s=arc-20160816; b=nXr/fAqREmAqtH5W6iOCJENyC8f92WtUKQ5hmNNUN7Y0TKX9L/lVuPpRpj1sdMxCEz +efAAQ3qkJ3xGcLSeN9UKRZwqR6vnUxrpyqpii8+6u8e8bORCygl9XfAIWPCm7JEii5x Z/qxTsj0ENi0zUiZg6n8mH+tfCnxfjMOykI6EiaPtI4sgAsL4+9adNRbfFjUwh+oGUpG OGovJhK6+6NiNm7vOGQZbYSbj9xn8c/FfGBMf4WrbqAy0+XOeNU8h8P2jEso+kBW895l MtZj/apUhQLyuujEObLfC5JR8fjo3lmsw+DTpjGvI6Z+AE6+Z/wPIckccNleeQ6xTXgb w3Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:to:subject :arc-authentication-results; bh=l7Y9FVowrAyMLVWyOOKLtUoGbWPVrNpXVNvKV5Dj2L4=; b=HBMVhxArtPU50BWVJwfY2tPo2jLEhSOo9RHXzjXhkquQq5y1AN9cY5k9v73+tOxE/o WSxi5MXCuWWBenD7oeUdXSZ3f0818MXsxfD5Kjzr5rH0i9LnpkT0Gt4e1+XeH+BEWUVs WySUHq4S27Wd3YZa6swB0KAH0OFW0zPXGvaGdaOsviJmEm6Odnt1eX3E3NjvjbF4HH6e wU+EzWZIM8PLNX8X+zUybAmXJ4X8c4NtNIMgbQUsJG65QWnEwkaHPAJQEB0KeemJQHzo CAAH2/oaqlSmbobn0JRtQYR7DECOZgAQ5cKxoppcPvHIrPU2ygKJHF5GMJYYVQmsGk0U lz7w== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=asmirnov@ilbers.de Return-Path: Received: from aqmola.ilbers.de (aqmola.ilbers.de. [85.214.62.211]) by gmr-mx.google.com with ESMTPS id i136si622137wmd.2.2017.11.13.23.48.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Nov 2017 23:48:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) client-ip=85.214.62.211; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=asmirnov@ilbers.de Received: from [10.0.2.15] ([188.227.110.165]) (authenticated bits=0) by aqmola.ilbers.de (8.14.4/8.14.4/Debian-4+deb7u1) with ESMTP id vAE7mWKF008949 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT) for ; Tue, 14 Nov 2017 08:48:34 +0100 Subject: Re: [PATCH] isar-image-base: fix some dangling mounts To: isar-users@googlegroups.com References: <20171114073638.zlmujtvd2lt337nn@MD1KR9XC.ww002.siemens.net> From: Alexander Smirnov Message-ID: <2eca276a-955c-acb9-ae0b-a531512647b9@ilbers.de> Date: Tue, 14 Nov 2017 10:48:27 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20171114073638.zlmujtvd2lt337nn@MD1KR9XC.ww002.siemens.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: fIt9faCs8YhJ On 11/14/2017 10:36 AM, Christian Storm wrote: > >>>> [...] >>>> Here I see that you insert quite similar patterns across the Isar code, >>>> would it be better to have one global clean up function like? >>>> >>>> do_isar_mount_cleanup () { >>>> if [ -d "${WORKDIR}/mnt" ]; then >>>> # umount and remove >>>> fi >>>> >>>> if [ -d "${WORKDIR}/rootfs/proc" ]; then >>>> # umount and remove >>>> fi >>>> >>>> if [ -d "${BUILDCHROOT_DIR}/proc" ]; then >>>> # umount and remove >>>> fi >>>> >>>> etc... >>>> } >>>> >>>> This approach will significantly simplify maintenance of clean up traps >>>> and adding of new possible mounts to Isar. What do you think? >>> >>> I'd say it depends :) >>> It breaks if you rely on keeping something mounted while executing a >>> child script that does unmount everything, following your proposal. If >>> we can make sure that such a situation never occurs, we may consolidate >>> this. For now, it's rather local just undoing the mounts done in the >>> scope of the script. >>> So, in the end, I think it's a matter of taste and contracts between the >>> different parts of Isar. >>> >> >> Ok. >> >>> What one may consider to "de-duplicate" is a stack of mounted directories >>> being pushed to and unmounted on script exit. So, something like >>> push_umount ${IMAGE_ROOTFS}/proc >>> and then the EXIT trap enumerates all those entries, unmounting them. >>> The same has to be done for removing the directories, if applicable. >> >> This sounds reasonable, will try to implement this? >> >> BTW: for me it's not the point for me to block current patch, it'd be >> very helpful to have it in the tree now. > > OK, then let's merge it and create a github issue to refactor it later > as I do have more mount-related stuff in my queue :) > Once all mount-related patches are merged, we do have a clearer picture > and can account for all this at once in terms of a discussion and a > proper concept on the github issue. So, I propose we merge this and I'll > send the other patches out once ready and then we do a refactoring with > discussion on the right way to do it on the github issue. My proposal > with the stack may serve as a starting point for discussion on the > github issue. > > What do you think? Would that be OK for you? Sure! Please create then an issue. Alex