]> git.proxmox.com Git - mirror_spl-debian.git/commitdiff
Switch KM_SLEEP to KM_PUSHPAGE
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 12 Sep 2012 19:24:41 +0000 (12:24 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 12 Sep 2012 19:27:09 +0000 (12:27 -0700)
Under certain circumstances the following functions may be called
in a context where KM_SLEEP is unsafe and can result in a deadlocked
system.  To avoid this problem the unconditional KM_SLEEPs are
converted to KM_PUSHPAGEs.  This will prevent them from attempting
to initiate any I/O during direct reclaim.

This change was originally part of cd5ca4b but was reverted by
330fe01.  It always should have had its own commit for exactly
this reason.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
module/spl/spl-thread.c

index 9f6e2237909662a1ae45fe848fb93584d8a34cf8..71e5f331d5a9c896d9d354a8bb6ec756181d79d1 100644 (file)
@@ -98,14 +98,14 @@ __thread_create(caddr_t stk, size_t  stksize, thread_func_t func,
        /* Variable stack size unsupported */
        ASSERT(stk == NULL);
 
-       tp = kmem_alloc(sizeof(thread_priv_t), KM_SLEEP);
+       tp = kmem_alloc(sizeof(thread_priv_t), KM_PUSHPAGE);
        if (tp == NULL)
                SRETURN(NULL);
 
        tp->tp_magic = TP_MAGIC;
        tp->tp_name_size = strlen(name) + 1;
 
-       tp->tp_name = kmem_alloc(tp->tp_name_size, KM_SLEEP);
+       tp->tp_name = kmem_alloc(tp->tp_name_size, KM_PUSHPAGE);
         if (tp->tp_name == NULL) {
                kmem_free(tp, sizeof(thread_priv_t));
                SRETURN(NULL);