Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3547810ybc; Thu, 21 Nov 2019 09:56:28 -0800 (PST) X-Google-Smtp-Source: APXvYqwpRobGgMFBtHlLatltTPTR1OCTt5umY1sB2rMoPQV3nsRS0LkXTq4KsB6sqcSuaZN31B0+ X-Received: by 2002:adf:ab4c:: with SMTP id r12mr12168270wrc.3.1574358988504; Thu, 21 Nov 2019 09:56:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574358988; cv=none; d=google.com; s=arc-20160816; b=CX1AK5vk0+E/opfwhcOHsMBvNNHV2MjNeoMng1fTgy+94le02I58ZIOehGNtgq/+qR QLycvK+muQo4ir4ZLnOXsC0qm+SKdDcQcE3EJMhifSFwbVoH642N6eG7DSaAbopccMz6 785zWbvFPolu0su8Ipis2Yle8OlOcki2OnMlVHMN13Vf7yzeolcyCO9jk7JO1R67Kkfk 2n8cLzIzfrEltt3Pzdpu+5RZ0PQI7GjjokQxfGvFMRvqLXOTYLNnQxQTF/4dLE3MUepj xz6cOdjFNPVpiCYYtRhfcFMpQQz2RHQhMJWTalv7OHfo/YLz9wwKMhZkEvL/gSHKoT8j qi0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=PPwpBZo+xPiG0uWYzps7TDI4N1dQs5dYm1P8XU8SnNc=; b=H/rsU1aFhG1R4kjVnn5+e1mm03D5pSA8Z8yX/3wX4S7vrMWHfD2bV4nq3vF4+ok1eT BWYAJPMARoudqGtMe62rKECZlGUgcWu3uE9hv90Kr+8rFcaiDy90eMqJTWyRbG3wso08 QHOojbP1QEf4Ez7lwEtcSEsQfrWKxBUVplQp1Ro2mBFTwnOaefPlt7u9Zn3ikOf5LQtQ 49inlKBRW5GtDoB6KpAej/F55uz0xnbVeqeQSxI/2/e5YPjmwI2HsmuOnZvNtt6N5Vex eOallmHN8Q/S2p6e4BU4c6qrjVw6dm3DH64R5gnZWJH6VCm80hB8t3XHuHeOZixaMhyC REyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k51si2941796edb.411.2019.11.21.09.56.04; Thu, 21 Nov 2019 09:56:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726747AbfKURyl (ORCPT + 99 others); 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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