From patchwork Thu Apr 12 15:08:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 10338783 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 EDBE5602D8 for ; Thu, 12 Apr 2018 15:19:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3A9726E90 for ; Thu, 12 Apr 2018 15:19:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7C1227968; Thu, 12 Apr 2018 15:19:17 +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=unavailable 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 9010A26E90 for ; Thu, 12 Apr 2018 15:19:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753782AbeDLPTF (ORCPT ); Thu, 12 Apr 2018 11:19:05 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:42786 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753464AbeDLPI4 (ORCPT ); Thu, 12 Apr 2018 11:08:56 -0400 Received: by mail-wr0-f195.google.com with SMTP id s18so5468311wrg.9 for ; Thu, 12 Apr 2018 08:08:55 -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=XNFA902IJSMjfWeyhYuQpb4XMVGRxtT7zbWhEXz1HFY=; b=ROnpBLLeh0Njlj/5ec5zPzXsAR2Wmh3rv3il6R1EnVU3eWu/D/10ajWSmJMPmcROLm 71DQGeVTL96jQOGKwHH6GBCOPO98mmkz+LGBN3w+PezZZ1bj6cyu5+uU8POCr+HiCa1E OO7A7gyfzAgVyyraDwv36mtMf89Cl/hyxxLPajDc3tFVpgDF2xoYgrQAgSZb5UJlhif4 c9TCu7qgirIpbzA7w585t/GO7uYUlQfY85qDsSgY+KDgEkjswdFfumAxkBYj79mwPQgE EdBXOCt0E9hPohhxXDLMEE7V7itrN2deztK41oXfs1gbQ2UwkQyQIGsaRXBZi/R0VEZR +grQ== X-Gm-Message-State: ALQs6tABJavOo2TjlURMEKgC6G+Kdhsxz8s4taDOGmFePtnwAc4sxokv v2sMcwD0hFXUbTM1FiipKMN1cg== X-Google-Smtp-Source: AIpwx4/0LL5XMvuEdbicKnfxNcs6I7J1QZoY1GFRmhzTkM4MmTlX5xyKY2WCxMvwHexOzliaPxANCQ== X-Received: by 10.223.138.148 with SMTP id y20mr1042755wry.44.1523545734722; Thu, 12 Apr 2018 08:08:54 -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 p197sm2621783wme.43.2018.04.12.08.08.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Apr 2018 08:08:54 -0700 (PDT) From: Miklos Szeredi To: linux-unionfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 20/35] vfs: don't open real Date: Thu, 12 Apr 2018 17:08:11 +0200 Message-Id: <20180412150826.20988-21-mszeredi@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180412150826.20988-1-mszeredi@redhat.com> References: <20180412150826.20988-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 Let overlayfs do its thing when opening a file. This enables stacking and fixes the corner case when a file is opened for read, modified through a writable open, and data is read from the read-only file. After this patch the read-only open will not return stale data even in this case. Signed-off-by: Miklos Szeredi --- fs/open.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/fs/open.c b/fs/open.c index d509705d5740..1d1a52908b0f 100644 --- a/fs/open.c +++ b/fs/open.c @@ -857,13 +857,8 @@ EXPORT_SYMBOL(file_path); int vfs_open(const struct path *path, struct file *file, const struct cred *cred) { - struct dentry *dentry = d_real(path->dentry, NULL, file->f_flags, 0); - - if (IS_ERR(dentry)) - return PTR_ERR(dentry); - file->f_path = *path; - return do_dentry_open(file, d_backing_inode(dentry), NULL, cred); + return do_dentry_open(file, d_backing_inode(path->dentry), NULL, cred); } struct file *path_open(const struct path *path, int flags, struct inode *inode,