From patchwork Mon Jul 10 09:07:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Larsson X-Patchwork-Id: 13306545 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD5B3EB64D9 for ; Mon, 10 Jul 2023 09:10:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231273AbjGJJK5 (ORCPT ); Mon, 10 Jul 2023 05:10:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231358AbjGJJKv (ORCPT ); Mon, 10 Jul 2023 05:10:51 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 945E9100 for ; Mon, 10 Jul 2023 02:10:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688980209; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0q1N+KdGgbcn7sWWxv1wc0IDT0uUUrSHOTo56c4NlAo=; b=fXyod4s0JWvlyPh7J4nPuwbYKSzK4BfTKj+ykz1dbvMzdyAoJwF3kbuXED6lCrEtov2b9p 9ld6ofadjhi/R9RTHYCmjk/ri5ENyg22Q8EB9FzDWaw0Zq8ddUBaujC7E6Kvn9B0hGITfV h96uhnuUcf+aboYmp/CB2vmjxMr/ok4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-573-JSY_sC8MPIqnQqGUgAwNNQ-1; Mon, 10 Jul 2023 05:07:25 -0400 X-MC-Unique: JSY_sC8MPIqnQqGUgAwNNQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D5B93803B25; Mon, 10 Jul 2023 09:07:24 +0000 (UTC) Received: from greebo.redhat.com (unknown [10.39.193.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 11552F5CED; Mon, 10 Jul 2023 09:07:23 +0000 (UTC) From: alexl@redhat.com To: fstests@vger.kernel.org Cc: linux-unionfs@vger.kernel.org, amir73il@gmail.com, alexl@redhat.com Subject: [PATCH v2 1/4] overlay: add helper for mounting rdonly overlay Date: Mon, 10 Jul 2023 11:07:10 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Amir Goldstein Allow passing empty upperdir to _overlay_mount_dirs(). Signed-off-by: Amir Goldstein Signed-off-by: Alexander Larsson --- 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