From: VMware, Inc <> Date: Thu, 24 Feb 2011 21:36:27 +0000 (-0800) Subject: lib/lock: simplify rank checking while panicing X-Git-Tag: 2011.02.23-368700~63 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f8069ac3705045a295844cd488ac08796f43b0e4;p=thirdparty%2Fopen-vm-tools.git lib/lock: simplify rank checking while panicing If we detect a rank violation in the locking code and we're not already panicing, making a list of the locks held is quite appropriate; the locking code will then explcitly panic. If we panic due to a non-locking cause, rank violation checking and list printing (but not panicing) can get pretty noisy - we have ranks screwed up as we try to panic and/or coredump. If the locking code is the source of a panic due to a rank violation only print the first list; other things are highly likely to be noise. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/lock/ul.c b/open-vm-tools/lib/lock/ul.c index f9f4c6f59..dc443e849 100644 --- a/open-vm-tools/lib/lock/ul.c +++ b/open-vm-tools/lib/lock/ul.c @@ -282,8 +282,14 @@ MXUserAcquisitionTracking(MXUserHeader *header, // IN: ASSERT_NOT_IMPLEMENTED(perThread->locksHeld < MXUSER_MAX_LOCKS_PER_THREAD); - /* Rank checking anyone? */ - if (checkRank && (header->rank != RANK_UNRANKED)) { + /* + * Rank checking anyone? + * + * Rank checking is abandoned once we're in a panic situation. This will + * improve the chances of obtaining a good log and/or coredump. + */ + + if (checkRank && (header->rank != RANK_UNRANKED) && !MXUser_InPanic()) { MX_Rank maxRank; Bool firstInstance = TRUE; @@ -321,15 +327,7 @@ MXUserAcquisitionTracking(MXUserHeader *header, // IN: MXUserListLocks(); - /* - * When called within a panic situation, don't panic on a rank - * violation. This helps avoid a secondary panic which will confuse - * or abort obtaining a good log and/or coredump. - */ - - if (!MXUser_InPanic()) { - MXUserDumpAndPanic(header, "%s: rank violation\n", __FUNCTION__); - } + MXUserDumpAndPanic(header, "%s: rank violation\n", __FUNCTION__); } }