[PATCH] Set the DE_UPDATE flag on the directory node on msdosfs
Bruce Evans
brde at optusnet.com.au
Fri Jun 3 21:07:03 UTC 2011
On Sat, 4 Jun 2011, Bruce Evans wrote:
> On Fri, 3 Jun 2011, Kevin Lo wrote:
>> 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().
> ...
> I will check what Linux (2.6.10) msdosfs does.
It is incompatible in the same way as Apple. It has the following other
bugs for the root directory (note that the msdosfs root directory has no
place to store any timestamps on disks, so any timestamps can only be
transient):
- the timestamps after mount were the Epoch. This is not a valid msdosfs
timestamp
- changes to the directory update the ctime and the mtime but not the
atime
In FreeBSD and WinXP, the timestamp for the root directory is invariant
at 1 am 1 Jan 1980.
BTW, I use the following related changes which allow managing msdosfs
directory timestamps from FreeBSD. Even WinXP allows changing directory
timestamps using WinXP's analogue of utimes() (I don't know what this is,
but it must exist since Cygwin touch can set directory times).
% Index: msdosfs_vnops.c
% ===================================================================
% RCS file: /home/ncvs/src/sys/fs/msdosfs/msdosfs_vnops.c,v
% retrieving revision 1.147
% diff -u -2 -r1.147 msdosfs_vnops.c
% --- msdosfs_vnops.c 4 Feb 2004 21:52:53 -0000 1.147
% +++ msdosfs_vnops.c 12 Nov 2007 21:47:48 -0000
% @@ -457,5 +457,7 @@
% (error = VOP_ACCESS(ap->a_vp, VWRITE, cred, ap->a_td))))
% return (error);
% +#if 0
% if (vp->v_type != VDIR) {
% +#endif
Hack to not treat directories specially here...
% if ((pmp->pm_flags & MSDOSFSMNT_NOWIN95) == 0 &&
% vap->va_atime.tv_sec != VNOVAL) {
% @@ -463,4 +465,7 @@
% unix2dostime(&vap->va_atime, &dep->de_ADate,
% NULL, NULL);
% + if (vp->v_type != VDIR)
% + dep->de_Attributes |= ATTR_ARCHIVE;
...but still avoid setting ATTR_ARCHIVES for directories.
% + dep->de_flag |= DE_MODIFIED;
Don't set this unconditionally. Only set it it we actually set a time.
I think this makes no difference in practice, since although in theory
the caller might only ask to set a time that we don't set (the atime in
some cases), all callers in practice always ask to set both times.
This is missing the optimization of not setting DE_MODIFIED (and thus being
forced to write out the denode) for null changes. msdosfs does this
optimization for most settings of times in denode.h. ffs is also missing
this optimization. Except in my version for both, I compare the in-core
inode with the on-disk inode, and skip the write for null changes even if
XX_MODIFIED says to write. This covers all attributes.
% }
% if (vap->va_mtime.tv_sec != VNOVAL) {
% @@ -468,8 +473,11 @@
% unix2dostime(&vap->va_mtime, &dep->de_MDate,
% &dep->de_MTime, NULL);
% + if (vp->v_type != VDIR)
% + dep->de_Attributes |= ATTR_ARCHIVE;
% + dep->de_flag |= DE_MODIFIED;
% }
% - dep->de_Attributes |= ATTR_ARCHIVE;
% - dep->de_flag |= DE_MODIFIED;
% +#if 0
% }
% +#endif
% }
% /*
Bruce
More information about the freebsd-fs
mailing list