Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jan 2011 12:57:07 +0000 (UTC)
From:      Martin Matuska <mm@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r216919 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys
Message-ID:  <201101031257.p03Cv7C4091596@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mm
Date: Mon Jan  3 12:57:07 2011
New Revision: 216919
URL: http://svn.freebsd.org/changeset/base/216919

Log:
  MFp4 r186485, r186859:
  
  Fix a race by defining two tasks in the zio structure
  as we can still be returning from issue task when interrupt task is used.
  
  Tested by:	pjd
  Approved by:	pjd, delphij (mentor)
  MFC after:	3 days

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h	Mon Jan  3 09:18:12 2011	(r216918)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h	Mon Jan  3 12:57:07 2011	(r216919)
@@ -340,7 +340,8 @@ struct zio {
 
 #ifdef _KERNEL
 	/* FreeBSD only. */
-	struct ostask	io_task;
+	struct ostask	io_task_issue;
+	struct ostask	io_task_interrupt;
 #endif
 };
 

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c	Mon Jan  3 09:18:12 2011	(r216918)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c	Mon Jan  3 12:57:07 2011	(r216919)
@@ -947,6 +947,18 @@ zio_taskq_dispatch(zio_t *zio, enum zio_
 {
 	spa_t *spa = zio->io_spa;
 	zio_type_t t = zio->io_type;
+#ifdef _KERNEL
+	struct ostask *task;
+#endif
+
+	ASSERT(q == ZIO_TASKQ_ISSUE || q == ZIO_TASKQ_INTERRUPT);
+
+#ifdef _KERNEL
+	if (q == ZIO_TASKQ_ISSUE)
+		task = &zio->io_task_issue;
+	else /* if (q == ZIO_TASKQ_INTERRUPT) */
+		task = &zio->io_task_interrupt;
+#endif
 
 	/*
 	 * If we're a config writer or a probe, the normal issue and
@@ -970,8 +982,13 @@ zio_taskq_dispatch(zio_t *zio, enum zio_
 		q++;
 
 	ASSERT3U(q, <, ZIO_TASKQ_TYPES);
+#ifdef _KERNEL
 	(void) taskq_dispatch_safe(spa->spa_zio_taskq[t][q],
-	    (task_func_t *)zio_execute, zio, &zio->io_task);
+	    (task_func_t *)zio_execute, zio, task);
+#else
+	(void) taskq_dispatch(spa->spa_zio_taskq[t][q],
+	    (task_func_t *)zio_execute, zio, TQ_SLEEP);
+#endif
 }
 
 static boolean_t
@@ -2300,9 +2317,16 @@ zio_done(zio_t *zio)
 			 * Reexecution is potentially a huge amount of work.
 			 * Hand it off to the otherwise-unused claim taskq.
 			 */
+#ifdef _KERNEL
 			(void) taskq_dispatch_safe(
 			    spa->spa_zio_taskq[ZIO_TYPE_CLAIM][ZIO_TASKQ_ISSUE],
-			    (task_func_t *)zio_reexecute, zio, &zio->io_task);
+			    (task_func_t *)zio_reexecute, zio,
+				&zio->io_task_issue);
+#else
+			(void) taskq_dispatch(
+			    spa->spa_zio_taskq[ZIO_TYPE_CLAIM][ZIO_TASKQ_ISSUE],
+				(task_func_t *)zio_reexecute, zio, TQ_SLEEP);
+#endif
 		}
 		return (ZIO_PIPELINE_STOP);
 	}



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