From: Derrick Brashear Date: Fri, 17 Jan 2003 06:02:44 +0000 (+0000) Subject: STABLE12-viced-alloc-hosts-held-and-locked-20030114 X-Git-Tag: openafs-stable-1_2_9~77 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=613c1f4f64c9601ae1e719dd4929e3266fdd8cfa;p=packages%2Fo%2Fopenafs.git STABLE12-viced-alloc-hosts-held-and-locked-20030114 to avoid potential race as we chain in while allocating then try to lock after returning to h_GetHost_r (cherry picked from commit cff9ae0f1036782018c818ba7176ad16e9ae202c) --- diff --git a/src/viced/host.c b/src/viced/host.c index 226a79461..61bf469b1 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -622,6 +622,8 @@ struct host *h_Alloc_r(r_con) /*host->hcpsfailed = 0; /* save cycles */ /* h_gethostcps(host); do this under host lock */ host->FirstClient = 0; + h_Hold_r(host); + h_Lock_r(host); h_InsertList_r(host); /* update global host List */ #if FS_STATS_DETAILED /* @@ -1064,8 +1066,6 @@ retry: } } else { host = h_Alloc_r(tcon); - h_Hold_r(host); - h_Lock_r(host); h_gethostcps_r(host,FT_ApproxTime()); if (!(host->Console&1)) { if (!identP || !interfValid) {