From cc8f0afbad688fde60468e5811ac18b75f24886a Mon Sep 17 00:00:00 2001 From: Nickolai Zeldovich Date: Wed, 30 Jan 2002 16:16:23 +0000 Subject: [PATCH] Avoid deadlocking with afs_ResetVolumeInfo in InstallVolumeInfo and InstallNVolumeInfo, like we already do in InstallUVolumeInfo. --- src/afs/afs_volume.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/afs/afs_volume.c b/src/afs/afs_volume.c index 914c27d7e..1a94a1e66 100644 --- a/src/afs/afs_volume.c +++ b/src/afs/afs_volume.c @@ -771,6 +771,15 @@ void InstallVolumeEntry(struct volume *av, struct vldbentry *ve, int acell) cellp = afs_GetCell(acell, 0); + /* This volume, av, is locked. Zero out the serverHosts[] array + * so that if afs_GetServer() decides to replace the server + * struct, we don't deadlock trying to afs_ResetVolumeInfo() + * this volume. + */ + for (j=0; jserverHost[j] = 0; + } + /* Step through the VLDB entry making sure each server listed is there */ for (i=0,j=0; inServers; i++) { if ( ((ve->serverFlags[i] & mask) == 0) || (ve->serverFlags[i] & VLSF_DONTUSE) ) { @@ -838,6 +847,15 @@ void InstallNVolumeEntry(struct volume *av, struct nvldbentry *ve, int acell) cellp = afs_GetCell(acell, 0); + /* This volume, av, is locked. Zero out the serverHosts[] array + * so that if afs_GetServer() decides to replace the server + * struct, we don't deadlock trying to afs_ResetVolumeInfo() + * this volume. + */ + for (j=0; jserverHost[j] = 0; + } + /* Step through the VLDB entry making sure each server listed is there */ for (i=0,j=0; inServers; i++) { if ( ((ve->serverFlags[i] & mask) == 0) || (ve->serverFlags[i] & VLSF_DONTUSE) ) { -- 2.39.5