Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754569AbcK1Jpc (ORCPT ); Mon, 28 Nov 2016 04:45:32 -0500 Received: from mail-wj0-f195.google.com ([209.85.210.195]:33230 "EHLO mail-wj0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754447AbcK1JpX (ORCPT ); Mon, 28 Nov 2016 04:45:23 -0500 Date: Mon, 28 Nov 2016 10:45:18 +0100 From: Miklos Szeredi To: Quentin Casasnovas Cc: linux-kernel@vger.kernel.org, linux-unionfs@vger.kernel.org, Al Viro Subject: Re: [PATCH] ovl: tentative fix for broken vfs_open() on stacked overlayfs. Message-ID: <20161128094518.GC2622@veci.piliscsaba.szeredi.hu> References: <20161125145604.GG6842@chrystal.oracle.com> <20161125170923.21674-1-quentin.casasnovas@oracle.com> <20161125192847.GH6842@chrystal.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161125192847.GH6842@chrystal.oracle.com> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1169 Lines: 37 On Fri, Nov 25, 2016 at 08:28:47PM +0100, Quentin Casasnovas wrote: > On Fri, Nov 25, 2016 at 06:09:23PM +0100, Quentin Casasnovas wrote: > > If two overlayfs filesystems are stacked on top of each other, then we need > > to recurse when opening a file. This used to work and was first broken by: > > > > 4bacc9c9234c ("overlayfs: Make f_path always point to the overlay...") > > > > and fixed by: > > > > 1c8a47df36d7 ("ovl: fix open in stacked overlay") > > > > But it looks like it was re-introduced in: > > > > 2d902671ce1c ("vfs: merge .d_select_inode() into .d_real()") Thanks for the report. Following patch should fix it (it's there in your patch, so you weren't too far off). It needs more testing and review, but I think it fixes the basic problem. Thanks, Miklos diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index edd46a0e951d..f4d2f63fa53a 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -328,7 +328,7 @@ static struct dentry *ovl_d_real(struct dentry *dentry, if (!real) goto bug; - if (!inode || inode == d_inode(real)) + if (inode && inode == d_inode(real)) return real; /* Handle recursion */