]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
hid2client-write-lock-20050403
authorTom Keiser <tkeiser@psu.edu>
Sun, 3 Apr 2005 21:09:53 +0000 (21:09 +0000)
committerDerrick Brashear <shadow@dementia.org>
Sun, 3 Apr 2005 21:09:53 +0000 (21:09 +0000)
FIXES 17867

h_ID2Client currently returns a client struct with a shared lock. The
only caller of h_ID2Client (SRXAFS_FlushCPS) immediately calls
BoostSharedLock. This patch just goes ahead and makes h_ID2Client return
it with the write lock so we don't enter the Lock struct mutex multiple
times in a row. This also happens to remove the last reference to
BoostSharedLock in the tree.

src/viced/afsfileprocs.c
src/viced/host.c

index e869dcbfe515012c37144568a4aaba5e90fc420a..fb3a071c7675a53ddbce25a14ddc17eaa3a4fc12 100644 (file)
@@ -6004,11 +6004,10 @@ SRXAFS_FlushCPS(struct rx_call * acall, struct ViceIds * vids,
     for (i = 0; i < nids; i++, vd++) {
        if (!*vd)
            continue;
-       client = h_ID2Client(*vd);      /* returns client locked, or NULL */
+       client = h_ID2Client(*vd);      /* returns client write locked, or NULL */
        if (!client)
            continue;
 
-       BoostSharedLock(&client->lock);
        client->prfail = 2;     /* Means re-eval client's cps */
 #ifdef notdef
        if (client->tcon) {
index 8193a6863ba3d9018fcfa8a9bc97a5eb8c6ba417..0c44c63946fc189fd9be6ed521886d8bb5a274c2 100644 (file)
@@ -1328,7 +1328,7 @@ MapName_r(char *aname, char *acell, afs_int32 * aval)
 /*MapName*/
 
 
-/* NOTE: this returns the client with a Shared lock */
+/* NOTE: this returns the client with a Write lock */
 struct client *
 h_ID2Client(afs_int32 vid)
 {
@@ -1343,7 +1343,7 @@ h_ID2Client(afs_int32 vid)
            if (!client->deleted && client->ViceId == vid) {
                client->refCount++;
                H_UNLOCK;
-               ObtainSharedLock(&client->lock);
+               ObtainWriteLock(&client->lock);
                H_LOCK;
                client->refCount--;
                H_UNLOCK;
@@ -1353,7 +1353,7 @@ h_ID2Client(afs_int32 vid)
     }
 
     H_UNLOCK;
-    return 0;
+    return NULL;
 }
 
 /*