Received: by 2002:a05:7208:31d3:b0:81:e143:7c29 with SMTP id v19csp400758rbd; Fri, 5 Apr 2024 07:52:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVRDwsMKGI21IL7rdFZ8Qe/xhSYVEM26K/jmFjWESYn9ysqb0ny9ovNw4S6Gl3qFkfpbtmJhPjaAYk5FIaiXpYytWBAvBw7hYC04EDstg== X-Google-Smtp-Source: AGHT+IHux/Bq9D+3rmVngZ7SKMqfheNWAaeyL9r8jYSxaAZyna06nWeKVSyyKEIFZYcbvNm8U0fl X-Received: by 2002:a17:902:d503:b0:1dd:a33f:5913 with SMTP id b3-20020a170902d50300b001dda33f5913mr2069705plg.30.1712328750407; Fri, 05 Apr 2024 07:52:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712328750; cv=pass; d=google.com; s=arc-20160816; b=LAPXWGI6XyC0k6f0eN0P5c5ql9KK9HbRCqN98zD6MTU06LEJ/fsVEAuBnkJ/G/amvV 1Cmj5EyhWlaa03A+GEyVaIL2fcKRCu9ral5h6brl7/JLjATmonubtkhV2Hj5nrXt1khw kyLS+3iKeFkp8fIPe2U81xnb15Etu2OJtQuqLFUn/D9uv1FVveWEdl7TF8WKXgMjWGvF Vcza5J5l42J8K49zgFVoPw2wA9j+gQv15s3g+DMG9QaVeZbalrhS3JMVJbesCpXnVg3e cyMSIGgBTwZacCg4PJHwTlQXuuHqP0r+B2jzaPWPk8iuOgJaLzlJWrl+IJMLdkaZ4RZr pwGg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=aKE/4B7GJFb9gB5kbbM7t6MF7RgJ65t8f7T8siVxts0=; fh=utJqhDeOTEgDQVBimEEggCTA1/RUefc1K/awvp+UW64=; b=EpdBaO3PYz7kiKk/Qp9qd6f09AdGxOfYuvT/2Orhmf7NrQt6ug8uRK9qkofIaqi80l y4DNFMgn9Fyqj1hcrLVvtKysAkmJQp+y2fDlTyAQ38UfLFO56UN0zCuBdIB9Ll/wWNfJ KYOHfnRgd2o+P0uEgbl1AakMqgibLqSYnDCLRe9N1yJvgEjmsjbUbrNHhrYJufvtUyOT 7qWNTrrOC8wmQZNRTBNfjsZpY/sh4x/FFo7ERcuATfSR8izyj7V58Es5Y5IY2Rbf1Xul cXUiZkpSmSRb+NBEtZsLGgKIOYVY+/OiN50aZjbD4LOS/fRRCsPd/MzWziIz0BGZNsKA 954g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@dneg.com header.s=google header.b=rVB5a0mZ; arc=pass (i=1 spf=pass spfdomain=dneg.com dkim=pass dkdomain=dneg.com dmarc=pass fromdomain=dneg.com); spf=pass (google.com: domain of linux-nfs+bounces-2670-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2670-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=dneg.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id mb3-20020a170903098300b001e2820004f7si1499743plb.646.2024.04.05.07.52.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 07:52:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs+bounces-2670-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@dneg.com header.s=google header.b=rVB5a0mZ; arc=pass (i=1 spf=pass spfdomain=dneg.com dkim=pass dkdomain=dneg.com dmarc=pass fromdomain=dneg.com); spf=pass (google.com: domain of linux-nfs+bounces-2670-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2670-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=dneg.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4AB96B23E2A for ; Fri, 5 Apr 2024 14:48:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 639D88BEF; Fri, 5 Apr 2024 14:48:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dneg.com header.i=@dneg.com header.b="rVB5a0mZ" X-Original-To: linux-nfs@vger.kernel.org Received: from mail-il1-f174.google.com (mail-il1-f174.google.com [209.85.166.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5826816D9D5 for ; Fri, 5 Apr 2024 14:48:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712328487; cv=none; b=Bq4hEdjegZusIRy1H41OwoPZN9TZWpanJfd2UfCJUUIYS1a8SLa5ReU1hKV7+JwVCy+MaCrnW+CfQTRluwzNyfeJ3lCiXbFzdUsSTWx2MDCj2jRn4mJnP5ks2FT/3eWTLlk5CQLllE1wFnkIzhUjKtjw31Q8acNoEpbqJhFvseM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712328487; c=relaxed/simple; bh=aKE/4B7GJFb9gB5kbbM7t6MF7RgJ65t8f7T8siVxts0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=L/wiEaeKc6tFrYqZETkG/5evXv/P/slv/+RyvtZTMi1dsl+/xoEgiBUemzPYHpB/GpNMpWL4ccW3+BJ/903dQ4aFkejRr+Naz4i1pZHqd5c0GldgUAJkFPbA+cHOzYMthij6IuAmvE0NbS/XB80coZnCDXLhhCXzGJBcVCWBUrU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=dneg.com; spf=pass smtp.mailfrom=dneg.com; dkim=pass (2048-bit key) header.d=dneg.com header.i=@dneg.com header.b=rVB5a0mZ; arc=none smtp.client-ip=209.85.166.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=dneg.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dneg.com Received: by mail-il1-f174.google.com with SMTP id e9e14a558f8ab-368c13003eeso10066045ab.0 for ; Fri, 05 Apr 2024 07:48:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dneg.com; s=google; t=1712328484; x=1712933284; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=aKE/4B7GJFb9gB5kbbM7t6MF7RgJ65t8f7T8siVxts0=; b=rVB5a0mZWFv+978t6LugIWyVDxKHYawXyWo6VGEOZe/GkXuE4g2VxfXlQKUSlwSHKo MSGZbPXCDg3PeQWf4fKG689RPrn86W0DSbD455YwKZQA92ZiTlvxCAo9fiTaP/VHtVCW eua6bBHmhNkFAY5wvYJpM8DH7qvQeOCBS+obVb5+Zw+CMNvcuix5TnEmH1GpK5vHgHZi pLkx52V97yblKP2CcGxhBvWfe6wT3IU5MoKDLS3mvLNTTGgXBYwUX0d7nDiysvGp0ncI tZlHqahCXOP7NzJAlxy6K0W7a5a6m9Ql4Ko7qZ9BdUfRcJ1r43GSnPS6F6UyU0czmCXK chQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712328484; x=1712933284; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aKE/4B7GJFb9gB5kbbM7t6MF7RgJ65t8f7T8siVxts0=; b=El7Pfgzhcb18+vppcP6CpFHNyioirN6nQrS11M1NOTeJFnOY3VH/C693J0ZYeA7xfC 7aftJkKDGyg26OTyPQVOk6Oxcpw2dyS6fm5ooIf+oN9NBWP6t3oDODDOllxaPb4MZINN UlG9RMRRUta0MLaodBjg+AjRPxx7QPXp6vp4uNL1Zy8NazJKMdnQX2roNLIcfM8WM8iY kj3I3ksThs3Q/EXDYOsTXUoWJW3r4uN6gr9dKdh1PXdXMxUgRfWxyS/JmsK29QDWAANN YCvCrLXepYNxc2fV4YooVGPMvCaT8wikC3v2u1bLuAPRJTaPNCPRbz2nsNz0IRwPQdi5 5lbw== X-Gm-Message-State: AOJu0YwIAiQ440+a1FbbwsoahlclPXtsq16iwxXpaEtZECtnAjt/TKFM duOZXf077JOadFEs9tnyteaXlBn07A0KY6cPix1HU4WpLrxUoiJVxw9jDgP1LVD8RP7TLrgwyqS ECahOX3lCDjt5ayNgbokfNJEYnC+iQAnRUErSJb1+GwaKORWEkCI= X-Received: by 2002:a05:6e02:1a06:b0:368:a502:14e0 with SMTP id s6-20020a056e021a0600b00368a50214e0mr1470137ild.31.1712328484107; Fri, 05 Apr 2024 07:48:04 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <561ef18af88ecda0f7b8abf55c1dfb2b66cf5dea.camel@hammerspace.com> In-Reply-To: From: Daire Byrne Date: Fri, 5 Apr 2024 15:47:27 +0100 Message-ID: Subject: Re: directory caching & negative file lookups? To: Trond Myklebust Cc: "linux-nfs@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Apologies for dragging up an old thread, but I've had to tackle wayward negative lookup storms again and I have obviously half forgotten what I learned in this thread last time (even after re-reading it!). Can I just ask if I understand correctly and that there was an intention a long time ago to be able to serve negative dentries from a "complete" READDIRPLUS result? https://www.cs.helsinki.fi/linux/linux-kernel/2002-30/0108.html So if we did a readdirplus on a directory then immediately fired random non existent lookups at the directory, it could be served from the readdirplus result? i.e. not in readdir result, then return ENOENT without needing to ask server? But that is not the case today because you can't track the "completeness" of a READDIRPLUS result for a directory over time (in page cache)? Or is it all due to needing to deal with case insensitive filesystems (which I would think effects positive lookups too)? I did try to decipher the v6.6 fs/nfs/dir.c READDIR bits but I quickly got lost... Cheers, Daire On Thu, 1 Sept 2022 at 16:49, Daire Byrne wrote: > > Yea, got it now. That all makes sense. Thanks! > > Apologies for the noise. Now I just have to go and fix a bunch of our > user's code so I can forget about negative lookups again... > > Daire > > On Thu, 1 Sept 2022 at 16:43, Trond Myklebust wrote: > > > > On Thu, 2022-09-01 at 16:27 +0100, Daire Byrne wrote: > > > On Thu, 1 Sept 2022 at 14:55, Trond Myklebust > > > wrote: > > > > man 5 nfs > > > > > > > > Look for the section on the 'lookupcache=mode' mount option. > > > > > > So I get that the client caches negative lookups once we've made them > > > (the default lookupcache=all), but what I'm wondering is if we have > > > already cached the entire directory contents before the (negative) > > > lookup, can we not reply that it doesn't exist using that information > > > without having to go across the wire the at all (even the first > > > time)? > > > > > > Or is there no concept of "cached directory contents"? I thought that > > > maybe readdir/readdirplus knew about the "full contents" of a > > > directory? > > > > > > My thinking was that if we did a readdir/readirplus first, we could > > > then do lookups for any random non-existent filename without having > > > to > > > send anything across the wire. Like I said, a newbie question with > > > limited understanding of the actual internals :) > > > > > > Daire > > > > There is no concept of a 'fully cached directory'. The VFS and the > > memory management code are free to kick out any unused cached entries > > from the dcache at any time and for any reason. So the absence of an > > entry is not the same as a negative entry. > > > > Furthermore, certain features like case insensitive filesystems on > > servers makes it hard for the NFS client to know whether or not a > > specific name will or won't match an entry returned by readdir. In > > those circumstances, even if you think you have cached the entire > > directory, you are not guaranteed to know whether the lookup will fail > > or succeed. > > > > -- > > Trond Myklebust > > Linux NFS client maintainer, Hammerspace > > trond.myklebust@hammerspace.com > > > >