From owner-freebsd-scsi@FreeBSD.ORG Sun Mar 21 07:14:20 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 3C5D7106566B; Sun, 21 Mar 2010 07:14:20 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.158]) by mx1.freebsd.org (Postfix) with ESMTP id 635B38FC18; Sun, 21 Mar 2010 07:14:19 +0000 (UTC) Received: by fg-out-1718.google.com with SMTP id d23so103284fga.13 for ; Sun, 21 Mar 2010 00:14:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=3F/SEPiMvbgb4AqGf48qkRA1QUbpV4Nxn+sH0DmGjPA=; b=JZrAb38jk3otlvsmV2+Fj7a/2cCCH3Nimq02ubn97sR/tpd+em0OatbFMjTtO7ErLi pcBACQKF4au7/7iGv+91CJLzy+RCS/vTxLdjxln6PLIlUWCP0CX5IgSLV9gz8ZM9pKrM XnB69EdEWLAumaiYccNoKwU+uUxGZRpzwYhvg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=wXW5Lu2/6eTWPv2GSBwOmM+DJcQirDXU4UzD0xK8jhfmkDcR34Us/8GtIPSTqvHLrR N9KKyWktf9La34pw5A/B0sHs0UyoBBjW86yJmcOqZtEThwHPsoz9aQVwOYXeYrV0/mOt IM0Q+Hk7TH55prYrhu2zJCKRxM3cOsvwe49wY= Received: by 10.87.47.32 with SMTP id z32mr9978179fgj.36.1269155658088; Sun, 21 Mar 2010 00:14:18 -0700 (PDT) Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id 16sm686292fxm.8.2010.03.21.00.14.17 (version=SSLv3 cipher=RC4-MD5); Sun, 21 Mar 2010 00:14:17 -0700 (PDT) Sender: Alexander Motin Message-ID: <4BA5C746.7060203@FreeBSD.org> Date: Sun, 21 Mar 2010 09:14:14 +0200 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: Attilio Rao References: <3bbf2fe11002281655i61a5f0a0if3f381ad0c4a1ef8@mail.gmail.com> <3bbf2fe11003031532u2207eb55h19c3a045215a7d84@mail.gmail.com> <4B8EF336.80107@feral.com> <3bbf2fe11003031547kd5f7314t3d83b2bde06c1c2f@mail.gmail.com> <4B8EF990.5030407@feral.com> <3bbf2fe11003031607wa3727b5ke89bc2a909d4d6a6@mail.gmail.com> <4B901419.8060800@feral.com> <3bbf2fe11003041737p30690522ya81e1b8f4bd6bbf9@mail.gmail.com> <3bbf2fe11003120601y3c403a1ct50f9fc6c1f0903bf@mail.gmail.com> <4B9A91DA.7030107@FreeBSD.org> <3bbf2fe11003200523t60895bfv1fa73d04e58a7838@mail.gmail.com> In-Reply-To: <3bbf2fe11003200523t60895bfv1fa73d04e58a7838@mail.gmail.com> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: freebsd-scsi@freebsd.org, "Justin T. Gibbs" , mj@feral.com, Ed Maste Subject: Re: How is supposed to be protected the units list? 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, 21 Mar 2010 07:14:20 -0000 Attilio Rao wrote: > So I made this new patch using the bus lock: > http://www.freebsd.org/~attilio/Sandvine/pdrv/xpt_lock.diff OK. I've looked on both and I think both have race window between unit number allocation and insertion into the list. I've changed last patch to not drop the lock in meantime. What do you think about this: http://people.freebsd.org/~mav/unit_lock.patch ? Part about scsi_da.c I don't like in both cases, as I am not sure that locks can't be recursed there in case of some errors. I don't see how adding second lock could solve it. > I would have preferred to have a dedicated lock for the units lists, > but as long as you seem having strong opionion, I'm fine with it. I haven't told it is strong. I have asked some time to check it. Now comparing the patches I don't see benefits from having second lock. I would say you just changing possible lock recursions to possible LORs. It's not much better. -- Alexander Motin