HomeFreeBSD

Fix livelock in ufsdirhash_create().

Description

Fix livelock in ufsdirhash_create().

When more than one thread enters ufsdirhash_create() for the same
directory and the inode dirhash is instantiated, but the dirhash' hash
is not, all of them lock the dirhash shared and then try to upgrade.
Since there are several threads owning the lock shared, upgrade fails
and the same attempt is repeated, ad infinitum.

To break the lockstep, lock the dirhash in exclusive mode after the
failed try-upgrade.

Reported and tested by: pho
Sponsored by: Mellanox Technologies
MFC after: 1 week

Details

Provenance
kibAuthored on
Parents
rS326656: Move instantiation of msgbufp from 9 MD files to subr_prf.c.
Branches
Unknown
Tags
Unknown