kern/174684 [tws] [patch] 3dm2 (or smartctl) triggers a kernel panic

John-Mark Gurney jmg at funkthat.com
Mon Nov 4 04:00:02 UTC 2013


The following reply was made to PR kern/174684; it has been noted by GNATS.

From: John-Mark Gurney <jmg at funkthat.com>
To: bug-followup at FreeBSD.org, 3226388001 at jcom.home.ne.jp
Cc:  
Subject: Re: kern/174684 [tws] [patch] 3dm2 (or smartctl) triggers a kernel panic
Date: Sun, 3 Nov 2013 19:51:53 -0800

 --jCrbxBqMcLqd4mOl
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 I have a better patch that eliminates the unnecessary chan, and just
 uses sc as the wait channel...  The panic appears due to the fact that
 chan might not be initalized, and running an extra wakeup is not a big
 issue...
 
 If someone could test the patch, I'll commit it..
 
 Thanks.
 
 -- 
   John-Mark Gurney				Voice: +1 415 225 5579
 
      "All that I will do, has been done, All that I have, has not."
 
 --jCrbxBqMcLqd4mOl
 Content-Type: text/x-diff; charset=us-ascii
 Content-Disposition: attachment; filename="tws.patch"
 
 Index: tws.h
 ===================================================================
 --- tws.h	(revision 256870)
 +++ tws.h	(working copy)
 @@ -248,7 +248,6 @@
      struct mtx io_lock;                   /* IO  lock */
      struct tws_ioctl_lock ioctl_lock;     /* ioctl lock */ 
      u_int32_t seq_id;                     /* Sequence id */
 -    void *chan;                           /* IOCTL req wait channel */
      struct tws_circular_q aen_q;          /* aen q */
      struct tws_circular_q trace_q;        /* trace q */
      struct tws_stats stats;               /* I/O stats */
 Index: tws_cam.c
 ===================================================================
 --- tws_cam.c	(revision 256870)
 +++ tws_cam.c	(working copy)
 @@ -1297,7 +1297,7 @@
  
      tws_turn_on_interrupts(sc);
  
 -    wakeup_one(sc->chan);
 +    wakeup_one(sc);
  }
  
  
 Index: tws_user.c
 ===================================================================
 --- tws_user.c	(revision 256870)
 +++ tws_user.c	(working copy)
 @@ -103,8 +103,7 @@
      do {
          req = tws_get_request(sc, TWS_REQ_TYPE_PASSTHRU);
          if ( !req ) {
 -            sc->chan = (void *)sc;
 -            error = tsleep(sc->chan,  0, "tws_sleep", TWS_IOCTL_TIMEOUT*hz);
 +            error = tsleep(sc,  0, "tws_sleep", TWS_IOCTL_TIMEOUT*hz);
              if ( error == EWOULDBLOCK ) {
                  return(ETIMEDOUT);
              }
 @@ -203,7 +202,7 @@
      //
      req->state = TWS_REQ_STATE_FREE;
  
 -    wakeup_one(sc->chan);
 +    wakeup_one(sc);
  
      return(error);
  }
 
 --jCrbxBqMcLqd4mOl--


More information about the freebsd-bugs mailing list