]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/lock: simplify rank checking while panicing
authorVMware, Inc <>
Thu, 24 Feb 2011 21:36:27 +0000 (13:36 -0800)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 24 Feb 2011 21:36:27 +0000 (13:36 -0800)
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 <mvanzin@vmware.com>
open-vm-tools/lib/lock/ul.c

index f9f4c6f5934d396985946f10e49175b15adb6e8c..dc443e849c944dc1c0a8c78ffc7240d9726c4b82 100644 (file)
@@ -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__);
       }
    }