From owner-freebsd-scsi@FreeBSD.ORG Sun Aug 7 21:27:10 2011 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 D6A57106564A for ; Sun, 7 Aug 2011 21:27:10 +0000 (UTC) (envelope-from mj@feral.com) Received: from ns1.feral.com (ns1.feral.com [192.67.166.1]) by mx1.freebsd.org (Postfix) with ESMTP id A3DB08FC0A for ; Sun, 7 Aug 2011 21:27:10 +0000 (UTC) Received: from [192.168.135.103] (c-24-7-47-62.hsd1.ca.comcast.net [24.7.47.62]) (authenticated bits=0) by ns1.feral.com (8.14.4/8.14.4) with ESMTP id p77LR8FO009197 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Sun, 7 Aug 2011 14:27:09 -0700 (PDT) (envelope-from mj@feral.com) Message-ID: <4E3F0332.7030004@feral.com> Date: Sun, 07 Aug 2011 14:27:14 -0700 From: Matthew Jacob Organization: Feral Software User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: freebsd-scsi@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (ns1.feral.com [192.67.166.1]); Sun, 07 Aug 2011 14:27:09 -0700 (PDT) Subject: some changes to xpt to help make unloading sim modules safer 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: Sun, 07 Aug 2011 21:27:10 -0000 See http://people.freebsd.org/~mjacob/xpt_patches.txt The first one come from a coworker (Chuck Tuffli) who found a hole xpt_create_path_unlocked. I added a few after that to guard against overrunning some counters so that they would wrap. It helped me find out what was going on much easier by adding the function described here: http://people.freebsd.org/~mjacob/xpt_path_counts.txt Finally, http://people.freebsd.org/~mjacob/isp_patches.txt makes isp safe for unload as a module. There's some ambiguity over whether it's safe to unload when a periph is open. Using xpt_path_counts to check with the bus reference count is > 3 for each scsibus attached to each isp sim is a way to avoid that. Comments?