svn commit: r363875 - head/sys/ufs/ffs
Mateusz Guzik
mjg at FreeBSD.org
Tue Aug 4 23:09:16 UTC 2020
Author: mjg
Date: Tue Aug 4 23:09:15 2020
New Revision: 363875
URL: https://svnweb.freebsd.org/changeset/base/363875
Log:
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
Modified:
head/sys/ufs/ffs/ffs_vnops.c
Modified: head/sys/ufs/ffs/ffs_vnops.c
==============================================================================
--- head/sys/ufs/ffs/ffs_vnops.c Tue Aug 4 23:07:42 2020 (r363874)
+++ head/sys/ufs/ffs/ffs_vnops.c Tue Aug 4 23:09:15 2020 (r363875)
@@ -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
}
More information about the svn-src-head
mailing list