Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
DISCONTINUED:openSUSE:11.2:Update
sblim-sfcb
0200-2192023-Fix-nsHt-deadlock.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0200-2192023-Fix-nsHt-deadlock.patch of Package sblim-sfcb
From d67f071cb4ce08bcfaf2dcd1b267e40929f816cd Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de> Date: Fri, 24 Oct 2008 15:56:51 +0200 Subject: [PATCH] Fix nsHt deadlock The global namespace hash table must only be created once. On fast multi-core systems, a simple 'if (nsHt != NULL)' is not sufficient since another thread might still be filling nsHt. --- classProviderGz.c | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-) diff --git a/classProviderGz.c b/classProviderGz.c index 10b88e9..07748c7 100644 --- a/classProviderGz.c +++ b/classProviderGz.c @@ -124,6 +124,7 @@ typedef struct nameSpaces { } NameSpaces; static UtilHashTable *nsHt=NULL; +static pthread_once_t nsHt_once = PTHREAD_ONCE_INIT; static int nsBaseLen; static void buildInheritanceTable(ClassRegister * cr) @@ -402,12 +403,13 @@ static ClassRegister *newClassRegister(char *fname) free(buf); free(cc); } - +#if 0 if (cr->vr) { mlogf(M_INFO,M_SHOW,"--- Caching ClassProvider for %s (%d.%d-%d) using %ld bytes\n", fin, cr->vr->version, cr->vr->level, cr->vr->objImplLevel, total); } else mlogf(M_INFO,M_SHOW,"--- Caching ClassProvider for %s (no-version) using %ld bytes\n", fin, total); +#endif buildInheritanceTable(cr); @@ -476,6 +478,11 @@ static UtilHashTable *buildClassRegisters() return gatherNameSpaces(dn,NULL,1); } +static void nsHt_init() +{ + nsHt=buildClassRegisters(); +} + static ClassRegister *getNsReg(const CMPIObjectPath *ref, int *rc) { @@ -483,9 +490,15 @@ static ClassRegister *getNsReg(const CMPIObjectPath *ref, int *rc) CMPIString *nsi=CMGetNameSpace(ref,NULL); ClassRegister *cReg; *rc=0; - - if (nsHt==NULL) nsHt=buildClassRegisters(); - + + pthread_once(&nsHt_once, nsHt_init); + + if (nsHt==NULL) { + mlogf(M_ERROR,M_SHOW,"--- ClassProvider: namespace hash table not initialized\n"); + *rc = 1; + return NULL; + } + if (nsi && nsi->hdl) { ns=(char*)nsi->hdl; if (strcasecmp(ns,"root/pg_interop")==0) -- 1.6.0.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor