Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Nov 2017 18:40:41 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325860 - head/sbin/newfs
Message-ID:  <201711151840.vAFIefKV002185@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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.
  
  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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711151840.vAFIefKV002185>