From owner-freebsd-bugs@FreeBSD.ORG Mon Nov 4 04:00:02 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7655EC54 for ; Mon, 4 Nov 2013 04:00:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4B965259D for ; Mon, 4 Nov 2013 04:00:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id rA4401Rw040645 for ; Mon, 4 Nov 2013 04:00:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id rA44011N040644; Mon, 4 Nov 2013 04:00:01 GMT (envelope-from gnats) Date: Mon, 4 Nov 2013 04:00:01 GMT Message-Id: <201311040400.rA44011N040644@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: John-Mark Gurney Subject: Re: kern/174684 [tws] [patch] 3dm2 (or smartctl) triggers a kernel panic X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: John-Mark Gurney List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Nov 2013 04:00:02 -0000 The following reply was made to PR kern/174684; it has been noted by GNATS. From: John-Mark Gurney To: bug-followup@FreeBSD.org, 3226388001@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--