From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 10782 invoked from network); 9 Mar 2021 13:32:56 -0000 Received: from tb-ob0.topicbox.com (64.147.108.117) by inbox.vuxu.org with ESMTPUTF8; 9 Mar 2021 13:32:56 -0000 Received: from tb-mx1.topicbox.com (tb-mx1.nyi.icgroup.com [10.90.30.61]) by tb-ob0.topicbox.com (Postfix) with ESMTP id BBB692622F for ; Tue, 9 Mar 2021 08:32:53 -0500 (EST) (envelope-from bounce.mMa709ac1a88a1167f9a50ce45.r522be890-2105-11eb-b15e-8d699134e1fa@9fans.bounce.topicbox.com) Received: by tb-mx1.topicbox.com (Postfix, from userid 1132) id B236A1C041C0; Tue, 9 Mar 2021 08:32:53 -0500 (EST) ARC-Authentication-Results: i=2; topicbox.com; arc=pass; dkim=none (no signatures found); dmarc=pass policy.published-domain-policy=quarantine policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=quarantine,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=sdf.org; spf=pass smtp.mailfrom=nicolagi@sdf.org smtp.helo=mx.sdf.org; x-internal-arc=fail (as.1.topicbox.com=pass, ams.1.topicbox.com=fail (message has been altered)) (Message modified while forwarding at Topicbox) ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d= topicbox.com; h=message-id:to:date:mime-version:content-type :content-transfer-encoding:from:list-help:list-id:list-post :list-subscribe:reply-to:subject:list-unsubscribe; s=sysmsg-1; t=1615296773; bh=LuZiRwVfiCUxwGTKrJaudjMn0sKaLOgPzxD8uSc/wsk=; b= jCJS64GCioHWMKxeI5xK6kqR9rQ5iizt0z66pWFA34dgYAeRjNRd5z1CjxvRoCjl tenJ1SMPAK+RXp7YpnVJTPuiDraAobBHqInMjDiGI84X8praHmLylaNNt42m5oVL HNm8f4Nofqq+ab3EsZoNvbQ/H6Dwbs29bSxSiMYEPjo= ARC-Seal: i=2; a=rsa-sha256; cv=pass; d=topicbox.com; s=sysmsg-1; t= 1615296773; b=GiCFJASqTLbkh+JOybhx027K6GB5/cpR1dx4zK+MsN/0ZXTqEF hTsghCRUkg4nXO8yrAMQprBOlkxAwTrQPBcbbYZKDKgr9e+3cSjUJiKkaZR+qTyf 5FzSYYxDglWPbaMjCy8GRYeIhzRuWtouy/WmBYfigUXKlcgiWvujcspKM= Authentication-Results: topicbox.com; arc=pass; dkim=none (no signatures found); dmarc=pass policy.published-domain-policy=quarantine policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=quarantine,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=sdf.org; spf=pass smtp.mailfrom=nicolagi@sdf.org smtp.helo=mx.sdf.org; x-internal-arc=fail (as.1.topicbox.com=pass, ams.1.topicbox.com=fail (message has been altered)) (Message modified while forwarding at Topicbox) X-Received-Authentication-Results: tb-mx0.topicbox.com; arc=none (no signatures found); bimi=none (No BIMI records found); dkim=none (no signatures found); dmarc=pass policy.published-domain-policy=quarantine policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=quarantine,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=sdf.org; iprev=pass smtp.remote-ip=205.166.94.24 (mx.sdf.org); spf=pass smtp.mailfrom=nicolagi@sdf.org smtp.helo=mx.sdf.org; x-aligned-from=pass (Address match); x-me-sender=none; x-ptr=pass smtp.helo=mx.sdf.org policy.ptr=mx.sdf.org; x-return-mx=pass header.domain=sdf.org policy.is_org=yes (MX Records found: mx.sdf.org); x-return-mx=pass smtp.domain=sdf.org policy.is_org=yes (MX Records found: mx.sdf.org); x-tls=pass smtp.version=TLSv1.2 smtp.cipher=ECDHE-RSA-AES256-GCM-SHA384 smtp.bits=256/256; x-vs=clean score=0 state=0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=9fans.net; h=message-id :to:date:mime-version:content-type:content-transfer-encoding :from:list-help:list-id:list-post:list-subscribe:reply-to :subject:list-unsubscribe; s=dkim-1; bh=uJfy8MebBRaHwCaHhmVRzeV3 UwKc+XwhmAulTJGm4Yg=; b=eejEZKoL23UnCE9kx6mWbFWOrX2p/JsSOqaXYJoX UXntIlup6bWFz44TlmnyKqwKRuPjz3gp1RQ3h6pe0RkUhpRL+4HMzvObIY0o3PC2 cV+PKgilKxwCXW2SJ/LPp6ZNVZxHdOt7znFpz/KgJ0Yor/JsNNKhC/An+jVP1bCP I3Q= Received: from tb-mx0.topicbox.com (localhost.local [127.0.0.1]) by tb-mx0.topicbox.com (Postfix) with ESMTP id 5DFC71B18562 for <9fans@9fans.net>; Tue, 9 Mar 2021 08:32:44 -0500 (EST) (envelope-from nicolagi@sdf.org) Received: from tb-mx0.topicbox.com (localhost [127.0.0.1]) by tb-mx0.topicbox.com (Authentication Milter) with ESMTP id F5556414C50; Tue, 9 Mar 2021 08:32:44 -0500 ARC-Seal: i=1; a=rsa-sha256; cv=none; d=topicbox.com; s=arcseal; t= 1615296764; b=sQ0hn8H/7EbMhPgSNzPbrOG0Dy0EsCYrMEqi5MAhe/huBSqF1d FapCfC/eCTazu+RRmGJ3VMqH6goiVkgmF4z6O+ZkWGGX5RxPzWS/yCn4oMBSZ+B1 bU3CMkkGzuM2b/JGKoVEnA7m99uwQTiegnRR0RtYsfLXdqsOBsHf1oJxCWk2k+UW x0afQP8SV5cGu4EZ6Bc3iYXGbN4hMV3iJUhypXHjsJIU8MBF3ddYHHEOiNcdPWtH x89fxFiIZj9Psl9OlY1nG7VMQ48b9uuo7+UywhQV0G6aRrRTO9JJEgJE7Zqje00U UI+EvVGa1HM+O9zKlJDSnzL2LqesBuCcEh7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d= topicbox.com; h=message-id:to:subject:date:from:mime-version :content-type:content-transfer-encoding; s=arcseal; t= 1615296764; bh=oCbnu/EWyvaal1tT5eUoWzlmypuny1rLmuX+5IInjWw=; b=m ah2NX5IVcS6gXvnDOJXgZmHn9r/9HSu8CcED9BIYXfjhNENU07QhgDqJoNkIRxPG LJ8D11rR5mMUm/UGiGEqZFylwpXs3JhnJStt6zqo7L0ykTfIM3q/YOL+CSTGPROq zfdm1vvO2w4fv1oyfXZ468ZaaghOB9A/N3DPnMhRX5PynQHqXCS95rVicQ7RZq2a 5xnyWloNdVWwohCxvjEBDPx01rw8auGVo3ix1tub7oDnNXOlYAafCqyWpDNIfuOM 4RRvVWOFNf50bfAJOdJDSeEm5VibSEX0AuvQ4xaGyHkoQ/R0BGYp8y61+klfsc8I ZWH+rwZ8PQIQtrgFck4bQ== ARC-Authentication-Results: i=1; tb-mx0.topicbox.com; arc=none (no signatures found); bimi=none (No BIMI records found); dkim=none (no signatures found); dmarc=pass policy.published-domain-policy=quarantine policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=quarantine,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=sdf.org; iprev=pass smtp.remote-ip=205.166.94.24 (mx.sdf.org); spf=pass smtp.mailfrom=nicolagi@sdf.org smtp.helo=mx.sdf.org; x-aligned-from=pass (Address match); x-me-sender=none; x-ptr=pass smtp.helo=mx.sdf.org policy.ptr=mx.sdf.org; x-return-mx=pass header.domain=sdf.org policy.is_org=yes (MX Records found: mx.sdf.org); x-return-mx=pass smtp.domain=sdf.org policy.is_org=yes (MX Records found: mx.sdf.org); x-tls=pass smtp.version=TLSv1.2 smtp.cipher=ECDHE-RSA-AES256-GCM-SHA384 smtp.bits=256/256; x-vs=clean score=0 state=0 X-ME-VSCause: gggruggvucftvghtrhhoucdtuddrgeduledrudduiedgheefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefvufffhf ggtgfgsehtjedttddttddvnecuhfhrohhmpehnihgtohhlrghgihesshgufhdrohhrghen ucggtffrrghtthgvrhhnpedvvedvffejleeghfevfeegudfgleeuudekvdelteetveeuke ehfeelgeehkeefheenucffohhmrghinhepghhithhhuhgsrdgtohhmnecukfhppedvtdeh rdduieeirdelgedrvdegpddvtdehrdduieeirdelgedrgeenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepihhnvghtpedvtdehrdduieeirdelgedrvdegpdhhvghlohep mhigrdhsughfrdhorhhgpdhmrghilhhfrhhomhepoehnihgtohhlrghgihesshgufhdroh hrgheq X-ME-VSScore: 0 X-ME-VSCategory: clean Received-SPF: pass (sdf.org: 205.166.94.24 is authorized to use 'nicolagi@sdf.org' in 'mfrom' identity (mechanism 'ip4:205.166.94.0/24' matched)) receiver=tb-mx0.topicbox.com; identity=mailfrom; envelope-from="nicolagi@sdf.org"; helo=mx.sdf.org; client-ip=205.166.94.24 Received: from mx.sdf.org (mx.sdf.org [205.166.94.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tb-mx0.topicbox.com (Postfix) with ESMTPS for <9fans@9fans.net>; Tue, 9 Mar 2021 08:32:43 -0500 (EST) (envelope-from nicolagi@sdf.org) Received: from sdf.org (IDENT:nicolagi@rie.sdf.org [205.166.94.4]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 129DWgWD024043 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO) for <9fans@9fans.net>; Tue, 9 Mar 2021 13:32:42 GMT Received: (from nicolagi@localhost) by sdf.org (8.15.2/8.12.8/Submit) id 129DWgIe017612 for 9fans@9fans.net; Tue, 9 Mar 2021 13:32:42 GMT Message-Id: <202103091332.129DWgIe017612@sdf.org> To: 9fans@9fans.net Date: Tue, 9 Mar 2021 13:32:39 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Topicbox-Policy-Reasoning: allow: sender is a member Topicbox-Message-UUID: f0948416-80db-11eb-af5e-e352152d27bb Archived-At: =?UTF-8?B?PGh0dHBzOi8vOWZhbnMudG9waWNib3guY29tL2dyb3Vwcy85?= =?UTF-8?B?ZmFucy9UMzZmYTc1ZmI4M2M4MWQ2ZC1NYTcwOWFjMWE4OGExMTY3ZjlhNTBj?= =?UTF-8?B?ZTQ1Pg==?= From: "nicolagi via 9fans" <9fans@9fans.net> List-Help: List-Id: "9fans" <9fans.9fans.net> List-Post: List-Software: Topicbox v0 List-Subscribe: Precedence: list Reply-To: 9fans <9fans@9fans.net> Subject: [9fans] 9P reading directories client/server behavior List-Unsubscribe: , Topicbox-Delivery-ID: 2:9fans:437d30aa-c441-11e9-8a57-d036212d11b0:522be890-2105-11eb-b15e-8d699134e1fa:Ma709ac1a88a1167f9a50ce45:1:dGNdf_MQf0f2HqKXRwI6XenwPdWJamIWc2aEqlYnegs Dear 9fans, I'm confused regarding the correct behavior for a Tread handler for directories, and the corresponding correct behavior for a client that wants to read the whole contents of a directory. I was trying to use 9fans/go/plan9/client.Fid.Dirreadall [https://github.com/9fans/go/blob/master/plan9/client/fid.go#L54-L60] and found that it returned fewer entries than a single Dirread. The reason is that Dirreadall uses ioutil.ReadAll which doesn't work well with a fid corresponding to a directory, because it spuriously detects io.EOF when in fact there are more dir entries, but none fits into the read buffer. Example trace: Tread tag 65535 fid 2 offset 0 count 512 Rread tag 65535 count 499 Tread tag 65535 fid 2 offset 499 count 13 Rread tag 65535 count 0 There would be more dir entries, but the one at offset 499 is longer than 13 bytes, so none is returned. It follows that Dirreadall is buggy, but let's set aside the discussion of a fix for a moment. Now consider this instead: I also thought that my server was at fault: perhaps it should respond with Rerror of some kind instead of a 0-byte Rread. The rationale was that it's risky for directory contents to disappear if the client doesn't have large enough buffers. When I tried that change in my fs, I found that I could no longer list directories when mounted under Linux. Restoring the original code that responds with 0-byte Rread, I traced the Linux driver's behaviour when listing a directory: Tread tag 0 fid 2 offset 0 count 8168 Rread tag 0 count 8109 Tread tag 0 fid 2 offset 8109 count 59 Rread tag 0 count 0 Tread tag 0 fid 2 offset 8109 count 8168 Rread tag 0 count 5410 Tread tag 0 fid 2 offset 13519 count 2758 Rread tag 0 count 0 Tread tag 0 fid 2 offset 13519 count 8168 Rread tag 0 count 0 Tread tag 0 fid 2 offset 13519 count 8168 Rread tag 0 count 0 When it gets a 0-byte Rread, it tries a new Tread with the largest possible buffer size (msize=3D8192 in this connection). You see this behavior twice above. Only after getting 0-byte Rread twice in a row, it gives up. QUESTION. The last Tread/Rread seems superflous to me. After enlarging the buffer size from 2758 to 8168 and still getting 0, I'd think the client could detect EOF. I don't see the point of an additional Tread of 8168 bytes. QUESTION. But other than that, is that what a client should do for reading directories? Enlarge the read buffer and see if it still gets 0 bytes? I'm asking because my initial fix to Dirreadall was to always issue Treads with count=3Dmsize-24, and because I find the above approach to incur 2x the round trips necessary. QUESTION. Similarly, is the server supposed to silently return a 0-byte Rread when no dir entries fit in the response buffer, despite there being more dir entries available? Finally, I noticed the plan9.STATMAX (65535) as the buffer size used in Dirread (a few lines above Dirreadall). That points to the fact that in theory that's the max size of a serialized dir entry, which leads me to ask one last QUESTION. What happens and what should happen when a dir entry is larger than msize-24? Possibly written from a connection with a large msize, and to be read from a connection with a smaller msize? Thank you, Nicola ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T36fa75fb83c81d6d-Ma709a= c1a88a1167f9a50ce45 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription