[systemd-devel] [PATCH 3/3] nspawn: allow to bind mount journal on top of a non empty container journal dentry

Tom Gundersen teg at jklm.no
Fri Apr 25 11:30:36 PDT 2014


On Fri, Apr 11, 2014 at 2:45 AM, Djalal Harouni <tixxdz at opendz.org> wrote:
> Currently if nspawn was called with --link-journal=host or
> --link-journal=auto and the right /var/log/journal/machine-id/ exists
> then the bind mount the subdirectory into the container might fail due
> to the ~/mycontainer/var/log/journal/machine-id/ of the container not
> being empty.
>
> There is no reason to check if the container journal subdir is empty
> since there will be a bind mount on top of it. The user asked for a bind
> mount so give it.
>
> Note: a next call with --link-journal=guest may fail due to the
> /var/log/journal/machine-id/ on the host not being empty.
>
> https://bugs.freedesktop.org/show_bug.cgi?id=76193

Hm, so this will allow some journal entries to be saved on the host
and some on the guest, but only one of them
will be shown by "journalctl --merge" at any given time... Won't this
be confusing? Either way I guess this case
should be documented in the manpage (either that it is not allowed, or
that it may be confusing)...

> Reported-by: Tobias Hunger <tobias.hunger at gmail.com>
> ---
>  src/nspawn/nspawn.c | 5 -----
>  1 file changed, 5 deletions(-)
>
> diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
> index 21322f7..afb003c 100644
> --- a/src/nspawn/nspawn.c
> +++ b/src/nspawn/nspawn.c
> @@ -1152,11 +1152,6 @@ static int setup_journal(const char *directory) {
>          } else if (access(p, F_OK) < 0)
>                  return 0;
>
> -        if (dir_is_empty(q) == 0) {
> -                log_error("%s not empty.", q);
> -                return -ENOTEMPTY;
> -        }
> -
>          r = mkdir_p(q, 0755);
>          if (r < 0) {
>                  log_error("Failed to create %s: %m", q);
> --
> 1.8.5.3
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list