Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Oct 2013 19:19:12 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r257131 - head/sys/geom
Message-ID:  <201310251919.r9PJJCwD094911@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Fri Oct 25 19:19:12 2013
New Revision: 257131
URL: http://svnweb.freebsd.org/changeset/base/257131

Log:
  Reject attempts to attack a disk device that has the old NEEDSGIANT
  flag set.
  
  Reviewed by:	mav

Modified:
  head/sys/geom/geom_disk.c
  head/sys/geom/geom_disk.h

Modified: head/sys/geom/geom_disk.c
==============================================================================
--- head/sys/geom/geom_disk.c	Fri Oct 25 19:15:21 2013	(r257130)
+++ head/sys/geom/geom_disk.c	Fri Oct 25 19:19:12 2013	(r257131)
@@ -657,6 +657,13 @@ disk_create(struct disk *dp, int version
 		    dp->d_name, dp->d_unit);
 		return;
 	}
+	if (dp->d_flags & DISKFLAG_RESERVED) {
+		printf("WARNING: Attempt to add non-MPSAFE disk %s%d\n",
+		    dp->d_name, dp->d_unit);
+		printf("WARNING: Ignoring disk %s%d\n",
+		    dp->d_name, dp->d_unit);
+		return;
+	}
 	KASSERT(dp->d_strategy != NULL, ("disk_create need d_strategy"));
 	KASSERT(dp->d_name != NULL, ("disk_create need d_name"));
 	KASSERT(*dp->d_name != 0, ("disk_create need d_name"));

Modified: head/sys/geom/geom_disk.h
==============================================================================
--- head/sys/geom/geom_disk.h	Fri Oct 25 19:15:21 2013	(r257130)
+++ head/sys/geom/geom_disk.h	Fri Oct 25 19:19:12 2013	(r257131)
@@ -103,6 +103,7 @@ struct disk {
 	void			*d_drv1;
 };
 
+#define DISKFLAG_RESERVED	0x1	/* Was NEEDSGIANT */
 #define DISKFLAG_OPEN		0x2
 #define DISKFLAG_CANDELETE	0x4
 #define DISKFLAG_CANFLUSHCACHE	0x8



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