Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3987195pxf; Mon, 29 Mar 2021 17:49:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIywmdKINRqqFOZzTuBglRndHGnNL45Svxl2oxHP/gIKItTaKa+kFp4OxkQ7z6ELg73ka3 X-Received: by 2002:a17:906:da0e:: with SMTP id fi14mr31990801ejb.188.1617065396188; Mon, 29 Mar 2021 17:49:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617065396; cv=none; d=google.com; s=arc-20160816; b=G9AP9fm1wbzpgtQgs0mVZr1qDuZ8Z/1uRI+Zx/9B6U/Py7K90MJAJUcR7Bp/cnUY5l dJdKxaVDn0VOAjuVgqkt+kytVouOqsM+P/RPOO30Babfj7WTpXJiTr8o1KYFjFF10hs2 MCPX9TdwOkGS7lXwkDFlDIhjK+zZZ86idA1c4cMo//1ar0lLOWXQKqtyPf+CN2hjzDPQ IWoci/JazO8nbZU4iXaW4XzuuSRsbC+9DUkQNsrYk6UCJtxuGqRN6W6C4rHnj8Oehkyy fD2XDgaQ4gi5S46aEP2hiNRjYuUgflp7VmLzSmZv0WwETS/81onNQrNxXT1VCm39KDob cNcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:mime-version :message-id:subject:cc:to:from:date; bh=qupLmBgcFPSGU++JOtYERJXT1NPze54mrpXjLUg+5B8=; b=ZcMREt/VfsQtYrMI9/YbdRs9DDODY8YMdiNAyihskuwN/UvBeF+8oaa+IsOZ335hKw Iyoj6R7clswQZJsvp6EF47gAo0R0T9rCAia73jUG8g9uFEC1WZsKC3LXbl8PsQSxJ8mM gOxJMUZj/Tcwyei4kxvaL3w1MZ9GMcDtsJQqjVf0Tz8WHT/Z74xMwp1TRfPGYjtrTCDo 6SOb2ZK96YQ3xEajMNEac76n5iwWpSh9tABrkrab7Wnm98Ze2dI0ob6dUmw5Ozy6f9UU 0RQI6hqYpXpitdgXvIZbjf+SS/TSh+vN4+wXdA0GMw7r8wQgrdRrCxW3mss+dd/2L9YB t/3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p8si14364896edm.44.2021.03.29.17.49.21; Mon, 29 Mar 2021 17:49:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229689AbhC3Asn (ORCPT + 99 others); Mon, 29 Mar 2021 20:48:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229557AbhC3AsZ (ORCPT ); Mon, 29 Mar 2021 20:48:25 -0400 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5618C061762; Mon, 29 Mar 2021 17:48:24 -0700 (PDT) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94 #2 (Red Hat Linux)) id 1lR2YN-000ssh-1X; Tue, 30 Mar 2021 00:48:19 +0000 Date: Tue, 30 Mar 2021 00:48:19 +0000 From: Al Viro To: Trond Myklebust Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: why is short-circuiting nfs_lookup() for mkdir(2) et.al. dependent upon v3 or later? Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org In nfs_lookup() we have /* * If we're doing an exclusive create, optimize away the lookup * but don't hash the dentry. */ if (nfs_is_exclusive_create(dir, flags) || flags & LOOKUP_RENAME_TARGET) return NULL; OK, fair enough - we don't need to find out whether it's negative or not for mkdir() et.al.; if it isn't, server will tell us to sod off and we can live with not having it in cache - in the worst case, we'll have to do the same lookup we'd skipped here at some later point. Same for rename(2) destination - if it wasn't in dcache, we are not going to bother with sillyrename anyway, and that's the only thing where we might care about the destination. If rename(2) succeeds, we won't see whatever had been there anyway, and if it fails, we won't lose anything from having lookup done later. What I don't get is why, unlike rename(2) target, mkdir(2) argument is handled that way only for v3 and later. It's been a long time since I looked at NFSv2 servers, but shouldn't we get NFSERR_EXIST if the sucker turns out to have already been there? What am I missing?