From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37EBFC43215 for ; Thu, 21 Nov 2019 17:54:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1189A2068F for ; Thu, 21 Nov 2019 17:54:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726568AbfKURyl (ORCPT ); Thu, 21 Nov 2019 12:54:41 -0500 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:38798 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726293AbfKURyl (ORCPT ); Thu, 21 Nov 2019 12:54:41 -0500 Received: from callcc.thunk.org (guestnat-104-133-8-103.corp.google.com [104.133.8.103] (may be forged)) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id xALHsJ6a011724 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Nov 2019 12:54:21 -0500 Received: by callcc.thunk.org (Postfix, from userid 15806) id CA5FF4202FD; Thu, 21 Nov 2019 12:54:18 -0500 (EST) Date: Thu, 21 Nov 2019 12:54:18 -0500 From: "Theodore Y. Ts'o" To: Rich Felker Cc: Florian Weimer , linux-fsdevel@vger.kernel.org, musl@lists.openwall.com, linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org Subject: Re: [musl] getdents64 lost direntries with SMB/NFS and buffer size < unknown threshold Message-ID: <20191121175418.GI4262@mit.edu> References: <20191120001522.GA25139@brightrain.aerifal.cx> <8736eiqq1f.fsf@mid.deneb.enyo.de> <20191120205913.GD16318@brightrain.aerifal.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191120205913.GD16318@brightrain.aerifal.cx> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Wed, Nov 20, 2019 at 03:59:13PM -0500, Rich Felker wrote: > > POSIX only allows both behaviors (showing or not showing) the entry > that was deleted. It does not allow deletion of one entry to cause > other entries not to be seen. Agreed, but POSIX requires this of *readdir*. POSIX says nothing about getdents64(2), which is Linux's internal implementation which is exposed to a libc. So we would need to see what is exactly going on at the interfaces between the VFS and libc, the nfs client code and the VFS, the nfs client code and the nfs server, and possibly the behavior of the nfs server. First of all.... you can't reproduce this on anything other than with NFS, correct? That is, does it show up if you are using ext4, xfs, btrfs, etc.? Secondly, have you tried this on more than one NFS server implementation? Finally, can you capture strace logs and tcpdump logs of the communication between the NFS client and server code? > > But many file systems simply provide not the necessary on-disk data > > structures which are need to ensure stable iteration in the face of > > modification of the directory. There are hacks, of course, such as > > compacting the on-disk directory only on file creation, which solves > > the file removal case. Oh, that's not the worst of it. You have to do a lot more if the file system needs to support telldir/seekdir, and if you want to export the file system over NFS. If you are using anything other than a linear linked list implementation for your directory, you have to really turn sommersaults to make sure things work (and work efficiently) in the face of, say, node splits of you are using some kind of tree structure for your directory. Most file systems do get this right, at least if they hope to be safely able to be exportable via NFS, or via CIFS using Samba. - Ted