From patchwork Thu Apr 12 15:08:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 10338711 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 541FE60134 for ; Thu, 12 Apr 2018 15:11:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4806927C2D for ; Thu, 12 Apr 2018 15:11:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C6F227D0E; Thu, 12 Apr 2018 15:11:47 +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 D2A0A27C2D for ; Thu, 12 Apr 2018 15:11:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753682AbeDLPL2 (ORCPT ); Thu, 12 Apr 2018 11:11:28 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:36828 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753681AbeDLPJG (ORCPT ); Thu, 12 Apr 2018 11:09:06 -0400 Received: by mail-wr0-f196.google.com with SMTP id q13so2037455wre.3 for ; Thu, 12 Apr 2018 08:09:06 -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=kg8/M5BVcPb9m1YSZ82vMN0CRx5jMCverOmksuvEb0w=; b=svB+XVzTVkqjgnq/7quDyGo+1BRfrZQawfenp7Rc6Wu7QVDPW8qK5+dtpCcc7hb9BI TUUmn4MFhTBrk4D0CBw3DTmEz2eOEupfzFaEbKBL2rp0S8G5XiMvENS8rxr9NE8WAEGr NKWAYsDfxlOlPZKjdTnuZ8aNRFYLWatr1yCMbaZLnmjas0a8en6UIZuax+fGpeMXfJu+ IsFSlhf+gZC6WgeQGQhawUBV84nZY4xke8SFta6iuxgn36L2IRN5im+vcPfvmoTFHPdx xPqgnSoS+Ksoxy4TxCFX9vL8v6sWddOW8uLnfqT6q1wel/zVdO7xAaTnyLpOYvceLotJ KIPA== X-Gm-Message-State: ALQs6tBpNPEnkFWXIH81HTAP3DNQvZAVlQYYDhs1nSKh5z6vcv4qJgIU 4c9WPnbv0wXJpAZzc9SVWkWqqg== X-Google-Smtp-Source: AIpwx4+9MnKgeFnHeUmnR9R38gylrnOOWCbeTMC3Gwy/PMFQn9SQwXDxOYph4k17WUcTDuvypTLlrQ== X-Received: by 10.223.143.86 with SMTP id p80mr1178015wrb.31.1523545745493; Thu, 12 Apr 2018 08:09:05 -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.09.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Apr 2018 08:09:05 -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 29/35] Revert "vfs: do get_write_access() on upper layer of overlayfs" Date: Thu, 12 Apr 2018 17:08:20 +0200 Message-Id: <20180412150826.20988-30-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 This reverts commit 4d0c5ba2ff79ef9f5188998b29fd28fcb05f3667. We now get write access on both overlay and underlying layers so this patch is no longer needed for correct operation. Signed-off-by: Miklos Szeredi --- fs/locks.c | 3 +-- fs/open.c | 15 ++------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/fs/locks.c b/fs/locks.c index d6ff4beb70ce..8e9431a178a5 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -1654,8 +1654,7 @@ check_conflicting_open(const struct dentry *dentry, const long arg, int flags) if (flags & FL_LAYOUT) return 0; - if ((arg == F_RDLCK) && - (atomic_read(&d_real_inode(dentry)->i_writecount) > 0)) + if ((arg == F_RDLCK) && (atomic_read(&inode->i_writecount) > 0)) return -EAGAIN; if ((arg == F_WRLCK) && ((d_count(dentry) > 1) || diff --git a/fs/open.c b/fs/open.c index 73f3d0f35742..1b2f22d25545 100644 --- a/fs/open.c +++ b/fs/open.c @@ -68,7 +68,6 @@ int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs, long vfs_truncate(const struct path *path, loff_t length) { struct inode *inode; - struct dentry *upperdentry; long error; inode = path->dentry->d_inode; @@ -91,17 +90,7 @@ long vfs_truncate(const struct path *path, loff_t length) if (IS_APPEND(inode)) goto mnt_drop_write_and_out; - /* - * If this is an overlayfs then do as if opening the file so we get - * write access on the upper inode, not on the overlay inode. For - * non-overlay filesystems d_real() is an identity function. - */ - upperdentry = d_real(path->dentry, NULL, O_WRONLY); - error = PTR_ERR(upperdentry); - if (IS_ERR(upperdentry)) - goto mnt_drop_write_and_out; - - error = get_write_access(upperdentry->d_inode); + error = get_write_access(inode); if (error) goto mnt_drop_write_and_out; @@ -120,7 +109,7 @@ long vfs_truncate(const struct path *path, loff_t length) error = do_truncate(path->dentry, length, 0, NULL); put_write_and_out: - put_write_access(upperdentry->d_inode); + put_write_access(inode); mnt_drop_write_and_out: mnt_drop_write(path->mnt); out: