Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1588406pxb; Tue, 8 Feb 2022 23:16:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHszAIiBCt+Z+iW8MnvfzW6DVBCgCDGsgesKaUzvDIzXAK6HuH3uAC8xG6BPMQ89e2U4sA X-Received: by 2002:a17:902:7606:: with SMTP id k6mr918874pll.56.1644390998680; Tue, 08 Feb 2022 23:16:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644390998; cv=none; d=google.com; s=arc-20160816; b=RQ1M1ryyokQaeJmHlKkqxtm7MXWr4P7yq/y4i0cI3r7ePxriXAcLrwV/N94VIQnrHv W4/d6uCp8Nq7hqcfnUsil/2a+YCSOhrwo+TqPWDSSUYLsYSx2dsT0DptM+g9LCjh/oya 9iT17f78K13ogFvzTjaDhkIKQ3RHAyj0aeyjAhTcRLUpVTikrG9TbdvMeZGGcwXCxsEf FKTz3PERV1CZxRmPg7H8GxBEcIM9WfXxm31EyxsbbiUWvGJrESBU3B6ZOFyzpJ2JJePE jDixSGgvykvsPDHRlHKivj5FfKGtnqbLdMNjKHzoZO5Zg5sYdHZvxB63pnXIETsIg93V Bfdg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=9rW08ZXAg/YcfOmU4kmPnXpSz4EDOQkjxjDbNnvPrQ4=; b=CMsfbgWW9NUUehALBIiz6/MWdHaAq2kY2H+Et/YphHO+JFS78hIXdRmYTYKhLmh6KQ QKsV/Z6WZBLfKmg1q7fuoCDp8DcNJLGHaMqF8Nfa4lLt8Mnoet9+RqUXRe+WjTWeuOwN VdFxaNMptNEY8eoPfON9DBka7G/2LnUccZA3Bqfib1wOWah0lwNMuB/lx2UcPqu31cUc OFeY1d7iYmjvsPpy7xDoidH8uvJqmCKuLdfOVDfBxjLn4ApZaNU1UXf/UYBB2L25SJXu XouDHXCVYv5ZkXDbbOKl6VnZzAQxJGxqfsImLOptOvMu90mn/Gwixr62GHc/vHVskegB pWdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mJNbAXJ1; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d23si14037775plr.301.2022.02.08.23.16.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 23:16:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-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=@kernel.org header.s=k20201202 header.b=mJNbAXJ1; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 06C1BC0DE7D5; Tue, 8 Feb 2022 22:32:45 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385313AbiBHSpK (ORCPT + 99 others); Tue, 8 Feb 2022 13:45:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385321AbiBHSpB (ORCPT ); Tue, 8 Feb 2022 13:45:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC38CC03FEDC for ; Tue, 8 Feb 2022 10:44:50 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 8757960DFF for ; Tue, 8 Feb 2022 18:44:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96F9AC004E1; Tue, 8 Feb 2022 18:44:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644345889; bh=bcwD14xEuE8U1chEKjNelzR9KFTDCtuFVC8COole5gA=; h=From:To:Cc:Subject:Date:From; b=mJNbAXJ1eY9oKDJgdwAnyHB79lBTLTIjFXwDxOvsLjZfF5w6tKroey7FR1X2B1npp WjObu6HwR3L3RYjWdDun0a2gObR8AjCZCULq9T7WwJVo86V+BXkIrFeYkO4+LMhHx9 ap3vfq3d6J/gfUU88OGfnkgOHJHxZnCMGVNQG2GLNn3hIPr8Z+WtXu4xC/v6PALBdI YpKI86Ni2nwKBdDz38VvostRw6TEjGAON2M/gnFWfWblrED14Oiw23jf/7meMtZFgJ 8Cwbn0Hui1EuSSOx/MhiPpGQXJSKD297LPK0peUD2Iz5+cd7BEOj4FiR5RLfGii83N aGYvjsAzroy8A== From: trondmy@kernel.org To: Paul Menzel , Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH] NFS: LOOKUP_DIRECTORY is also ok with symlinks Date: Tue, 8 Feb 2022 13:38:23 -0500 Message-Id: <20220208183823.1391397-1-trondmy@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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-nfs@vger.kernel.org From: Trond Myklebust 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 --- fs/nfs/dir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index e128503728f2..6dee4e12d381 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -2051,14 +2051,14 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry, 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)) { -- 2.34.1