From owner-freebsd-fs@FreeBSD.ORG Fri Jun 3 08:25:13 2011 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D964D1065673; Fri, 3 Jun 2011 08:25:13 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id 78CA58FC1A; Fri, 3 Jun 2011 08:25:13 +0000 (UTC) Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p538P8ka027081 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 3 Jun 2011 18:25:11 +1000 Date: Fri, 3 Jun 2011 18:25:07 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Kevin Lo In-Reply-To: <1307071973.2024.19.camel@nsl> Message-ID: <20110603173555.X994@besplex.bde.org> References: <1307069726.2024.18.camel@nsl> <1307071973.2024.19.camel@nsl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-fs@freebsd.org, rmacklem@freebsd.org Subject: Re: [PATCH] Set the DE_UPDATE flag on the directory node on msdosfs X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 08:25:13 -0000 On Fri, 3 Jun 2011, Kevin Lo wrote: > Kevin Lo wrote: >> If you try to NFS export a fat32 formatted external usb devices, >> you'll notice if a new file is created, you won't see that file >> on the NFS client. The reason is msdosfs(5) doesn't change the >> modify time of the directory when an entry is created. >> >> Attached is a patch against HEAD that sets DE_UPDATE on the >> directory node in both createde() and removede(). >> Please test it, thanks. It breaks compatibility with MSDOS and Windows. No correct fix is evident. ffs maintains the generation count va_filerev which should help, but: - ffs only increments it when a file mtime is updated. - msdosfs doesn't properly maintain it (it initializes to a non-random number related to the current time when the vnode is initialized, but never increments it). - the old nfs client doesn't use it - the new nfs client does use it for v4. I don't know if this use is sufficient (it has to get it from the server to work for this). I wonder if the problem is larger with negative caching. Negative caching also uses the ctime, and msdosfs doesn't even have a ctime (it fakes it as the mtime, but that works especially badly for directories since the mtime is never changed after birth for directoroes, and negative caching needs the time[s] to be updated especially for directories). The only reasonably correct fix seems to be to make the directory timeouts especially small for nfs mounts of remote msdosfs file systems (or any file systems that don't update mtimes for directories, or don't have ctimes). Granularity of times is also a problem. It is 1 second by default for ffs, and can be reduced, but for msdosfs it is 2 seconds and cannot be reduced. So it is fairly easy even for ffs to have changes that don't change file timestamps. Using va_filerev is the correct fix for this. Bruce