From: VMware, Inc <> Date: Thu, 17 Jun 2010 21:13:15 +0000 (-0700) Subject: lib/lock: propogate rank inform when binding to MX X-Git-Tag: 2010.06.16-268169~156 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac61109601d354822f84ab441bc97eb053461700;p=thirdparty%2Fopen-vm-tools.git lib/lock: propogate rank inform when binding to MX The binding MX to MXUser functions need to propogate the rank information into the MXUser lock header since the MXUser "get the rank" function takes the rank information from there. Some code gets the rank (for asserts and other sundry things) from the MX lock directly and some from the MXUser lock. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/include/userlock.h b/open-vm-tools/lib/include/userlock.h index 20e9acb87..184c1dffb 100644 --- a/open-vm-tools/lib/include/userlock.h +++ b/open-vm-tools/lib/include/userlock.h @@ -164,7 +164,8 @@ void MXUser_LogStats(unsigned epoch); void MXUser_SetInPanic(void); Bool MXUser_InPanic(void); -MXUserRecLock *MXUser_BindMXMutexRec(struct MX_MutexRec *mutex); +MXUserRecLock *MXUser_BindMXMutexRec(struct MX_MutexRec *mutex, + MX_Rank rank); struct MX_MutexRec *MXUser_GetRecLockVmm(const MXUserRecLock *lock); MX_Rank MXUser_GetRecLockRank(const MXUserRecLock *lock); #endif // _USERLOCK_H_ diff --git a/open-vm-tools/lib/lock/ulRec.c b/open-vm-tools/lib/lock/ulRec.c index 2de48adcc..2c8566f95 100644 --- a/open-vm-tools/lib/lock/ulRec.c +++ b/open-vm-tools/lib/lock/ulRec.c @@ -730,7 +730,8 @@ MXUser_GetRecLockRank(const MXUserRecLock *lock) // IN: */ MXUserRecLock * -MXUser_BindMXMutexRec(struct MX_MutexRec *mutex) // IN: +MXUser_BindMXMutexRec(struct MX_MutexRec *mutex, // IN: + MX_Rank rank) // IN: { MXUserRecLock *lock; @@ -759,7 +760,7 @@ MXUser_BindMXMutexRec(struct MX_MutexRec *mutex) // IN: lock->header.lockName = Str_SafeAsprintf(NULL, "MX_%p", mutex); lock->header.lockSignature = USERLOCK_SIGNATURE; - lock->header.lockRank = RANK_UNRANKED; // unused + lock->header.lockRank = rank; lock->header.lockDumper = NULL; #if defined(MXUSER_STATS) @@ -805,7 +806,7 @@ MXUser_InitFromMXRec(const char *name, // IN: ASSERT(isBelowBull == (rank < RANK_userlevelLock)); MX_InitLockRec(name, rank, mutex); - userLock = MXUser_BindMXMutexRec(mutex); + userLock = MXUser_BindMXMutexRec(mutex, rank); ASSERT(userLock); return userLock;