From owner-svn-src-all@FreeBSD.ORG Tue Oct 11 22:40:06 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id A893E1065670; Tue, 11 Oct 2011 22:40:06 +0000 (UTC) Date: Tue, 11 Oct 2011 22:40:06 +0000 From: Alexander Best To: Kirk McKusick Message-ID: <20111011224006.GA22991@freebsd.org> References: <201110111903.p9BJ3vAE028408@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201110111903.p9BJ3vAE028408@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r226266 - head/sbin/tunefs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2011 22:40:06 -0000 On Tue Oct 11 11, Kirk McKusick wrote: > Author: mckusick > Date: Tue Oct 11 19:03:57 2011 > New Revision: 226266 > URL: http://svn.freebsd.org/changeset/base/226266 > > Log: > After creating a filesystem using newfs -j the time stamps are all > zero and thus report as having been made in January 1970. Apart > from looking a bit silly, it also triggers alarms from scripts > that detect weird time stamps. This update sets all 4 (or 3, in > the case of UFS1) time stamps to the current time when enabling > journaling during newfs or later when enabling it with tunefs. on an already existing UFS2 fs with SU+SUJ enabled, will a `touch .sujournal` also set those 4 time stamps to sensible values, or will this somehow break the journal? cheers. alex > > Reported by: Hans Ottevanger > MFC after: 1 week > > Modified: > head/sbin/tunefs/tunefs.c > > Modified: head/sbin/tunefs/tunefs.c > ============================================================================== > --- head/sbin/tunefs/tunefs.c Tue Oct 11 18:46:41 2011 (r226265) > +++ head/sbin/tunefs/tunefs.c Tue Oct 11 19:03:57 2011 (r226266) > @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > > /* the optimization warning string template */ > @@ -923,6 +924,7 @@ journal_alloc(int64_t size) > ino_t ino; > int blks; > int mode; > + time_t utime; > int i; > > cgp = &disk.d_cg; > @@ -983,18 +985,26 @@ journal_alloc(int64_t size) > */ > dp2 = ip; > dp1 = ip; > + time(&utime); > if (sblock.fs_magic == FS_UFS1_MAGIC) { > bzero(dp1, sizeof(*dp1)); > dp1->di_size = size; > dp1->di_mode = IFREG | IREAD; > dp1->di_nlink = 1; > dp1->di_flags = SF_IMMUTABLE | SF_NOUNLINK | UF_NODUMP; > + dp1->di_atime = utime; > + dp1->di_mtime = utime; > + dp1->di_ctime = utime; > } else { > bzero(dp2, sizeof(*dp2)); > dp2->di_size = size; > dp2->di_mode = IFREG | IREAD; > dp2->di_nlink = 1; > dp2->di_flags = SF_IMMUTABLE | SF_NOUNLINK | UF_NODUMP; > + dp2->di_atime = utime; > + dp2->di_mtime = utime; > + dp2->di_ctime = utime; > + dp2->di_birthtime = utime; > } > for (i = 0; i < NDADDR && resid; i++, resid--) { > blk = journal_balloc();