mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 23:10:58 +00:00
windows-afsd-volume-ref-leak-20070202
When looking up a volume by ID or Name, if the volume server data requires refreshing and the UpdateVolume operation failed, do not leak the refCount.
This commit is contained in:
parent
38d6f48507
commit
ab294cfdc5
@ -373,7 +373,7 @@ long cm_GetVolumeByID(cm_cell_t *cellp, long volumeID, cm_user_t *userp,
|
||||
{
|
||||
cm_volume_t *volp;
|
||||
char volNameString[100];
|
||||
long code;
|
||||
long code = 0;
|
||||
|
||||
lock_ObtainWrite(&cm_volumeLock);
|
||||
for(volp = cm_data.allVolumesp; volp; volp=volp->nextp) {
|
||||
@ -393,17 +393,18 @@ long cm_GetVolumeByID(cm_cell_t *cellp, long volumeID, cm_user_t *userp,
|
||||
if (volp) {
|
||||
lock_ObtainMutex(&volp->mx);
|
||||
|
||||
code = 0;
|
||||
if (volp->flags & CM_VOLUMEFLAG_RESET) {
|
||||
code = cm_UpdateVolume(cellp, userp, reqp, volp);
|
||||
if (code == 0) {
|
||||
if (code == 0)
|
||||
volp->flags &= ~CM_VOLUMEFLAG_RESET;
|
||||
}
|
||||
}
|
||||
else
|
||||
code = 0;
|
||||
lock_ReleaseMutex(&volp->mx);
|
||||
if (code == 0)
|
||||
if (code == 0)
|
||||
*outVolpp = volp;
|
||||
else
|
||||
cm_PutVolume(volp);
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
@ -419,11 +420,8 @@ long cm_GetVolumeByName(struct cm_cell *cellp, char *volumeNamep,
|
||||
long flags, cm_volume_t **outVolpp)
|
||||
{
|
||||
cm_volume_t *volp;
|
||||
long code;
|
||||
long code = 0;
|
||||
|
||||
/* initialize this */
|
||||
code = 0;
|
||||
|
||||
lock_ObtainWrite(&cm_volumeLock);
|
||||
for (volp = cm_data.allVolumesp; volp; volp=volp->nextp) {
|
||||
if (cellp == volp->cellp && strcmp(volumeNamep, volp->namep) == 0) {
|
||||
@ -480,6 +478,9 @@ long cm_GetVolumeByName(struct cm_cell *cellp, char *volumeNamep,
|
||||
|
||||
if (code == 0)
|
||||
*outVolpp = volp;
|
||||
else
|
||||
cm_PutVolume(volp);
|
||||
|
||||
lock_ReleaseMutex(&volp->mx);
|
||||
return code;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user