HomeFreeBSD

sx: don't do an atomic op in upgrade if it cananot succeed

Description

sx: don't do an atomic op in upgrade if it cananot succeed

The code already pays the cost of reading the lock to obtain the waiters
flag. Checking whether there is more than one reader is not a problem and
avoids dirtying the line.

This also fixes a small corner case: if waiters were to show up between
reading the flag and upgrading the lock, the operation would fail even
though it should not. No correctness change here though.

Details

Provenance
mjgAuthored on
Parents
rS330414: locks: fix a corner case in r327399
Branches
Unknown
Tags
Unknown