From owner-freebsd-fs@freebsd.org Sat Mar 26 04:48:33 2016 Return-Path: Delivered-To: freebsd-fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB502ADE77B for ; Sat, 26 Mar 2016 04:48:33 +0000 (UTC) (envelope-from nishida@asusa.net) Received: from asusam.asj-hosting.net (asusa.asj-hosting.net [219.118.222.245]) (using TLSv1.2 with cipher CAMELLIA256-SHA (256/256 bits)) (Client CN "*.asj-hosting.net", Issuer "Go Daddy Secure Certificate Authority - G2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 6F3E31202 for ; Sat, 26 Mar 2016 04:48:32 +0000 (UTC) (envelope-from nishida@asusa.net) Received: (qmail 55608 invoked by uid 89); 26 Mar 2016 13:48:23 +0900 X-ASJ-Track-ID: <20160326044823.55608.qmail@asusam.asj-hosting.net> X-Spam-Checker-Version: ASJ KMsrv Spam Check Process Internal X-Spam-Status: No, hits=0.0 X-Spam-Flag: No X-Virus-Scanned: ASJ KMsrv Virus Check Process 08041001 X-ASJ-SMTP-Authentication: nishida@asusa.net X-ASJ-Arrival-IP: 73.25.52.117 X-ASJ-SPF-Info: auth X-ASJ-Scan-ID: <1458967703.68927.55601@asusam.asj-hosting.net> X-ASJ-Received-SPF: pass (send with smtp authentication by nishida@asusa.net@73.25.52.117) Received: from c-73-25-52-117.hsd1.or.comcast.net (HELO ASUSA-Mac-mini.local) (nishida@asusa.net@73.25.52.117) by asusams.asj-hosting.net with ESMTPS (AES128-SHA encrypted); 26 Mar 2016 13:48:23 +0900 Subject: Re: Problem with FUSE + fts References: <56F42EF4.5000505@asusa.net> <1294209833.31699182.1458950014610.JavaMail.zimbra@uoguelph.ca> To: freebsd-fs@freebsd.org From: Hiroshi Nishida Message-ID: <56F6148D.2030706@asusa.net> Date: Fri, 25 Mar 2016 21:48:13 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <1294209833.31699182.1458950014610.JavaMail.zimbra@uoguelph.ca> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Mar 2016 04:48:34 -0000 Thank you for your response. On 3/25/16 4:53 PM, Rick Macklem wrote: > I think I see the same thing when doing an "rm -r" on a fuse/GlusterFS volume. Unfortunately, it happens also with "find XXX -print", though I have experienced a similar "rm -r" + "XXX: No such file or directory" problem with UFS + SUJ. And I also verified with truss that in _fstat(fd, &sb); p->fts_ino != sb.st_ino stat() system call is called with the same path as p's. Anyway, the following patch for lib/libc/gen/fts.c prevents the error but is far from a good solution. https://github.com/scopedog/FUSE-Test/blob/master/fts.c.patch It assumes that the filesystem id (f_type in struct statfs) of FUSE is 0xed but I am not sure if it's applicable to all FUSE filesystems. I'll look into FUSE source code next week. > To be honest, I just add a "-f" to the command to shut it up and then it deleted > the tree. > > I think, in general, what readdir() returns after an entry is unlink'd is undefined > behaviour. As such, the safe way to delete all of a directory is something like: > - in a loop until readdir() returns EOF > - opendir() > - readdir() the first entry > - unlink() that entry > - closedir() > --> So that all you ever do is readdir() the first entry after an opendir(). By the way, could you delete all the files with "-f"? I am testing with a pretty big directory containing 81,000 files/dirs and have never used "-f", but have to "rm -r" again for undeleted entries. However, the offset problem is very interesting as it seems to be applicable to all filesystems. Thank you. -- Hiroshi Nishida nishida@asusa.net