Print this page
9249 System crash dump to NVME not working
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Ryan Zezeski <rpz@joyent.com>

@@ -22,11 +22,13 @@
 /*
  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident   "%Z%%M% %I%     %E% SMI"
+/*
+ * Copyright 2018 Nexenta Systems, Inc. All rights reserved.
+ */
 
 /*
  * This file contains the semaphore operations.
  */
 

@@ -225,19 +227,19 @@
 sema_p(ksema_t *sp)
 {
         sema_impl_t     *s;
         disp_lock_t     *sqlp;
 
+        /* no-op during panic */
+        if (panicstr)
+                return;
+
         s = (sema_impl_t *)sp;
         sqlp = &SQHASH(s)->sq_lock;
         disp_lock_enter(sqlp);
         ASSERT(s->s_count >= 0);
         while (s->s_count == 0) {
-                if (panicstr) {
-                        disp_lock_exit(sqlp);
-                        return;
-                }
                 thread_lock_high(curthread);
                 SEMA_BLOCK(s, sqlp);
                 thread_unlock_nopreempt(curthread);
                 swtch();
                 disp_lock_enter(sqlp);

@@ -331,17 +333,17 @@
 {
         sema_impl_t     *s;
         kthread_t       *sq, *tp;
         disp_lock_t     *sqlp;
 
+        /* no-op during panic */
+        if (panicstr)
+                return;
+
         s = (sema_impl_t *)sp;
         sqlp = &SQHASH(s)->sq_lock;
         disp_lock_enter(sqlp);
-        if (panicstr) {
-                disp_lock_exit(sqlp);
-                return;
-        }
         s->s_count++;
         sq = s->s_slpq;
         if (sq != NULL) {
                 tp = sq;
                 ASSERT(THREAD_LOCK_HELD(tp));

@@ -371,10 +373,14 @@
         sema_impl_t     *s;
         sleepq_head_t   *sqh;
 
         int     gotit = 0;
 
+        /* no-op during panic */
+        if (panicstr)
+                return (1);
+
         s = (sema_impl_t *)sp;
         sqh = SQHASH(s);
         disp_lock_enter(&sqh->sq_lock);
         if (s->s_count > 0) {
                 s->s_count--;

@@ -387,12 +393,12 @@
 int
 sema_held(ksema_t *sp)
 {
         sema_impl_t     *s;
 
-
-        s = (sema_impl_t *)sp;
+        /* no-op during panic */
         if (panicstr)
                 return (1);
-        else
+
+        s = (sema_impl_t *)sp;
                 return (s->s_count <= 0);
 }