From patchwork Mon May 7 08:37:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 10383567 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 660EF60353 for ; Mon, 7 May 2018 08:45:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CEA2286DF for ; Mon, 7 May 2018 08:45:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5179228A96; Mon, 7 May 2018 08:45:59 +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 E6307286DF for ; Mon, 7 May 2018 08:45:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752401AbeEGImn (ORCPT ); Mon, 7 May 2018 04:42:43 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:39060 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752183AbeEGIij (ORCPT ); Mon, 7 May 2018 04:38:39 -0400 Received: by mail-wm0-f67.google.com with SMTP id f8-v6so13831513wmc.4 for ; Mon, 07 May 2018 01:38:38 -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=V2OmmVFBuUSgQckE8B0XrGIAQg/4IsUcPqZSEaSvA5o=; b=B5/glxF+mAl/SRgCkHVuMxh2paj//OwP+nAcv3VO58IRhMSYU4jxt5K9ddXFcAeaMC 4Li7E40p5xLDOhrRGhoAkJpSZ8M+jYCTYo8cLiGtNa9joFMlWs/C08ZL5kDwApb/FwsL yHgOMCsbO4bw59E8tJbi3t3yYlvaFZRP2MEiyT1xscK7Zwtw8+dF1MPn2TqM3NdBVgIX bXMuNM36niY0FG8XF+NPVf3mLK6LVHSWEWcHr/kRJfs+toQH3KQHigkfoBYh+Q/D818U iXu4UeivZ3IkBPQfP/2wheJSJaPg3HYRbr2MTamUqKfk7Q5ZeXMB+tvKehHe0S/2eMiy 5Uug== X-Gm-Message-State: ALKqPwfC4QheRtgU8LEFKKFl9jH+s25EDAGAKxAS6hMWF3mSvIXCHFcP i7/JzrVMzgrfMV0nTms+qtZaDQ== X-Google-Smtp-Source: AB8JxZoZ44kg72TIlboG5TeeOv0XTxgxWk5k0Hm6O2X6yWmVj26AASntgUVt3w4o9IN0Fkp95dTK3g== X-Received: by 2002:a1c:1a53:: with SMTP id a80-v6mr190238wma.36.1525682317608; Mon, 07 May 2018 01:38:37 -0700 (PDT) Received: from veci.piliscsaba.redhat.com (C2B0E321.catv.pool.telekom.hu. [194.176.227.33]) by smtp.gmail.com with ESMTPSA id h8-v6sm5908050wmc.16.2018.05.07.01.38.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 May 2018 01:38:37 -0700 (PDT) From: Miklos Szeredi To: linux-unionfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Al Viro Subject: [PATCH v2 22/35] vfs: don't open real Date: Mon, 7 May 2018 10:37:54 +0200 Message-Id: <20180507083807.28792-23-mszeredi@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180507083807.28792-1-mszeredi@redhat.com> References: <20180507083807.28792-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 6e52fd6fea7c..244cd2ecfefd 100644 --- a/fs/open.c +++ b/fs/open.c @@ -897,13 +897,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); } /**