From owner-freebsd-scsi@FreeBSD.ORG Wed Apr 8 15:40:39 2015 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3154FF28 for ; Wed, 8 Apr 2015 15:40:39 +0000 (UTC) Received: from mail-wg0-f41.google.com (mail-wg0-f41.google.com [74.125.82.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BD208B89 for ; Wed, 8 Apr 2015 15:40:38 +0000 (UTC) Received: by wgsk9 with SMTP id k9so69919924wgs.3 for ; Wed, 08 Apr 2015 08:40:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:mime-version:thread-index:date:message-id :subject:to:cc:content-type; bh=iiUc36fvrpSoDwOvkQCbau2tLjsQtzgdOaZKRoc/Ipc=; b=IMtUayASJ5YLyTWQIxQdgaRP0pX014jGCpspIE914oydT6L6xMnRQDH/Wv35k3zhhs E6va3yiehGSYqpslT7cCydfXETkLFPRegLZpRz12o8pRg/w3gS2mWzH6okk3Knj71wPn RA+krNzIZc5u9ncisx92YK3IUAYnRRS6dIHXX+4cotEasDEJmf84fkRDC6afgu2YRG9s NWGl3NFCiNry4TnkXS04SlVCcRTr/czrPS7koNPX4W070Ji/WDXxG55EAoUzAYhBFZ/i DMef3wY1TTH38VX/WabHcLhaLzQyusMg1hBiPFVs9F5z4vax6NhgGb1lsHBp++6N4nCr kOgA== X-Gm-Message-State: ALoCoQnckO3hKW0UupqCGSD2P++3hjmrkjB46QJkuhkkMCqQd35yWm8TF2ezdiJMPJNaCtzPLWc1 X-Received: by 10.195.12.97 with SMTP id ep1mr52298752wjd.134.1428507631523; Wed, 08 Apr 2015 08:40:31 -0700 (PDT) From: Sibananda Sahu MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AdByElXStoOcI9WhRiGEYM1YJOJM1w== Date: Wed, 8 Apr 2015 21:10:27 +0530 Message-ID: Subject: scsi_scan_bus in FreeBSD 10.1 has mutex unlock and lock swapped To: freebsd-scsi@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "Kenneth D. Merry" , scottl@freebsd.org X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Apr 2015 15:40:39 -0000 Hi, Recently I was working with mpslsi3 driver and found that the system just crashed at xpt_action() call. After digging a little into the CAM layer code I found that: inside scsi_scan_bus()at line number: 1935 first mutex_unlock(mtx) is called and then at line 1974 called mtx_lock(mtx) just before exiting the XPT_SCAN_BUS case. I just swapped the calls and called mutex_lock() first and then called mutex_unlock() and found there is no kernel panic. Driver was loaded just fine but after a while I was unable to operate the system. But pinging to the system was working and the system was up. Is it OK or it looks to be a bug? Thanks, Sibananda Sahu