From owner-svn-src-head@FreeBSD.ORG Sun Nov 2 15:36:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 81BF2E9C; Sun, 2 Nov 2014 15:36:36 +0000 (UTC) Received: from mail-wg0-x234.google.com (mail-wg0-x234.google.com [IPv6:2a00:1450:400c:c00::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A51FC119; Sun, 2 Nov 2014 15:36:35 +0000 (UTC) Received: by mail-wg0-f52.google.com with SMTP id b13so8887515wgh.11 for ; Sun, 02 Nov 2014 07:36:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=FBPVJzu4VcSjpGjHH+vkMZYStiF6AYEfRjexLMU5xKc=; b=EaLpHzL6x+w+AYktp2NVCl/xPByPtt0Wx4T+dHcQxKHBXz300sTwS5mZQezDffrC8S oCOq+QAGNZPU8gkPjBfIOhukOwKX5fXbJEoymKgntCSaInVxZQBLqGsrJ7o9F4wWi+2e RRYDGFnrMMFheePdllUAyvNLqUfQo9Nd160/kablsCp29nsgMrua9+DisgYvfnWQ5go8 6ozAcmn4/vrNLgfnXi7DIS4x3aOLX/9MjZZ40Ts9g4rpx+fTnBaZN+7c3KGUfLxYKtkC EKH8qN4GHidLQksMUXnYKC66edqf37qLMu7Z8xnjm7sPBgDth/ZPPreZUy/mbVsYxCiS JOdA== MIME-Version: 1.0 X-Received: by 10.181.8.72 with SMTP id di8mr10487709wid.1.1414942593973; Sun, 02 Nov 2014 07:36:33 -0800 (PST) Reply-To: attilio@FreeBSD.org Sender: asmrookie@gmail.com Received: by 10.217.69.73 with HTTP; Sun, 2 Nov 2014 07:36:33 -0800 (PST) In-Reply-To: <201411021310.sA2DAWmD003298@svn.freebsd.org> References: <201411021310.sA2DAWmD003298@svn.freebsd.org> Date: Sun, 2 Nov 2014 16:36:33 +0100 X-Google-Sender-Auth: csIK21nrawP4MWcz6A9XTDzS8gg Message-ID: Subject: Re: svn commit: r273966 - in head: share/man/man9 sys/kern sys/sys From: Attilio Rao To: Konstantin Belousov Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Nov 2014 15:36:36 -0000 On Sun, Nov 2, 2014 at 2:10 PM, Konstantin Belousov wrote: > Author: kib > Date: Sun Nov 2 13:10:31 2014 > New Revision: 273966 > URL: https://svnweb.freebsd.org/changeset/base/273966 > > Log: > Fix two issues with lockmgr(9) LK_CAN_SHARE() test, which determines > whether the shared request for already shared-locked lock could be > granted. Both problems result in the exclusive locker starvation. > > The concurrent exclusive request is indicated by either > LK_EXCLUSIVE_WAITERS or LK_EXCLUSIVE_SPINNERS flags. The reverse > condition, i.e. no exclusive waiters, must check that both flags are > cleared. > > Add a flag LK_NODDLKTREAT for shared lock request to indicate that > current thread guarantees that it does not own the lock in shared > mode. This turns back the exclusive lock starvation avoidance code; > see man page update for detailed description. > > Use LK_NODDLKTREAT when doing lookup(9). > > Reported and tested by: pho > No objections from: attilio Not true, I objected to the part of the patch that modifies the semantic for changing the writer starvation avoidance technique. As I said the td_lk_slocks must work for every consumer of lockmgr, it is not specific to any usage in the kernel, including namei() or lookups. This is an hinerent property of lockmgr, it has not strict relation with its callers. Now you can deadlock lockmgr if you use recursive shared acquisition in a path that has not been identified. This part of the patch should be reverted. Attilio -- Peace can only be achieved by understanding - A. Einstein