X-Received: by 2002:a17:90b:789:b0:1bc:293c:1445 with SMTP id l9-20020a17090b078900b001bc293c1445mr2249750pjz.111.1645505090643; Mon, 21 Feb 2022 20:44:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645505090; cv=none; d=google.com; s=arc-20160816; b=vL43UZnUGmDMdjL30ApVOJOSZXc8sovIQEWKCcmD3/n2kY/x/C7Ac6FHp8A9sjoykt LzmNSghMiW/LyzaARRPAoSL6m2mFqxxPa/TzQ1qt7bEe4K4OiInUcfTmMVbCLTBzWBgv USy3bXushSDhq/bVD5vtm6fZ8qK5z4pMrtwxGIj7Wxhq2RDvr16Xc5lHEG8L58pTRf8F 3c5KA0B+KJbAszsOYv62jgaGpQaPniQpaDPBJpDNLEHJMtVHzCHWfLU6FtNDl8VdsUsU Ev30BosNXpclQ0eOWKl1o84dM15L5mChIO7cM7FKqXdgJwh1JvHuWlL45QN6B4ELujBF HA6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HaIS5YzcRzIGp2Yv6rkMs6eUNaFxadEt0atqkkJK+nw=; b=ZSVxdp8ra8i0ehB4K2VX5Kj1YaZLczDDX/ewd77LlKQKlcVvfA6fokaClFXyLDWSX6 u2+8u1aU5SYdYZlaEFplQquf0lNnfRMybCp8Tic9eQpmENC0g4AJA7QlkYV7t0anee54 o1qqIkLX8KzfOZ0twklfhYo8gaqdW6/n61SOmCrKiq6HKUIhTrOC86lsNthE/oGNCCv4 PBGPP+5oisb5a1goTy2Ojqi6VZoZ3zEeiu4i2KxJS2EzXYYVUw4d0dv7CGTiHAvVju7k EPAkrFUc/tuaIHc7Ih8bsc6JDw3EW1sGRpshnkHX9zdxR/uoJYcNuWpQhDjOXzvC2Bdj CkRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hlUvpoT6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u10si4513032plh.26.2022.02.21.20.44.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 20:44:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hlUvpoT6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 49BAC140F7; Mon, 21 Feb 2022 20:28:32 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350615AbiBUJjB (ORCPT + 99 others); Mon, 21 Feb 2022 04:39:01 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:36338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350332AbiBUJav (ORCPT ); Mon, 21 Feb 2022 04:30:51 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F42C25E9B; Mon, 21 Feb 2022 01:13:18 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id ED8FCCE0E92; Mon, 21 Feb 2022 09:13:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C73C1C339C1; Mon, 21 Feb 2022 09:13:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1645434789; bh=LlrEcvhY71E33DIPn31y+UFouQ9wZxklBPAu27DkQ20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hlUvpoT6Ndag7uLDRJ9HkoJMS7xjQ79yVfmqEXBDkL4HbL69GFhLW/PcZiWj3Chg+ WARBeg0tv2U5gvoj1AzqmQnLTZTxENKsiriGz2E6GX2uH2fI2iTlLBXZBc6VBJ3/ug skJkoYEwzwzV3dKhloetR34YPuHvS4BQZLxfZ1Bs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Menzel , Trond Myklebust , Donald Buczek , Anna Schumaker Subject: [PATCH 5.15 132/196] NFS: LOOKUP_DIRECTORY is also ok with symlinks Date: Mon, 21 Feb 2022 09:49:24 +0100 Message-Id: <20220221084935.342839045@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221084930.872957717@linuxfoundation.org> References: <20220221084930.872957717@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Trond Myklebust commit e0caaf75d443e02e55e146fd75fe2efc8aed5540 upstream. Commit ac795161c936 (NFSv4: Handle case where the lookup of a directory fails) [1], part of Linux since 5.17-rc2, introduced a regression, where a symbolic link on an NFS mount to a directory on another NFS does not resolve(?) the first time it is accessed: Reported-by: Paul Menzel Fixes: ac795161c936 ("NFSv4: Handle case where the lookup of a directory fails") Signed-off-by: Trond Myklebust Tested-by: Donald Buczek Signed-off-by: Anna Schumaker Signed-off-by: Greg Kroah-Hartman --- fs/nfs/dir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -1987,14 +1987,14 @@ no_open: if (!res) { inode = d_inode(dentry); if ((lookup_flags & LOOKUP_DIRECTORY) && inode && - !S_ISDIR(inode->i_mode)) + !(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) res = ERR_PTR(-ENOTDIR); else if (inode && S_ISREG(inode->i_mode)) res = ERR_PTR(-EOPENSTALE); } else if (!IS_ERR(res)) { inode = d_inode(res); if ((lookup_flags & LOOKUP_DIRECTORY) && inode && - !S_ISDIR(inode->i_mode)) { + !(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) { dput(res); res = ERR_PTR(-ENOTDIR); } else if (inode && S_ISREG(inode->i_mode)) {