From owner-freebsd-scsi@FreeBSD.ORG Fri Sep 24 22:18:31 2010 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB069106566C for ; Fri, 24 Sep 2010 22:18:31 +0000 (UTC) (envelope-from tomas.hlavacek@elfove.cz) Received: from manwe.elfove.cz (unknown [IPv6:2001:1ab0:7e1e:d150:21e:bff:febc:5fe8]) by mx1.freebsd.org (Postfix) with ESMTP id 7AD758FC15 for ; Fri, 24 Sep 2010 22:18:31 +0000 (UTC) Received: from [192.168.1.24] (ip-78-45-42-7.net.upcbroadband.cz [78.45.42.7]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by manwe.elfove.cz (Postfix) with ESMTPSA id A897674277 for ; Sat, 25 Sep 2010 00:18:29 +0200 (CEST) Message-ID: <4C9D23B5.5050303@elfove.cz> Date: Sat, 25 Sep 2010 00:18:29 +0200 From: Tomas Hlavacek User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.12) Gecko/20100917 Icedove/3.0.8 MIME-Version: 1.0 To: freebsd-scsi@freebsd.org X-Enigmail-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: mpt0 and removing disks X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2010 22:18:32 -0000 Hi! I had the same problem and I tried to research a bit into that. I tried to read the Linux mptsas driver, but I have only found out that lots of messages from HW are ignored in FreeBSD. It would be job lasting month (at least for me) to understand what does it mean and how to port the hotplugging-related code to FreeBSD. So I have made a simple hack or workaround to make FreeBSD kernel notice that device is lost when I physically disconnect the disk to prevent freeze and/or kernel panic (that's what happened to me when I disconnected one or more disks being used at the moment by ZFS). I have to warn that I am not a FreeBSD developer at all, actually I am pretty new here in *BSD. But anyway, this hack (for FreeBSD-stable) worked for me: --- sys/dev/mpt/mpt_cam.c.orig 2010-07-22 17:38:36.000000000 +0200 +++ sys/dev/mpt/mpt_cam.c 2010-09-24 23:19:30.000000000 +0200 @@ -2415,6 +2415,12 @@ xpt_async(AC_BUS_RESET, mpt->path, NULL); break; +// Hacked MPI_EVENT_SAS_PHY_LINK_STATUS handler to react on SAS device removal. + case MPI_EVENT_SAS_PHY_LINK_STATUS: + mpt_prt(mpt, "Bus reset due to SAS PHY link status change.\n"); + xpt_async(AC_BUS_RESET, mpt->path, NULL); + break; + case MPI_EVENT_RESCAN: #if __FreeBSD_version >= 600000 { It seems that it prevents ending up in the loop waiting for command completion on SATA disks since the device is kicked out before. With SAS disks it behaves a bit differently: Few timeouts and completing timeouted/... messages are printed but after a while it resets driver and realizes that the disk is lost. I think it would be much better to parse data0 and/or data1 variables in order to react only on device removal but I have not succeeded to understand to meaning of each bit there, even though I tried to consult (much more advanced) Linux mptsas driver. BTW.: Sorry for starting a new thread for this. I just subscribed to the mailinglist and so in archives I can not see Message-ID and other headers of the original message to properly reply on it. Tomas -- Tomáš Hlaváček