From patchwork Tue May 29 14:43:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 10436031 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 10160601E9 for ; Tue, 29 May 2018 15:08:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0333828787 for ; Tue, 29 May 2018 15:08:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC6E3287A0; Tue, 29 May 2018 15:08:14 +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 A450428787 for ; Tue, 29 May 2018 15:08:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935870AbeE2PEH (ORCPT ); Tue, 29 May 2018 11:04:07 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36125 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935865AbeE2Oo1 (ORCPT ); Tue, 29 May 2018 10:44:27 -0400 Received: by mail-wm0-f68.google.com with SMTP id v131-v6so22135762wma.1 for ; Tue, 29 May 2018 07:44:26 -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=oY8GzodkP1mJ28P5zQqTuUgh/nz0SR/11tIWB16S9t2jSs9p8MMEGzKQ/XvDnClUAb E6sB+yswR521smczqzZE3IeWomgmnwqqmXNoqarhq1Qk6GSSWCF5hZEqiWUAhxHUebiM xhpQ7OS+AUtYxmjm5fH5SkfYt6PllerPyY2FWR5BFZCnvlsS7h36u07AylwRy0j4EFVy J6KQYNp6Ez0N/wjR/Kr6iahDMIObaNPppEsbHGvnAIfHCVCAwGfbdoI1o056Eyb/yMPf QLumqoapgkWq6Lf9oFqNbsmyfpxPdy3Z5SswDRvMNawX6Xgz4PKqRAQi2JfR3w4Bp7/J Fgeg== X-Gm-Message-State: ALKqPwdAMWAoyYARDIV3E5x3+F9+/t856Fi80IP4u8au5O2CJPHKM2bN tbSVyUKP02R7/0UcGHYkPuqphQ== X-Google-Smtp-Source: ADUXVKI3/5d0SAvrjzdmu6pVdCGBwW1BpMv80yYW/8EpbmhER/gYvfyZ/XErm5nkT6fsNHSIQ78NwQ== X-Received: by 2002:a1c:2cc2:: with SMTP id s185-v6mr10557768wms.62.1527605065909; Tue, 29 May 2018 07:44:25 -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 t198-v6sm18834422wmt.23.2018.05.29.07.44.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 May 2018 07:44:25 -0700 (PDT) From: Miklos Szeredi To: linux-unionfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 36/39] Revert "vfs: do get_write_access() on upper layer of overlayfs" Date: Tue, 29 May 2018 16:43:36 +0200 Message-Id: <20180529144339.16538-37-mszeredi@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180529144339.16538-1-mszeredi@redhat.com> References: <20180529144339.16538-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: