From owner-svn-src-all@FreeBSD.ORG Sun Nov 2 15:54:48 2014 Return-Path: Delivered-To: svn-src-all@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 C9E7E247; Sun, 2 Nov 2014 15:54:48 +0000 (UTC) Received: from mail-wi0-x233.google.com (mail-wi0-x233.google.com [IPv6:2a00:1450:400c:c05::233]) (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 E79362BB; Sun, 2 Nov 2014 15:54:47 +0000 (UTC) Received: by mail-wi0-f179.google.com with SMTP id h11so4585791wiw.12 for ; Sun, 02 Nov 2014 07:54:46 -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=bun0VUAfAUdlP17Apk9dMw8Mry/8k9JS16it6CC4KAg=; b=Ett01WYS6KHhjLzmQQIXs5Xcaal1UrauEZhpIrT2zvth+5dYv7bM/VLS8AzNMUWt/3 qbmY8sLYwgx6WzlajCaOE9rJB1DTl8YFle4knA1peBu03QLvnbMR3y1TvV61feuZDQR4 sl0C/jdK/BbYMqVFs5Wf9dEbsTi52+uw0hdrr7kz93dOO8Yf2qSYyxLRhDMV4thLj+J+ oXXakal8iRpRSvIs19THZCueWgh8dMc3o6bE7Rg/+mj95Vv5q0AGoKq258x1FgPxeJKb KH8ZrLO0PSYR1oaawsYqEbFeyGTNqJacusuuUpBmoiD2TGvEEM4bR93bDNxACbBgVuFL Eaiw== MIME-Version: 1.0 X-Received: by 10.194.92.82 with SMTP id ck18mr2739529wjb.103.1414943686088; Sun, 02 Nov 2014 07:54:46 -0800 (PST) Reply-To: attilio@FreeBSD.org Sender: asmrookie@gmail.com Received: by 10.217.69.73 with HTTP; Sun, 2 Nov 2014 07:54:46 -0800 (PST) In-Reply-To: <201411021310.sA2DAWmD003298@svn.freebsd.org> References: <201411021310.sA2DAWmD003298@svn.freebsd.org> Date: Sun, 2 Nov 2014 16:54:46 +0100 X-Google-Sender-Auth: kjr-sf0B1NVXruipMokKM9te-0Y 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-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Nov 2014 15:54:48 -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). The right way to implement this (selectively disabling writer starvation avoidance) must be on a lock-basis. So you need a new flag to pass to lockinit(). This is to support it "globaly". Then, you can pass it on a lockmgr() instance basis (like FreeBSD also passes, for example, LK_NOWITNESS). You can use it during lookup() calls. Maybe you will need to propagate it via the vn_lock() interface. The patch will be bigger but much cleaner and more correct than what is in head now. Attilio -- Peace can only be achieved by understanding - A. Einstein