svn commit: r325860 - head/sbin/newfs

Rodney W. Grimes freebsd at pdx.rh.CN85.dnsmgr.net
Wed Nov 15 20:51:09 UTC 2017


[ Charset UTF-8 unsupported, converting... ]
> On Nov 15, 2017 11:47 AM, "Rodney W. Grimes" <freebsd at pdx.rh.cn85.dnsmgr.net>
> wrote:
> 
> > Author: emaste
> > Date: Wed Nov 15 18:40:40 2017
> > New Revision: 325860
> > URL: https://svnweb.freebsd.org/changeset/base/325860
> >
> > Log:
> >   newfs: warn if newer than kernel
> >
> >   Creating a UFS filesystem with a newfs newer than the running kernel,
> >   and then mounting that filesystem, can lead to interesting failures.
> >
> >   Add a safety belt to explicitly warn when newfs is newer than the
> >   running kernel.
> 
> You should probably make the warning if (newer || older) as
> either is likely to have interesting side effects, as are
> mounting ufs file systems on different versions.
> 
> 
> Not really. The cg stuff is really only a hassle for the case ed is testing
> for.

Its too late now, but if you take a newer ufs with the cg
stuff in them and mount it on an old system it politly well
corrupt the data that the newer kernel needs.  So your right,
doing this check in newfs wont do anything, but I can tell
you this tiny little chain has been a PITA for people that
move HD around....

> *Sigh*  why did not UFS grow a version number of its own
> when things started to change other than UFS1 vs UFS2.
> 
> 
> This isn't anything like those changes..

UFS changed in a way that makes it difficult to move
UFS drives accross systems that are at differing versions.
That IS bad no mater how you slice it.  I now have to make
sure I fsck a drive when moving it from an old to new
system to get the cg checksum stuff fixed.


> Warner
> 
> >   Reviewed by:        gjb, jhb, mckusick
> >   Sponsored by:       The FreeBSD Foundation
> >   Differential Revision:      https://reviews.freebsd.org/D12765
> >
> > Modified:
> >   head/sbin/newfs/newfs.c
> >
> > Modified: head/sbin/newfs/newfs.c
> > ============================================================
> ==================
> > --- head/sbin/newfs/newfs.c   Wed Nov 15 18:03:31 2017        (r325859)
> > +++ head/sbin/newfs/newfs.c   Wed Nov 15 18:40:40 2017        (r325860)
> > @@ -398,6 +398,10 @@ main(int argc, char *argv[])
> >               if (pp != NULL)
> >                       pp->p_size *= secperblk;
> >       }
> > +     if (getosreldate() < __FreeBSD_version) {
> > +             warnx("%s is newer than the running kernel and may not be
> compatible",
> > +                 getprogname());
> > +     }
> >       mkfs(pp, special);
> >       ufs_disk_close(&disk);
> >       if (!jflag)
> >
> >
> 
> --
> Rod Grimes
> rgrimes at freebsd.org

-- 
Rod Grimes                                                 rgrimes at freebsd.org


More information about the svn-src-all mailing list