From patchwork Mon May 7 08:38:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 10383451 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 7778560353 for ; Mon, 7 May 2018 08:39:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D19728A96 for ; Mon, 7 May 2018 08:39:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 615CE28B2C; Mon, 7 May 2018 08:39:26 +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 190CF28A96 for ; Mon, 7 May 2018 08:39:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752329AbeEGIjS (ORCPT ); Mon, 7 May 2018 04:39:18 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35334 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752249AbeEGIit (ORCPT ); Mon, 7 May 2018 04:38:49 -0400 Received: by mail-wm0-f68.google.com with SMTP id o78-v6so13874794wmg.0 for ; Mon, 07 May 2018 01:38:48 -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=yKU4lfqn9wFsOSDbrge2pgxLuOH+3O0+7qQ9e41r/Ik=; b=H34o8yB0iJuSpeuSlp1RrwnCtEYMv6QsAB6x63tEgNhfqh5bcnUtTDcpucGL0hX030 Lf9vurue/AXUq8/mWEjdK5uznM66W/IiL2xBrWgzcjxO5t03Zbz8n6eq+sILkXZ/04ba GoAzLJ7AA/pr/05o0+dJi8HymCtWeE1Ewfqlg70GKU5X70dKAc3lid8KWiFxRd06xudG 7/ezASRr8nNah1Hr5CuXfGePxB7qli/RMMMCuuW97JRBD36FG+TdhfC42ARjlaNxBNtW HR2PMCLp8QEvsKb5PKZHyA0Wyr3PTzkr9M0hP/rp9/hC22LLBZ6HnSuDCgQocv9Ocho8 phMg== X-Gm-Message-State: ALKqPwchzSUpo5Sdug1BcUKCahMhZuTpLQXTgrbtmH76wLG4+tWveY11 lWr4ugIOOFqVnrKSb+pm9Bw6vjAA2c0= X-Google-Smtp-Source: AB8JxZo+s0CBisNClht1LJvD94GsQ1tv2cY7j9arqeRAzu2TWTtjuwEKAutcWOiLcoqC2DZYMCPaMw== X-Received: by 2002:a1c:ec4b:: with SMTP id k72-v6mr180846wmh.27.1525682327724; Mon, 07 May 2018 01:38:47 -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.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 May 2018 01:38:47 -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 31/35] Revert "vfs: do get_write_access() on upper layer of overlayfs" Date: Mon, 7 May 2018 10:38:03 +0200 Message-Id: <20180507083807.28792-32-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 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 62bbe8b31f26..9c0e5f3da66c 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 127b49819afb..0d63b57c7f89 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: