Received: by 10.192.165.156 with SMTP id m28csp2079130imm; Thu, 12 Apr 2018 08:16:18 -0700 (PDT) X-Google-Smtp-Source: AIpwx48ITRAsB1G7lrYLRCo6MtR7CGVwoxZx8dtqRBjBSdjCOuUnN2rLidOPPDD0zY3sOcu7PXQN X-Received: by 10.99.49.84 with SMTP id x81mr1019473pgx.38.1523546178065; Thu, 12 Apr 2018 08:16:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523546178; cv=none; d=google.com; s=arc-20160816; b=TjNGh3IyKa56nUpBOAT4pisDdX9XZNLgWZoizFuf7L4xO9xPMc/az9wxhY/q+hR4et 6A8NksDrplbZKAZolSfpNi49TJeXr47LrxPiw6kY2I7Dj2JbMnkZsdQh94DVGUb0kOMW kekW3CPtZ8BC6bWOBKzIn7GGrarMgprw+6yQWj1VlQVSA9S4BYUD9c0j8MOJFAK7MKTv CtxxZlZwVKHuIGhkpdhiKXTVEfJsNprh01ztLiYG5qh+fcUnj3f/gLXYVUlbjOzQG26w ISu964NxcIsi7OlcxDFc2cueN5pH4DINBOxAEthZA0HZI5GYRXXsUlIzdZAYX89Y8sKa qbYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=kg8/M5BVcPb9m1YSZ82vMN0CRx5jMCverOmksuvEb0w=; b=tq+ONUgSFKziTPfzicQBKc774phmeOFoH9qB+QeMRMzsLD9ifXDou7pHjExNFN555h Yb6kPR08LbuYnpMbnalHPOckA7++EsDLj1pSUVZ3Xal5AuX8ZN+mR0RtYPtQe/o9LjY4 Gw55mxC49uvXruTzhd/kL8Ltws8F6WajMFlE8i5iLVXVK4NvgsL/rsVDNVWGldWmj3fX YcABmzw90KAmBkQIeFdCV93VL+i0k+nWhRhr0SPjh/mBAJ9pi834/Lve6UF8C2fvUovx Is4xgTSaL7tJEVPtNOZ5BwOLHd65i2iorEsD0yInXlvrSkuewBfuJD0xzogBr6PYbAmf G3cA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e17si2341782pgt.179.2018.04.12.08.15.40; Thu, 12 Apr 2018 08:16:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753991AbeDLPL2 (ORCPT + 99 others); Thu, 12 Apr 2018 11:11:28 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:40794 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753680AbeDLPJG (ORCPT ); Thu, 12 Apr 2018 11:09:06 -0400 Received: by mail-wr0-f194.google.com with SMTP id v60so1557986wrc.7 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=RkK4rC84cbjfha56WtwsXltttD1Jl7ux63zrpRuSqs5hsiox2SQ+74zpwMkYzWJMcv jnAfTchqgUdG78jL7fxjWixcJOvJdefhLql+qG8FFXvbfGMc6OtGtfBkO3XJ5Zk1y2Xv 1n9VfozCOO8Pn80hbRdvvG0UOhO0bfZf4ByPqI9C+mJPCxdVRA3Lm02fc7YXbslZ6eLp +TW+8TcmGiutdmFgjJTGiDelA7QjIUIa9zXfij6uIeoW5VTR/Tvz11Sw9JyWushtwuAI tA1Sx0iO2HoGbbFuPmoxkGDWoYRzukRSnKq6wJi2+pp5mrY71ZbwIGXlgBiT/OdJC9KG 2iOg== X-Gm-Message-State: ALQs6tCZmL7iqN/JR6ZEubOUChdfc8lXZYoA1P2HD3uta6h6AbouJ3uP +4zwkNs3OaOypbtLjmlOHxAoMw== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: -- 2.14.3