Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1714882pxb; Fri, 27 Aug 2021 16:02:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSf5bMBC46o7r5TIDn3O0lNVoI3hZAg2YxWMt5ftAXqm1lclXu0tgO4q4IZ+Gk6huOabV3 X-Received: by 2002:a92:da11:: with SMTP id z17mr8209561ilm.176.1630105327665; Fri, 27 Aug 2021 16:02:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630105327; cv=none; d=google.com; s=arc-20160816; b=nr9iUGJtgcoeWSqhfgIyy6GxNYRF/IH/ZIDV2h7kL5cVsht9bAh99rT1GuG0ln/40P zRXgcFfe9EIqDCYUn6IRR9jS6OxXRQJpZVyR22V8SgBBaOMf5oolYht6TJRQP3HuRmJ8 mL7YR50l+xWe2b3KS3q0NuDqFI6uQ4mKgktSMyxIgUOLQwgSDFpKbsaeu9wYAW6zeYtu p3tnEsFIeR0tFArrMphMIkW59RDqEE24oIcemNWjX8R2AbekD9wk9+o/UfDtSHkF5PSu 2mB9haucoTdjyZt+SFBTIALxqpAWlW3Ur6SRVBdZnX8owrkDmdR94H0m0NjoxjGb+Wll ctsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:references:in-reply-to:subject :cc:to:from:mime-version:content-transfer-encoding:dkim-signature :dkim-signature; bh=5nHU1Ux1kS4uzV5I7vGm2nV6xB5sfxiugKrsg1GfIvo=; b=IfY7h0QB/rkKs0+wPFgLPvqkYAtId9UL4b7sWI2FJ3WOkKdumiiJ8efBcFnNPGSs/l AtcgJ/RR1G9YtppsnKpm+3j7LKVGsNFl2YLuL1l05NmCYsiB6ttPF1DBFh2OcWFqQNlR HC7QVdOebaaR3/jM9CJ4yLPfLrdxKMUKcskej+HntpDX2L3PZ/gn6dQlTGvcvZH0mOtS calfygyq6wf8xEqPuGte+5Ua0B29vPU1Cnm4TBY3nlENm7KQwIdN5Pf/kZBIDLLyDhJg S0+OC7nE1bM3MjSggOj04EzusEwsXQxKHdxUIDq4/Z90i9Ec/G3PJITVTpGITsnlGxHc 9LUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=p7Z1aS5R; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p19si9394519iov.90.2021.08.27.16.01.55; Fri, 27 Aug 2021 16:02:07 -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; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=p7Z1aS5R; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232301AbhH0XCn (ORCPT + 99 others); Fri, 27 Aug 2021 19:02:43 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:58322 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232252AbhH0XCn (ORCPT ); Fri, 27 Aug 2021 19:02:43 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B2DB71FF4B; Fri, 27 Aug 2021 23:01:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1630105312; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5nHU1Ux1kS4uzV5I7vGm2nV6xB5sfxiugKrsg1GfIvo=; b=p7Z1aS5RZdcAjUQqTBlGlZQ8StpGlrh97yt3aHp5+rieUl01Vbe6EcCg1Iw5whb/JBU38/ xvJaaTAvA9e7DwacERCLxKQd8baeeT8shbrQR8TVHm9zuJC1Ci8RtBWWizYn93GIK0CrjF cOqrJh83f80IhUU16idwUIC8IMabGmo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1630105312; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5nHU1Ux1kS4uzV5I7vGm2nV6xB5sfxiugKrsg1GfIvo=; b=G9uQ3esHOjRFSxeW9/XbR/S7eWhr3TR3CUV7QVq6qibbQBhrWIjhlLK6PPnlr5af3nowUW uB5iPYq4b/ev/cCA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 63D2313A66; Fri, 27 Aug 2021 23:01:51 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id DSXVCN9uKWHwJAAAMHmgww (envelope-from ); Fri, 27 Aug 2021 23:01:51 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 From: "NeilBrown" To: "J. Bruce Fields" Cc: "Chuck Lever" , linux-nfs@vger.kernel.org, "Josef Bacik" Subject: Re: [PATCH v2] BTRFS/NFSD: provide more unique inode number for btrfs export In-reply-to: <20210827183216.GC3915@fieldses.org> References: <162995209561.7591.4202079352301963089@noble.neil.brown.name>, <162995778427.7591.11743795294299207756@noble.neil.brown.name>, <20210826201916.GB10730@fieldses.org>, <163001583884.7591.13328510041463261313@noble.neil.brown.name>, <20210827183216.GC3915@fieldses.org> Date: Sat, 28 Aug 2021 09:01:48 +1000 Message-id: <163010530848.7591.9076942348960044071@noble.neil.brown.name> Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Sat, 28 Aug 2021, J. Bruce Fields wrote: > On Fri, Aug 27, 2021 at 08:10:38AM +1000, NeilBrown wrote: > > On Fri, 27 Aug 2021, J. Bruce Fields wrote: > > > On Thu, Aug 26, 2021 at 04:03:04PM +1000, NeilBrown wrote: > > > > + } > > > > + if (resp->dir_ino_uniquifier != ino) > > > > + ino ^= resp->dir_ino_uniquifier; > > > > > > I guess this check (here and in nfsd_uniquify_ino) is just to prevent > > > returning inode number zero? > > > > Yep. The set of valid inode numbers is 1..MAX and that set isn't closed > > under xor. > > I was curious.... > > The NFS specs don't require FILEID to be nonzero as far as I can tell. > > Our client doesn't treat fileid 0 specially. In the case it has to > return a 32-bit inode it xors the high and low parts and makes no effort > I can see to check for the 0 case. > > I modified a server to return 0 for FILEID and MOUNTED_ON_FILEID on one > particular file, and an strace shows that's happily passed on to > userspace: > > getdents64(3, [..., {d_ino=0, d_off=2048, d_reclen=32, > d_type=DT_REG, d_name="LOCKTESTFILE"}] > > But ls silently skips that file in the output. Huh. > What DO they teach in history class? The original Unix File System (edition 6, 7 at least) had 16 bytes per entry in directories (that could be read with read(2)). Two bytes of inode number and 14 bytes of name. When a name was deleted, the inode number was over-written with '0'. So code - and coders - from that era ignore directory entries with d_ino==0. I'm not certain what inode 0 was used for, but I think it had some behind-the-scenes role. Free-space? So some code might work find with ino==0, but I'd rather not risk it. NeilBrown