[PATCH] Avoid using mount --move on shared paths (#853508)

Vratislav Podzimek vpodzime at redhat.com
Mon Oct 15 15:25:14 UTC 2012


Looks good to me.

On Fri, 2012-10-12 at 12:33 -0700, Jesse Keating wrote:
> move doesn't work because /run/ is a shared filesystem.  So do as
> systemd suggests, mark the filesystem as private.  We don't know of any
> reason in anaconda for the filesystem to be shared anyway.
> 
> This hack can go away if/when the kernel ever allows moving mounts
> within a shared filesystem.
> ---
>  dracut/anaconda-lib.sh             | 3 ++-
>  pyanaconda/packaging/yumpayload.py | 4 ++++
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/dracut/anaconda-lib.sh b/dracut/anaconda-lib.sh
> index 6b9a707..af6690d 100755
> --- a/dracut/anaconda-lib.sh
> +++ b/dracut/anaconda-lib.sh
> @@ -54,7 +54,7 @@ anaconda_live_root_dir() {
>      img=$(find_runtime $mnt/$path)
>      if [ -n "$img" ]; then
>          info "anaconda: found $img"
> -        [ "$mnt" = "$repodir" ] || mount --move $mnt $repodir
> +        [ "$mnt" = "$repodir" ] || { mount --rprivate /; mount --move $mnt $isodir; }
>          anaconda_auto_updates $repodir/$path/images
>      else
>          if [ "${path%.iso}" != "$path" ]; then
> @@ -65,6 +65,7 @@ anaconda_live_root_dir() {
>          fi
>          [ -n "$iso" ] || { warn "no suitable images"; return 1; }
>          info "anaconda: found $iso"
> +        mount --rprivate /
>          mount --move $mnt $isodir
>          iso=${isodir}/${iso#$mnt}
>          mount -o loop,ro $iso $repodir
> diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
> index cd2e22e..49c586e 100644
> --- a/pyanaconda/packaging/yumpayload.py
> +++ b/pyanaconda/packaging/yumpayload.py
> @@ -563,6 +563,10 @@ reposdir=%s
>              # install from one of them
>              if image:
>                  # move the mount to ISO_DIR
> +                # work around inability to move shared filesystems
> +                iutil.execWithRedirect("mount",
> +                                       ["--rprivate", "/"],
> +                                       stderr="/dev/tty5", stdout="/dev/tty5")
>                  iutil.execWithRedirect("mount",
>                                         ["--move", INSTALL_TREE, ISO_DIR],
>                                         stderr="/dev/tty5", stdout="/dev/tty5")

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list