svn commit: r273966 - in head: share/man/man9 sys/kern sys/sys

Attilio Rao attilio at freebsd.org
Sun Nov 2 15:36:36 UTC 2014


On Sun, Nov 2, 2014 at 2:10 PM, Konstantin Belousov <kib at freebsd.org> 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


More information about the svn-src-all mailing list