From patchwork Tue May 29 14:46:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 10435795 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EA970602BF for ; Tue, 29 May 2018 14:51:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5C08287CC for ; Tue, 29 May 2018 14:51:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D28EA287BB; Tue, 29 May 2018 14:51:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A86C287CC for ; Tue, 29 May 2018 14:51:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936616AbeE2Ovk (ORCPT ); Tue, 29 May 2018 10:51:40 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:42500 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936620AbeE2Oqf (ORCPT ); Tue, 29 May 2018 10:46:35 -0400 Received: by mail-wr0-f196.google.com with SMTP id w10-v6so26004799wrk.9 for ; Tue, 29 May 2018 07:46:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/Fw//Sdq+J+5UztSoktKaLs/Y8gwivnNzbPrztp8Ieg=; b=mjrMQrAlJ2GP95E8alRmiKoKefW0a9ezxNT048cbWjBgkMZqx3rEAxwKSzukeE+DEI kVzhz0EIHNo6B7PlZ0kT7FMj0ePj0T0GnA8YZK9rb90cPkV1HuB8WleJsvVsCVVsrWHk WLdFf8vnHkQDvxpF1IixaYAWEJYz100uK9INbFTI42RroxHAjcd/BnFKdrLnhBgTuwa/ 1EdnrRw/Fj1OVtgm6/69rq0syYrp43rW2tc38h3H856N3f8Nu42Uyb7YITUfp5Mvv9Zw eXNMzLM4fNycl2wMoaGqr4PRRxjhZ5HPLTSCCNKyq8XOUVyYVkqgzMIgIdl6PFucQgwF LE8A== X-Gm-Message-State: ALKqPwfaazNrZEcgZPieugnLehZrxodt7HAfnhYrsgg1sEz70BR2nidm RyhXofbaj2aUHjWIcVdTi72ADZRuaVI= X-Google-Smtp-Source: ADUXVKKgaQ4gCgKmgrG6Ch6eheyINoEXO5S6l0snIko6DnAqibIauxbsxyrosnrLgDlebrHxYlXQlQ== X-Received: by 2002:adf:e987:: with SMTP id h7-v6mr7547168wrm.102.1527605194650; Tue, 29 May 2018 07:46:34 -0700 (PDT) Received: from veci.piliscsaba.redhat.com (catv-176-63-54-97.catv.broadband.hu. [176.63.54.97]) by smtp.gmail.com with ESMTPSA id n71-v6sm20942227wmi.14.2018.05.29.07.46.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 May 2018 07:46:34 -0700 (PDT) From: Miklos Szeredi To: linux-unionfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 16/28] ovl: Do not expose metacopy only dentry from d_real() Date: Tue, 29 May 2018 16:46:00 +0200 Message-Id: <20180529144612.16675-17-mszeredi@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180529144612.16675-1-mszeredi@redhat.com> References: <20180529144612.16675-1-mszeredi@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Vivek Goyal Metacopy dentry/inode is internal to overlay and is never exposed outside of it. Exception is metacopy upper file used for fsync(). Modify d_real() to look for dentries/inode which have data, but also allow matching upper inode without data for the fsync case. Signed-off-by: Vivek Goyal Reviewed-by: Amir Goldstein Signed-off-by: Miklos Szeredi --- fs/overlayfs/super.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index e0326a686f45..6687d547ec6b 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -101,10 +101,13 @@ static struct dentry *ovl_d_real(struct dentry *dentry, } real = ovl_dentry_upper(dentry); - if (real && (!inode || inode == d_inode(real))) + if (real && (inode == d_inode(real))) return real; - real = ovl_dentry_lower(dentry); + if (real && !inode && ovl_has_upperdata(d_inode(dentry))) + return real; + + real = ovl_dentry_lowerdata(dentry); if (!real) goto bug;