From: Antoine Verheijen Date: Wed, 28 Jan 2015 02:49:04 +0000 (-0700) Subject: OpenBSD: Clean up use of LK_CANRECURSE in call to lockmgr() X-Git-Tag: upstream/1.8.0_pre1^2~376 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=40d97fa9f0356fce7aec76d69dbacb81eac3db37;p=packages%2Fo%2Fopenafs.git OpenBSD: Clean up use of LK_CANRECURSE in call to lockmgr() The LK_CANRECURSE and LK_RECURSEFAIL flags in the call to lockmgr() are mutually exclusive. Previous version of OpenBSD didn't really check well for this but more recent versions look for the conflict and take a kernel panic when they're both set. The OpenBSD kernel module currently just blindly sets the LK_CANRECURSE flag in its call to lockmgr(). This patch changes that behaviour so that it checks to make sure that the LK_RECURSEFAIL flags is not set before it actually applies the LK_CANRECURSE flag. That removes the kernel panics that have started to arise. This behaviour is more consistent with other OpenBSD code that makes use of the LK_CANRECURSE flag. Change-Id: Ie435559f4b88195136e09c6184543861f06257da Reviewed-on: http://gerrit.openafs.org/11699 Tested-by: BuildBot Reviewed-by: Perry Ruiter Reviewed-by: Benjamin Kaduk --- diff --git a/src/afs/OBSD/osi_vnodeops.c b/src/afs/OBSD/osi_vnodeops.c index 022504e67..35799f2dc 100644 --- a/src/afs/OBSD/osi_vnodeops.c +++ b/src/afs/OBSD/osi_vnodeops.c @@ -978,7 +978,9 @@ afs_obsd_lock(void *v) if (!vc) panic("afs_obsd_lock: null vcache"); - return afs_osi_lockmgr(&vc->rwlock, ap->a_flags | LK_CANRECURSE, VP_INTERLOCK, ap->a_p); + return afs_osi_lockmgr(&vc->rwlock, + (ap->a_flags & LK_RECURSEFAIL) ? ap->a_flags : ap->a_flags | LK_CANRECURSE, + VP_INTERLOCK, ap->a_p); } int