Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1945844ima; Thu, 25 Oct 2018 07:23:49 -0700 (PDT) X-Google-Smtp-Source: AJdET5dxjvWAA+9Ubm2eU4b5DADoeJ9bx5Qx8kCoyEZ6kNehWuTnD0iaFq1ad8s/6YuDD3Y0NNjf X-Received: by 2002:a17:902:14e:: with SMTP id 72-v6mr1670742plb.299.1540477429348; Thu, 25 Oct 2018 07:23:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540477429; cv=none; d=google.com; s=arc-20160816; b=kf7KrJkUZdyAdwBppFiA0+QA0w1YA4O6kYRIQCgk2NOPR744GaI/nUDlIAW1cLPMra YJBPVpYEPVG+4qAS660IOJ/7rhmJc1q39b9iJwZvVnKj4UuEdeGJhSyASkR/oOAEPS+8 5Mw0hfRxxklFRfBgzgRRxMVlMw7yT40lPtzXJuE2BMgc+xhnNJ1lkUfChBDqzb5T5H2C YIXSiPRbszttyHAsr6FGL2jOKZtj6hu+HZJndu7taHa+JNHvvYWhXhLFvUKrFB8fUkzk 6HmHcxSYF4QA+9chmf/9RI0CKiS6WHIT6s4Tc5/Q7s3TMUH1jahfm9r8c06z5YM1cJyT /upg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=nC7hfHsuDI1hg+E5FceyBjhNmF/YT62CCG3B9lvet8U=; b=qIDqpNrbuR2+2Z6DaaE6uPl+UXhMHE5B3n3qMVNOI5L7Q6MyCbxLsiUe+Ts0i0//ci 3FWvqNDsZiSVSAxpE9f2mTk1xgL32JPFhMGQ/w3bMPu0VEpqUxZtTXGA8w409XPh9XfL uUqwxrWQQUS0C6ROzWXosl1Zg4uGnu71F765E8CsJVQ3sXfCzZ+WYmERiUpuvSJxtJZF zoGaykswSLu3DGtIaJP4cYy4tVfu7jdcM+fT5sKb/YAZlMmviGNERK18dMIGHQzAwKaz XhPRXwyBhlE4ijzJdcE5G/jAuuNrKWl0geoAvFgVFHiZPy09oNiMYw4Lk61/6DIIzoTN PL4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gEHDvM2s; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j5-v6si8538521pgk.85.2018.10.25.07.22.41; Thu, 25 Oct 2018 07:23:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gEHDvM2s; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731456AbeJYWyP (ORCPT + 99 others); Thu, 25 Oct 2018 18:54:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:37148 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731391AbeJYWyO (ORCPT ); Thu, 25 Oct 2018 18:54:14 -0400 Received: from sasha-vm.mshome.net (unknown [167.98.65.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D44BD208A3; Thu, 25 Oct 2018 14:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540477276; bh=oUgCrfxuFoKusEFzDu8KhR5xjFkIXaKyFd7BWgyoW0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gEHDvM2sD2yg8T/hj3KmPlGwMorcWTzptH/Mcq38DhkDwBtq8Va0cdd+B30TT/uYT TKDvPt5nnqZ9atLtYE/cvIRTD/S18p30zwBGt58WNnV6JxQAqGaqwazml51rrsqVoI C3ciDsss9oX9GO8PQa9RhETjeb3FTe+NvG9ZWo00= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Miklos Szeredi , David Howells , Sasha Levin Subject: [PATCH AUTOSEL 3.18 92/98] ovl: fix open in stacked overlay Date: Thu, 25 Oct 2018 10:18:47 -0400 Message-Id: <20181025141853.214051-92-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025141853.214051-1-sashal@kernel.org> References: <20181025141853.214051-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miklos Szeredi [ Upstream commit 1c8a47df36d72ace8cf78eb6c228aa0f8027d3c2 ] If two overlayfs filesystems are stacked on top of each other, then we need recursion in ovl_d_select_inode(). I guess d_backing_inode() is supposed to do that. But currently it doesn't and that functionality is open coded in vfs_open(). This is now copied into ovl_d_select_inode() to fix this regression. Reported-by: Alban Crequy Signed-off-by: Miklos Szeredi Fixes: 4bacc9c9234c ("overlayfs: Make f_path always point to the overlay...") Cc: David Howells Cc: # v4.2+ Signed-off-by: Sasha Levin --- fs/overlayfs/inode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index df5c2853c4e5..a01ec1836a72 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c @@ -377,6 +377,9 @@ struct inode *ovl_d_select_inode(struct dentry *dentry, unsigned file_flags) ovl_path_upper(dentry, &realpath); } + if (realpath.dentry->d_flags & DCACHE_OP_SELECT_INODE) + return realpath.dentry->d_op->d_select_inode(realpath.dentry, file_flags); + return d_backing_inode(realpath.dentry); } -- 2.17.1