linux-unionfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Vyacheslav Yurkov <uvv.mail@gmail.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	overlayfs <linux-unionfs@vger.kernel.org>,
	Vyacheslav Yurkov <Vyacheslav.Yurkov@bruker.com>
Subject: Re: [PATCH v2 3/3] ovl: do not set overlay.opaque for new directories
Date: Thu, 27 May 2021 20:34:54 +0300	[thread overview]
Message-ID: <CAOQ4uxgAdfMXV6HW6KWvUHG6CMuayd9_t3=HJCsz95x60of5cA@mail.gmail.com> (raw)
In-Reply-To: <20210527140534.107607-3-uvv.mail@gmail.com>

On Thu, May 27, 2021 at 5:06 PM Vyacheslav Yurkov <uvv.mail@gmail.com> wrote:
>
> From: Vyacheslav Yurkov <Vyacheslav.Yurkov@bruker.com>
>
> Disable optimizations if user opted-in for any of extended features.

The code is correct. The comment is negated.
Your setup is a default setup - you did NOT opt-in to any new feature.
Only in setups like those we disable the optimization.

Thanks,
Amir.

> If optimization is enabled, it breaks existing use case when a lower layer
> directory appears after directory was created on a merged layer. If
> overlay.opaque is applied, new files on lower layer are not visible.
>
> Consider the following scenario:
> - /lower and /upper are mounted to /merged
> - directory /merged/new-dir is created with a file test1
> - overlay is unmounted
> - directory /lower/new-dir is created with a file test2
> - overlay is mounted again
>
> If opaque is applied by default, file test2 is not going to be visible
> without explicitly clearing the overlay.opaque attribute
>
> Signed-off-by: Vyacheslav Yurkov <Vyacheslav.Yurkov@bruker.com>
> ---
>  fs/overlayfs/dir.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
> index 93efe7048a77..03a22954fe61 100644
> --- a/fs/overlayfs/dir.c
> +++ b/fs/overlayfs/dir.c
> @@ -320,6 +320,7 @@ static bool ovl_type_origin(struct dentry *dentry)
>  static int ovl_create_upper(struct dentry *dentry, struct inode *inode,
>                             struct ovl_cattr *attr)
>  {
> +       struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
>         struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent);
>         struct inode *udir = upperdir->d_inode;
>         struct dentry *newdentry;
> @@ -338,7 +339,8 @@ static int ovl_create_upper(struct dentry *dentry, struct inode *inode,
>         if (IS_ERR(newdentry))
>                 goto out_unlock;
>
> -       if (ovl_type_merge(dentry->d_parent) && d_is_dir(newdentry)) {
> +       if (ovl_type_merge(dentry->d_parent) && d_is_dir(newdentry) &&
> +           !ovl_allow_offline_changes(ofs)) {
>                 /* Setting opaque here is just an optimization, allow to fail */
>                 ovl_set_opaque(dentry, newdentry);
>         }
> --
> 2.25.1
>

  reply	other threads:[~2021-05-27 17:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-27 14:05 [PATCH v2 1/3] ovl: disable uuid when redirect_dir is used Vyacheslav Yurkov
2021-05-27 14:05 ` [PATCH v2 2/3] ovl: add ovl_allow_offline_changes() helper Vyacheslav Yurkov
2021-05-27 17:32   ` Amir Goldstein
2021-05-27 14:05 ` [PATCH v2 3/3] ovl: do not set overlay.opaque for new directories Vyacheslav Yurkov
2021-05-27 17:34   ` Amir Goldstein [this message]
2021-05-27 17:39 ` [PATCH v2 1/3] ovl: disable uuid when redirect_dir is used Amir Goldstein

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='CAOQ4uxgAdfMXV6HW6KWvUHG6CMuayd9_t3=HJCsz95x60of5cA@mail.gmail.com' \
    --to=amir73il@gmail.com \
    --cc=Vyacheslav.Yurkov@bruker.com \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=uvv.mail@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).