[PATCH] Set the DE_UPDATE flag on the directory node on msdosfs

Bruce Evans brde at optusnet.com.au
Fri Jun 3 20:04:24 UTC 2011


On Fri, 3 Jun 2011, Kevin Lo wrote:

> Kostik Belousov wrote:
>> On Fri, Jun 03, 2011 at 06:25:07PM +1000, Bruce Evans wrote:
>>> 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:
>>> ...
>> It seems that reporter forgot to mention this, but the problem was
>> reported for the _linux_ NFS client mounting FAT share from the FreeBSD
>> server.

It's going to be hard to fix this portably.

I looked at the FreeBSD server a bit more.  It seems to pass va_filerev for
v4 but not for v3 (or of course v2).

> Thank kib@ for pointing that out. Yes, the NFS clients running on Linux.
> I looked at the Darwin's msdosfs:
> http://opensource.apple.com/source/msdosfs/msdosfs-48/msdosfs.kextproj/msdosfs.kmodproj/msdosfs_lookup.c
>
> It seems the DE_UPDATE flag is also set in createde() and removede().

These settings look like Apple bugs.  The one in createde() is
misindented, and in in removede(), the whole function is misindented.
Otherwise, the formatting and contents doesn't seem to have been changed
much since Apple obtained the file from FreeBSD in Y2K.

Apple's msdosfs_denode.c still carefully avoids setting
IN_UPDATE | IN_MODIFIED for directories in detrunc().

I will check what Linux (2.6.10) msdosfs does.

BTW, how do you get unmangled source files from Apple?  The one in the
above URL is actually an html file so it is fully mangled when fetched.
When viewed in a browser, it just has corrupt tabs and some leading and
trailing garbage.  All libm files that I have fetched from Apple have
the same problems.  In 1 case I wasn't able to recover a source file
without too much editing, since printing the file from a browser gave
mangled more than tabs.

Bruce


More information about the freebsd-fs mailing list