From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8778C35247 for ; Tue, 4 Feb 2020 16:17:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F7862087E for ; Tue, 4 Feb 2020 16:17:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b="eWrdZfPA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727347AbgBDQRC (ORCPT ); Tue, 4 Feb 2020 11:17:02 -0500 Received: from mail-il1-f193.google.com ([209.85.166.193]:35850 "EHLO mail-il1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727310AbgBDQRB (ORCPT ); Tue, 4 Feb 2020 11:17:01 -0500 Received: by mail-il1-f193.google.com with SMTP id b15so16365174iln.3 for ; Tue, 04 Feb 2020 08:17:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wQIybpWInC8dEcn8TOu2S7Vc2bFJuw35GnXDoWrVrY4=; b=eWrdZfPA0Db+MUje3N/HuEmwZOyaeosBDx/f0G6IvvIE+WI0ke3Nvq0WGuPCXC2jDM qT1Wii7UrAukJ0hyQDpwpEYXBJyGhXGrp6aIam2xPXDego5v+DZE0xVC9N0BVCDZOBax jdDYTJ1ccytb+uFgyrQw6kC0am3SaqWLi1EtI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wQIybpWInC8dEcn8TOu2S7Vc2bFJuw35GnXDoWrVrY4=; b=PqgS4USK+Cn0PPRnlaa7NFL4xlhTb+RZu99nU8rhDnmaR7Z+E2K8WQ9VpEtG4gNyJe L/lZj5kltjPmjGTKMa7BqLWJ+qxLLwVhje4ZMd/3Fz90lxIvXXWr4Tp4r3O9vqzRzGuO Mqe8Fwwp1FZGiYVme3ErxPvwMAlfCcQWy06bXjAjFmGRy3kj1D9tvoJw+QynbRokPlSW Nv8yzYWi0Db+6ol1AUDgqk1zoYxSn8JEdf4g+y1E0c28XEp5WiExaMkEMDkVlRh4kMBe iVGde3Sqc7k2E+XxNKyKsHUL4m/7ZA4D6xeCWduyOjPP3vu7pi/HTcP0lA6rBtfK9fN1 ekmA== X-Gm-Message-State: APjAAAWsohHa+RPYTU6QMsxuPtNnzFAXxhdqFsZw8LatGQJEeoZQLjQS mG9kfxD54vi5DWDAW9EAZHcMOPoLC/0ACfm+un91WQ== X-Google-Smtp-Source: APXvYqznXnYS/019OrdL+SBRAMPJmsEF4vFpFj57JhVELxARgBS1YjfanJc9rODx0aru+fp0+hinOoX8Y9ebV7mvVJY= X-Received: by 2002:a92:3c93:: with SMTP id j19mr19936750ilf.63.1580833020864; Tue, 04 Feb 2020 08:17:00 -0800 (PST) MIME-Version: 1.0 References: <20200131115004.17410-1-mszeredi@redhat.com> <20200131115004.17410-5-mszeredi@redhat.com> <20200204145951.GC11631@redhat.com> In-Reply-To: <20200204145951.GC11631@redhat.com> From: Miklos Szeredi Date: Tue, 4 Feb 2020 17:16:49 +0100 Message-ID: Subject: Re: [PATCH 4/4] ovl: alllow remote upper To: Vivek Goyal Cc: Miklos Szeredi , overlayfs , linux-fsdevel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-unionfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-unionfs@vger.kernel.org On Tue, Feb 4, 2020 at 3:59 PM Vivek Goyal wrote: > > On Fri, Jan 31, 2020 at 12:50:04PM +0100, Miklos Szeredi wrote: > > No reason to prevent upper layer being a remote filesystem. Do the > > revalidation in that case, just as we already do for lower layers. > > > > This lets virtiofs be used as upper layer, which appears to be a real use > > case. > > Hi Miklos, > > I have couple of very basic questions. > > - So with this change, we will allow NFS to be upper layer also? I haven't tested, but I think it will fail on the d_type test. > - What does revalidation on lower/upper mean? Does that mean that > lower/upper can now change underneath overlayfs and overlayfs will > cope with it. No, that's a more complicated thing. Especially with redirected layers (i.e. revalidating a redirect actually means revalidating all the path components of that redirect). > If we still expect underlying layers not to change, then > what's the point of calling ->revalidate(). That's a good question; I guess because that's what the filesystem expects. OTOH, it's probably unnecessary in most cases, since the path could come from an open file descriptor, in which case the vfs will not do any revalidation on that path. So this is basically done to be on the safe side, but it might not be necessary. Thanks, Miklos > Thanks > Vivek > > > > > Signed-off-by: Miklos Szeredi > > --- > > fs/overlayfs/namei.c | 3 +-- > > fs/overlayfs/super.c | 8 ++++++-- > > fs/overlayfs/util.c | 2 ++ > > 3 files changed, 9 insertions(+), 4 deletions(-) > > > > diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c > > index 76e61cc27822..0db23baf98e7 100644 > > --- a/fs/overlayfs/namei.c > > +++ b/fs/overlayfs/namei.c > > @@ -845,8 +845,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, > > if (err) > > goto out; > > > > - if (upperdentry && (upperdentry->d_flags & DCACHE_OP_REAL || > > - unlikely(ovl_dentry_remote(upperdentry)))) { > > + if (upperdentry && upperdentry->d_flags & DCACHE_OP_REAL) { > > dput(upperdentry); > > err = -EREMOTE; > > goto out; > > diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c > > index 26d4153240a8..ed3a11db9039 100644 > > --- a/fs/overlayfs/super.c > > +++ b/fs/overlayfs/super.c > > @@ -135,9 +135,14 @@ static int ovl_dentry_revalidate_common(struct dentry *dentry, > > unsigned int flags, bool weak) > > { > > struct ovl_entry *oe = dentry->d_fsdata; > > + struct dentry *upper; > > unsigned int i; > > int ret = 1; > > > > + upper = ovl_dentry_upper(dentry); > > + if (upper) > > + ret = ovl_revalidate_real(upper, flags, weak); > > + > > for (i = 0; ret > 0 && i < oe->numlower; i++) { > > ret = ovl_revalidate_real(oe->lowerstack[i].dentry, flags, > > weak); > > @@ -747,8 +752,7 @@ static int ovl_mount_dir(const char *name, struct path *path) > > ovl_unescape(tmp); > > err = ovl_mount_dir_noesc(tmp, path); > > > > - if (!err && (ovl_dentry_remote(path->dentry) || > > - path->dentry->d_flags & DCACHE_OP_REAL)) { > > + if (!err && path->dentry->d_flags & DCACHE_OP_REAL) { > > pr_err("filesystem on '%s' not supported as upperdir\n", > > tmp); > > path_put_init(path); > > diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c > > index 3ad8fb291f7d..c793722739e1 100644 > > --- a/fs/overlayfs/util.c > > +++ b/fs/overlayfs/util.c > > @@ -96,6 +96,8 @@ void ovl_dentry_update_reval(struct dentry *dentry, struct dentry *upperdentry, > > struct ovl_entry *oe = OVL_E(dentry); > > unsigned int i, flags = 0; > > > > + if (upperdentry) > > + flags |= upperdentry->d_flags; > > for (i = 0; i < oe->numlower; i++) > > flags |= oe->lowerstack[i].dentry->d_flags; > > > > -- > > 2.21.1 > > >