All of lore.kernel.org
 help / color / mirror / Atom feed
From: Randy Witt <randy.e.witt@linux.intel.com>
To: Khem Raj <raj.khem@gmail.com>
Cc: Patches and discussions about the oe-core layer
	<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 2/2] image.bbclass: Empty /var/volatile if it is a mount point
Date: Tue, 24 Mar 2015 10:02:03 -0700	[thread overview]
Message-ID: <5511988B.4090302@linux.intel.com> (raw)
In-Reply-To: <037A72AC-D36E-491E-84D1-16D6F1B014A0@gmail.com>

On 03/24/2015 08:53 AM, Khem Raj wrote:
>
>> On Mar 24, 2015, at 8:46 AM, randy.e.witt@linux.intel.com wrote:
>>
>>> On Mon, Mar 23, 2015 at 5:28 PM, Randy Witt
>>> <randy.e.witt@linux.intel.com> wrote:
>>>> If /var/volatile is a mount point it shouldn't contain any files before
>>>> mount time. If files are there, they will no longer be able to be
>>>> accessed
>>>> once the tmpfs gets mounted at /var/volatile.
>>>
>>> why not use copy-bind when mounting it second time as tmpfs ?
>>>
>>
>> Khem, could you elaborate? I'm not sure I know the mechanism to which you
>> are referring.
>
> copy bind will copy the contents from old place to new mount. Then hopefully you do not lose the content
> that was already there before remount happens see VOLATILE_BINDS implementation.
>

I like this idea, but considering that /var/volatile/log/journal is within the 
mountpoint I'm not sure how it could work. The contents will already be hidden 
by the mount of /var/volatile before the files can be copied.

Perhaps I am misunderstanding?

>>
>>>>
>>>> This problem can be seen for instance when systemd creates
>>>> /var/volatile/log/journal as part of its package installation. It then
>>>> assumes the journal is persistent even though /var/volatile/log/journal
>>>> goes away shortly thereafter.
>>>>
>>>> This change makes sure that there are no files in /var/volatile if it is
>>>> to be used as a mount point.
>>>>
>>>> [Yocto #7388]
>>>>
>>>> Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
>>>> ---
>>>> meta/classes/image.bbclass | 16 ++++++++++++++++
>>>> 1 file changed, 16 insertions(+)
>>>>
>>>> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
>>>> index 89eb5f3..dfedf9d 100644
>>>> --- a/meta/classes/image.bbclass
>>>> +++ b/meta/classes/image.bbclass
>>>> @@ -181,6 +181,8 @@ POSTINST_LOGFILE ?=
>>>> "${localstatedir}/log/postinstall.log"
>>>> SYSTEMD_DEFAULT_TARGET ?= '${@bb.utils.contains("IMAGE_FEATURES",
>>>> "x11-base", "graphical.target", "multi-user.target", d)}'
>>>> ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES",
>>>> "systemd", "set_systemd_default_target; ", "", d)}'
>>>>
>>>> +ROOTFS_POSTPROCESS_COMMAND += 'empty_var_volatile;'
>>>> +
>>>> # some default locales
>>>> IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
>>>>
>>>> @@ -377,6 +379,20 @@ set_systemd_default_target () {
>>>>         fi
>>>> }
>>>>
>>>> +# If /var/volatile is not empty, we have seen problems where programs
>>>> such as the
>>>> +# journal make assumptions based on the contents of /var/volatile. The
>>>> journal
>>>> +# would then write to /var/volatile before it was mounted, thus hiding
>>>> the
>>>> +# items previously written.
>>>> +#
>>>> +# This change is to attempt to fix those types of issues in a way that
>>>> doesn't
>>>> +# affect users that may not be using /var/volatile.
>>>> +empty_var_volatile () {
>>>> +       match=`awk '$1 !~ "#" && $2 ~ /\/var\/volatile/{print $2}'
>>>> ${IMAGE_ROOTFS}/etc/fstab 2> /dev/null`
>>>> +       if [ -n "$match" ]; then
>>>> +               find ${IMAGE_ROOTFS}/var/volatile -mindepth 1 -delete
>>>> +       fi
>>>> +}
>>>> +
>>>> # Turn any symbolic /sbin/init link into a file
>>>> remove_init_link () {
>>>>         if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then
>>>> --
>>>> 1.9.3
>>>>
>>>> --
>>>> _______________________________________________
>>>> Openembedded-core mailing list
>>>> Openembedded-core@lists.openembedded.org
>>>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>>>
>>
>



  reply	other threads:[~2015-03-24 17:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-24  0:28 [PATCH 0/2] Less intrusive journal fix Randy Witt
2015-03-24  0:28 ` [PATCH 1/2] Revert "systemd: Fix the problem of an empty journal on boot" Randy Witt
2015-03-24  0:28 ` [PATCH 2/2] image.bbclass: Empty /var/volatile if it is a mount point Randy Witt
2015-03-24  5:14   ` Khem Raj
2015-03-24 15:46     ` randy.e.witt
2015-03-24 15:53       ` Khem Raj
2015-03-24 17:02         ` Randy Witt [this message]
2015-03-24 17:26   ` [PATCH v2] " Randy Witt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5511988B.4090302@linux.intel.com \
    --to=randy.e.witt@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=raj.khem@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.