ufs: only pass LK_ADAPTIVE if LK_NODDLKTREAT is set

This restores the pre-adaptive spinning state for SU which livelocks
otherwise. Note this is a bug in SU.

Reported by:	pho
This commit is contained in:
Mateusz Guzik 2020-08-04 23:09:15 +00:00
parent db99ec5656
commit e5e10c82ec
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=363875

View File

@ -445,7 +445,13 @@ ffs_lock(ap)
struct lock *lkp;
int result;
ap->a_flags |= LK_ADAPTIVE;
/*
* Adaptive spinning mixed with SU leads to trouble. use a giant hammer
* and only use it when LK_NODDLKTREAT is set. Currently this means it
* is only used during path lookup.
*/
if ((ap->a_flags & LK_NODDLKTREAT) != 0)
ap->a_flags |= LK_ADAPTIVE;
switch (ap->a_flags & LK_TYPE_MASK) {
case LK_SHARED:
case LK_UPGRADE:
@ -483,7 +489,11 @@ ffs_lock(ap)
}
return (result);
#else
ap->a_flags |= LK_ADAPTIVE;
/*
* See above for an explanation.
*/
if ((ap->a_flags & LK_NODDLKTREAT) != 0)
ap->a_flags |= LK_ADAPTIVE;
return (VOP_LOCK1_APV(&ufs_vnodeops, ap));
#endif
}