svn commit: r256560 - in projects/camlock/sys: cddl/contrib/opensolaris/uts/common/fs/zfs geom sys
Alexander Motin
mav at FreeBSD.org
Tue Oct 15 21:04:19 UTC 2013
Author: mav
Date: Tue Oct 15 21:04:18 2013
New Revision: 256560
URL: http://svnweb.freebsd.org/changeset/base/256560
Log:
Introduce THREAD_CAN_SLEEP() to check whether current thread is allowed to
sleep by checking ((curthread)->td_no_sleeping == 0). Use that to find out
whether GEOM and classes code can sleep. Previous check for one of GEOM
threads was insufficient because request can be sent from other unrelated
request bio_done() method called at interrupt thread, where sleeping is
prohibited.
Modified:
projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
projects/camlock/sys/geom/geom_io.c
projects/camlock/sys/sys/proc.h
Modified: projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
==============================================================================
--- projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Tue Oct 15 21:02:02 2013 (r256559)
+++ projects/camlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Tue Oct 15 21:04:18 2013 (r256560)
@@ -2261,14 +2261,14 @@ zvol_geom_start(struct bio *bp)
ASSERT(zv != NULL);
switch (bp->bio_cmd) {
case BIO_FLUSH:
- if (g_is_geom_thread(curthread))
+ if (!THREAD_CAN_SLEEP())
goto enqueue;
zil_commit(zv->zv_zilog, ZVOL_OBJ);
g_io_deliver(bp, 0);
break;
case BIO_READ:
case BIO_WRITE:
- if (g_is_geom_thread(curthread))
+ if (!THREAD_CAN_SLEEP())
goto enqueue;
zvol_strategy(bp);
break;
Modified: projects/camlock/sys/geom/geom_io.c
==============================================================================
--- projects/camlock/sys/geom/geom_io.c Tue Oct 15 21:02:02 2013 (r256559)
+++ projects/camlock/sys/geom/geom_io.c Tue Oct 15 21:04:18 2013 (r256560)
@@ -518,7 +518,9 @@ g_io_request(struct bio *bp, struct g_co
#ifdef GET_STACK_USAGE
direct = (cp->flags & G_CF_DIRECT_SEND) &&
(pp->flags & G_PF_DIRECT_RECEIVE) &&
- !g_is_geom_thread(curthread);
+ !g_is_geom_thread(curthread) &&
+ (((pp->flags & G_PF_ACCEPT_UNMAPPED) == 0 &&
+ (bp->bio_flags & BIO_UNMAPPED) != 0) || THREAD_CAN_SLEEP());
if (direct) {
/* Block direct execution if less then half of stack left. */
size_t st, su;
Modified: projects/camlock/sys/sys/proc.h
==============================================================================
--- projects/camlock/sys/sys/proc.h Tue Oct 15 21:02:02 2013 (r256559)
+++ projects/camlock/sys/sys/proc.h Tue Oct 15 21:04:18 2013 (r256560)
@@ -793,6 +793,8 @@ extern pid_t pid_max;
#define THREAD_SLEEPING_OK() ((curthread)->td_no_sleeping--)
+#define THREAD_CAN_SLEEP() ((curthread)->td_no_sleeping == 0)
+
#define PIDHASH(pid) (&pidhashtbl[(pid) & pidhash])
extern LIST_HEAD(pidhashhead, proc) *pidhashtbl;
extern u_long pidhash;
More information about the svn-src-projects
mailing list