From owner-freebsd-fs@FreeBSD.ORG Fri Jun 3 21:07:03 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 4379D1065674; Fri, 3 Jun 2011 21:07:03 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id D2AA18FC15; Fri, 3 Jun 2011 21:07:02 +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 mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p53L6u7t005989 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 4 Jun 2011 07:06:58 +1000 Date: Sat, 4 Jun 2011 07:06:56 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans In-Reply-To: <20110604052946.Q3281@besplex.bde.org> Message-ID: <20110604064215.D970@besplex.bde.org> References: <1307069726.2024.18.camel@nsl> <1307071973.2024.19.camel@nsl> <20110603173555.X994@besplex.bde.org> <20110603105904.GM48734@deviant.kiev.zoral.com.ua> <1307106007.2865.8.camel@nsl> <20110604052946.Q3281@besplex.bde.org> 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 21:07:03 -0000 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