h_TossStuff_r: make sure host does not go away
authorAndrew Deason <adeason@sinenomine.net>
Tue, 16 Feb 2010 17:08:38 +0000 (11:08 -0600)
committerDerrick Brashear <shadow@dementia.org>
Mon, 22 Feb 2010 20:00:55 +0000 (12:00 -0800)
commit380bd77c328d8d83a007cd97f6564fcb5b990a73
tree82dee7c8ed775df0d88412bc5ba4d7037313530a
parent1e731a22ae954900af036d1ade014a07418ae4ea
h_TossStuff_r: make sure host does not go away

When h_TossStuff_r h_NBLock_r's a host, it is not only possible for
someone else to grab a hold on the host, but in theory it's also
possible for someone to hold a host, release it, and for the host to be
deleted again (assuming some callers hold HOSTDELETED hosts, which they
should not be doing).

To make this safety check a bit more robust, hold the host in
h_TossStuff_r before h_NBLock_r'ing, to ensure that it does not go away
while we're waiting for H_LOCK.

Change-Id: I018a611143d6dccba79cc627803cce74aa830c77
Reviewed-on: http://gerrit.openafs.org/1330
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
src/viced/host.c
src/viced/host.h