]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE12-viced-alloc-hosts-held-and-locked-20030114
authorDerrick Brashear <shadow@dementia.org>
Fri, 17 Jan 2003 06:02:44 +0000 (06:02 +0000)
committerDerrick Brashear <shadow@dementia.org>
Fri, 17 Jan 2003 06:02:44 +0000 (06:02 +0000)
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)

src/viced/host.c

index 226a7946191b0b5c67ffaf4cfb702c323ff2cf89..61bf469b1b18ed0553e288efcc219ad38f3b4231 100644 (file)
@@ -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) {