Re: [PATCH 1/4] overlay: add helper for mounting rdonly overlay

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 6, 2023 at 11:50 AM <alexl@xxxxxxxxxx> wrote:
>
> From: Amir Goldstein <amir73il@xxxxxxxxx>
>
> Allow passing empty upperdir to _overlay_mount_dirs().
>
> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>

Signed-off-by: Alexander Larsson <alexl@xxxxxxxxxx>

> ---
>  common/overlay | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/common/overlay b/common/overlay
> index 20cafeb1..452b3b09 100644
> --- a/common/overlay
> +++ b/common/overlay
> @@ -17,15 +17,19 @@ if [ -n "$OVL_BASE_FSTYP" ];then
>  fi
>
>  # helper function to do the actual overlayfs mount operation
> +# accepts "-" as upperdir for non-upper overlayfs
>  _overlay_mount_dirs()
>  {
>         local lowerdir=$1
>         local upperdir=$2
>         local workdir=$3
>         shift 3
> +       local diropts="-olowerdir=$lowerdir"
>
> -       $MOUNT_PROG -t overlay -o lowerdir=$lowerdir -o upperdir=$upperdir \
> -                   -o workdir=$workdir `_common_dev_mount_options $*`
> +       [ -n "$upperdir" ] && [ "$upperdir" != "-" ] && \
> +               diropts+=",upperdir=$upperdir,workdir=$workdir"
> +
> +       $MOUNT_PROG -t overlay $diropts `_common_dev_mount_options $*`
>  }
>
>  # Mount with same options/mnt/dev of scratch mount, but optionally
> --
> 2.40.1
>


-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                Red Hat, Inc
       alexl@xxxxxxxxxx         alexander.larsson@xxxxxxxxx





[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux