tsp = cm_FindServer(&saddr, CM_SERVER_VLDB);
if ( tsp ) /* an existing server - ref count increased */
{
- tsp->ipRank = (USHORT)dwRank; /* no need to protect by mutex*/
+ lock_ObtainMutex(&tsp->mx);
+ tsp->ipRank = (USHORT)dwRank;
+ tsp->flags |= CM_SERVERFLAG_PREF_SET;
+ lock_ReleaseMutex(&tsp->mx);
/* set preferences for an existing vlserver */
cm_ChangeRankCellVLServer(tsp);
else /* add a new server without a cell */
{
tsp = cm_NewServer(&saddr, CM_SERVER_VLDB, NULL, NULL, CM_FLAG_NOPROBE); /* refcount = 1 */
+ lock_ObtainMutex(&tsp->mx);
tsp->ipRank = (USHORT)dwRank;
+ tsp->flags |= CM_SERVERFLAG_PREF_SET;
+ lock_ReleaseMutex(&tsp->mx);
}
}
tsp = cm_FindServer(&saddr, CM_SERVER_FILE);
if ( tsp ) /* an existing server - ref count increased */
{
- tsp->ipRank = (USHORT)dwRank; /* no need to protect by mutex*/
+ lock_ObtainMutex(&tsp->mx);
+ tsp->ipRank = (USHORT)dwRank;
+ tsp->flags |= CM_SERVERFLAG_PREF_SET;
+ lock_ReleaseMutex(&tsp->mx);
/* find volumes which might have RO copy
/* on server and change the ordering of
else /* add a new server without a cell */
{
tsp = cm_NewServer(&saddr, CM_SERVER_FILE, NULL, NULL, CM_FLAG_NOPROBE); /* refcount = 1 */
+ lock_ObtainMutex(&tsp->mx);
tsp->ipRank = (USHORT)dwRank;
+ tsp->flags |= CM_SERVERFLAG_PREF_SET;
+ lock_ReleaseMutex(&tsp->mx);
}
}
tsp = cm_FindServer(&tmp, type);
if ( tsp ) /* an existing server - ref count increased */
{
- tsp->ipRank = rank; /* no need to protect by mutex*/
-
- if (type == CM_SERVER_FILE)
- { /* fileserver */
- /* find volumes which might have RO copy
- /* on server and change the ordering of
+ lock_ObtainMutex(&tsp->mx);
+ tsp->ipRank = rank;
+ tsp->flags |= CM_SERVERFLAG_PREF_SET;
+ lock_ReleaseMutex(&tsp->mx);
+
+ switch (type) {
+ case CM_SERVER_FILE:
+ /*
+ * find volumes which might have RO copy
+ * on server and change the ordering of
* their RO list
*/
cm_ChangeRankVolume(tsp);
- }
- else
- {
+ break;
+ case CM_SERVER_VLDB:
/* set preferences for an existing vlserver */
cm_ChangeRankCellVLServer(tsp);
+ break;
}
}
else /* add a new server without a cell */
{
tsp = cm_NewServer(&tmp, type, NULL, NULL, CM_FLAG_NOPROBE); /* refcount = 1 */
+ lock_ObtainMutex(&tsp->mx);
+ tsp->ipRank = rank;
+ tsp->flags |= CM_SERVERFLAG_PREF_SET;
+ lock_ReleaseMutex(&tsp->mx);
tsp->ipRank = rank;
}
- lock_ObtainMutex(&tsp->mx);
- tsp->flags |= CM_SERVERFLAG_PREF_SET;
- lock_ReleaseMutex(&tsp->mx);
cm_PutServer(tsp); /* decrease refcount */
}
return 0;