From owner-freebsd-bugs@FreeBSD.ORG Mon Dec 4 12:26:57 2006 Return-Path: X-Original-To: freebsd-bugs@freebsd.org Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7D0F916A40F for ; Mon, 4 Dec 2006 12:26:57 +0000 (UTC) (envelope-from r.c.ladan@gmail.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.187]) by mx1.FreeBSD.org (Postfix) with ESMTP id CD26F43CA6 for ; Mon, 4 Dec 2006 12:26:23 +0000 (GMT) (envelope-from r.c.ladan@gmail.com) Received: by nf-out-0910.google.com with SMTP id x37so4157979nfc for ; Mon, 04 Dec 2006 04:26:55 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:x-enigmail-version:content-type; b=PlbCYW3uI8vKpBl3bedpXXmjhvkceu9KL3LdowlG4aDT7YpT/uWldDvJ/VpbtjFmByvpSRXeUfWO3T95XKPfwCyjRHK+3VF3sQtus9g5FGJR9aGKSXKOq0wwRy/uI8KERjXl2X1bAfv3hEgHKYWHFaM7p9rsDT0HVvBY+A+lL8g= Received: by 10.49.58.13 with SMTP id l13mr12981276nfk.1165235214908; Mon, 04 Dec 2006 04:26:54 -0800 (PST) Received: from ?192.168.123.106? ( [195.241.221.201]) by mx.google.com with ESMTP id n22sm48690314nfc.2006.12.04.04.26.54; Mon, 04 Dec 2006 04:26:54 -0800 (PST) Message-ID: <4574140D.7010301@gmail.com> Date: Mon, 04 Dec 2006 13:26:53 +0100 From: Rene Ladan User-Agent: Thunderbird 1.5.0.8 (X11/20061117) MIME-Version: 1.0 To: Bruce Evans References: <200612031104.kB3B4jcS098474@www.freebsd.org> <20061204110256.V24317@delplex.bde.org> In-Reply-To: <20061204110256.V24317@delplex.bde.org> X-Enigmail-Version: 0.94.0.0 Content-Type: multipart/mixed; boundary="------------010800070203070007080707" Cc: freebsd-bugs@FreeBSD.org, freebsd-gnats-submit@FreeBSD.org Subject: Re: kern/106255: [msdosfs] : correct setting of archive flag X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Dec 2006 12:26:57 -0000 This is a multi-part message in MIME format. --------------010800070203070007080707 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Bruce Evans schreef: > On Sun, 3 Dec 2006, Rene Ladan wrote: > >>> Description: >> The MSDOS file system has an archive bit in the flags field. This bit >> roughly corresponds to the archive flag on the UFS file system. >> However, it is set the wrong way around: the flag should be set when >> the bit is present, and cleared when the bit is absent. > > The comment in msdosfs/direntry.h says that ATTR_ARCHIVE means that > the file is new or modified (in other words, not archived), while the > comment in sys/stat.h says that SF_ARCHIVED means that the file is > archived, but I think both mean that it is archived. > [patch 1] > This only fixes the reporting of the flag. msdosfs still maintains > the flag perfectly backwards (except DETIMES() is missing setting of > it for for all changes -- I think all changes to metadata except > possibly to atimes should set it to be perfectly backwards and clear > it to be correct). > I've attached a new patch which * fixes reporting of the flag (as in the previous patch) * sets the archive flag in DETIMES() when the file is created * cleans up the logic of not supporting setting the archive flag on directories (chunk 3) * does not set the flag when (vap->va_atime.tv_sec != VNOVAL) or (vap->va_mode != VNOVAL) in msdosfs_setattr() I think that only userland tools should send a 'clear request', as the flag only needs to be cleared when the file is backed up. The kernel cannot know when a file has been backed up. Any comments are welcome. > Bruce > Regards, Rene -- GPG fingerprint = E738 5471 D185 7013 0EE0 4FC8 3C1D 6F83 12E1 84F6 (subkeys.pgp.net) "It won't fit on the line." -- me, 2001 --------------010800070203070007080707 Content-Type: text/plain; name="msdos.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="msdos.diff" --- msdosfs_vnops.c.orig Sun Dec 3 20:45:24 2006 +++ msdosfs_vnops.c Mon Dec 4 12:43:37 2006 @@ -354,7 +354,7 @@ vap->va_birthtime.tv_nsec = 0; } vap->va_flags = 0; - if ((dep->de_Attributes & ATTR_ARCHIVE) == 0) + if (dep->de_Attributes & ATTR_ARCHIVE) vap->va_flags |= SF_ARCHIVED; vap->va_gen = 0; vap->va_blocksize = pmp->pm_bpcluster; @@ -431,12 +431,13 @@ if (error) return (error); } - if (vap->va_flags & ~SF_ARCHIVED) - return EOPNOTSUPP; if (vap->va_flags & SF_ARCHIVED) dep->de_Attributes &= ~ATTR_ARCHIVE; - else if (!(dep->de_Attributes & ATTR_DIRECTORY)) - dep->de_Attributes |= ATTR_ARCHIVE; + else + if (dep->de_Attributes & ATTR_DIRECTORY) + return EOPNOTSUPP; + else + dep->de_Attributes |= ATTR_ARCHIVE; dep->de_flag |= DE_MODIFIED; } @@ -506,8 +507,9 @@ dep->de_flag &= ~DE_UPDATE; timespec2fattime(&vap->va_mtime, 0, &dep->de_MDate, &dep->de_MTime, NULL); + dep->de_Attributes |= ATTR_ARCHIVE; + /* only set archive flag when file has changed */ } - dep->de_Attributes |= ATTR_ARCHIVE; dep->de_flag |= DE_MODIFIED; } } @@ -531,7 +533,6 @@ dep->de_Attributes &= ~ATTR_READONLY; else dep->de_Attributes |= ATTR_READONLY; - dep->de_Attributes |= ATTR_ARCHIVE; dep->de_flag |= DE_MODIFIED; } } --- denode.h.orig Thu Oct 26 11:21:07 2006 +++ denode.h Mon Dec 4 12:35:00 2006 @@ -239,6 +239,7 @@ timespec2fattime((cre), 0, &(dep)->de_CDate, \ &(dep)->de_CTime, &(dep)->de_CHun); \ (dep)->de_flag |= DE_MODIFIED; \ + (dep)->de_Attributes |= ATTR_ARCHIVE; \ } \ (dep)->de_flag &= ~(DE_UPDATE | DE_CREATE | DE_ACCESS); \ } while (0) --------------010800070203070007080707--