From cff9ae0f1036782018c818ba7176ad16e9ae202c Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Wed, 15 Jan 2003 00:21:08 +0000 Subject: [PATCH] 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 --- src/viced/host.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/viced/host.c b/src/viced/host.c index 9c4f5e1ff..7f40ead77 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -525,7 +525,7 @@ return; /* * Allocate a host. It will be identified by the peer (ip,port) info in the - * rx connection provided. The host is returned un-held and un-locked + * rx connection provided. The host is returned held and locked */ #define DEF_ROPCONS 2115 @@ -586,6 +586,8 @@ struct host *h_Alloc_r(register struct rx_connection *r_con) h_gethostcps(host); /* do this under host lock */ #endif host->FirstClient = 0; + h_Hold_r(host); + h_Lock_r(host); h_InsertList_r(host); /* update global host List */ #if FS_STATS_DETAILED /* @@ -1008,9 +1010,7 @@ retry: goto retry; } } else { - host = h_Alloc_r(tcon); - h_Hold_r(host); - h_Lock_r(host); + host = h_Alloc_r(tcon); /* returned held and locked */ h_gethostcps_r(host,FT_ApproxTime()); if (!(host->Console&1)) { if (!identP || !interfValid) { -- 2.39.5