Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Aug 2009 08:38:42 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r196292 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris cddl/contrib/opensolaris/uts/common/fs/zfs contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/mfi dev/xen/netfron...
Message-ID:  <200908170838.n7H8cgF1054662@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Mon Aug 17 08:38:41 2009
New Revision: 196292
URL: http://svn.freebsd.org/changeset/base/196292

Log:
  MFC r196291:
  
  - Fix a race where /dev/zfs control device is created before ZFS is fully
    initialized. Also destroy /dev/zfs before doing other deinitializations.
  - Initialization through taskq is no longer needed and there is a race
    where one of the zpool/zfs command loads zfs.ko and tries to do some work
    immediately, but /dev/zfs is not there yet.
  
  Reported by:	pav
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/ata/   (props changed)
  stable/8/sys/dev/cxgb/   (props changed)
  stable/8/sys/dev/mfi/   (props changed)
  stable/8/sys/dev/xen/netfront/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/modules/dtrace/dtnfsclient/   (props changed)
  stable/8/sys/modules/ip6_mroute_mod/   (props changed)
  stable/8/sys/modules/ipmi/ipmi_linux/   (props changed)
  stable/8/sys/netinet/ipfw/ip_dummynet.c   (props changed)
  stable/8/sys/netinet/ipfw/ip_fw2.c   (props changed)
  stable/8/sys/netinet/ipfw/ip_fw_nat.c   (props changed)
  stable/8/sys/netinet/ipfw/ip_fw_pfil.c   (props changed)
  stable/8/sys/netipx/spx_reass.c   (props changed)
  stable/8/sys/xen/evtchn.h   (props changed)
  stable/8/sys/xen/hypervisor.h   (props changed)
  stable/8/sys/xen/xen_intr.h   (props changed)

Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==============================================================================
--- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Mon Aug 17 08:36:41 2009	(r196291)
+++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Mon Aug 17 08:38:41 2009	(r196292)
@@ -3056,44 +3056,35 @@ zfsdev_fini(void)
 		destroy_dev(zfsdev);
 }
 
-static struct task zfs_start_task;
 static struct root_hold_token *zfs_root_token;
 
-
 uint_t zfs_fsyncer_key;
 extern uint_t rrw_tsd_key;
 
-static void
-zfs_start(void *context __unused, int pending __unused)
-{
-
-	zfsdev_init();
-	spa_init(FREAD | FWRITE);
-	zfs_init();
-	zvol_init();
-
-	tsd_create(&zfs_fsyncer_key, NULL);
-	tsd_create(&rrw_tsd_key, NULL);
-
-	printf("ZFS storage pool version " SPA_VERSION_STRING "\n");
-	root_mount_rel(zfs_root_token);
-}
-
 static int
 zfs_modevent(module_t mod, int type, void *unused __unused)
 {
-	int error;
+	int error = 0;
 
-	error = EOPNOTSUPP;
 	switch (type) {
 	case MOD_LOAD:
 		zfs_root_token = root_mount_hold("ZFS");
 		printf("WARNING: ZFS is considered to be an experimental "
 		    "feature in FreeBSD.\n");
-		TASK_INIT(&zfs_start_task, 0, zfs_start, NULL);
-		taskqueue_enqueue(taskqueue_thread, &zfs_start_task);
+
 		mutex_init(&zfs_share_lock, NULL, MUTEX_DEFAULT, NULL);
-		error = 0;
+
+		spa_init(FREAD | FWRITE);
+		zfs_init();
+		zvol_init();
+
+		tsd_create(&zfs_fsyncer_key, NULL);
+		tsd_create(&rrw_tsd_key, NULL);
+
+		printf("ZFS storage pool version " SPA_VERSION_STRING "\n");
+		root_mount_rel(zfs_root_token);
+
+		zfsdev_init();
 		break;
 	case MOD_UNLOAD:
 		if (spa_busy() || zfs_busy() || zvol_busy() ||
@@ -3101,14 +3092,19 @@ zfs_modevent(module_t mod, int type, voi
 			error = EBUSY;
 			break;
 		}
+
+		zfsdev_fini();
 		zvol_fini();
 		zfs_fini();
 		spa_fini();
-		zfsdev_fini();
+
 		tsd_destroy(&zfs_fsyncer_key);
 		tsd_destroy(&rrw_tsd_key);
+
 		mutex_destroy(&zfs_share_lock);
-		error = 0;
+		break;
+	default:
+		error = EOPNOTSUPP;
 		break;
 	}
 	return (error);



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