]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
DEVEL15-windows-volume-deadlock-20080722
authorJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 23 Jul 2008 05:56:59 +0000 (05:56 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 23 Jul 2008 05:56:59 +0000 (05:56 +0000)
LICENSE MIT

When updating the volume location information, if a new server must
be allocated and the server is down, then it is possible for a deadlock
to occur on the cm_volume_t rw lock.  Prevent that from happening.

(cherry picked from commit 2ed0ee573c2b36cc6979693827e36f1ce6bdfa1b)

src/WINNT/afsd/cm_volume.c

index cb3feb56ac850a603b1b6b261743975d52773679..3e181e57d6933d73cb22f98853fd3e0381a69846 100644 (file)
@@ -481,10 +481,13 @@ long cm_UpdateVolumeLocation(struct cm_cell *cellp, cm_user_t *userp, cm_req_t *
             tempAddr = htonl(serverNumber[i]);
             tsockAddr.sin_addr.s_addr = tempAddr;
             tsp = cm_FindServer(&tsockAddr, CM_SERVER_FILE);
-            if (!tsp)
-                tsp = cm_NewServer(&tsockAddr, CM_SERVER_FILE,
-                                    cellp, 0);
-
+            if (!tsp) {
+                /* cm_NewServer will probe the server which in turn will
+                 * update the state on the volume group object */
+                lock_ReleaseWrite(&volp->rw);
+                tsp = cm_NewServer(&tsockAddr, CM_SERVER_FILE, cellp, 0);
+                lock_ObtainWrite(&volp->rw);
+            }
             /* if this server was created by fs setserverprefs */
             if ( !tsp->cellp ) 
                 tsp->cellp = cellp;