Windows: cm_ConnByServer fix search for replication
authorJeffrey Altman <jaltman@your-file-system.com>
Tue, 7 Jan 2014 15:57:01 +0000 (10:57 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Thu, 9 Jan 2014 19:21:02 +0000 (11:21 -0800)
Separate connection objects are maintained for use when accessing
replicated and single source volumes.   If the matching connection
type cannot be found while holding the cm_connLock shared a second
search is performed after the lock is upgraded to an exclusive lock.
This second connection search was not enforcing the replication criteria.

Change-Id: I408a5d87c3a82da5235fa2255db7d1d7a6bcb6d9
Reviewed-on: http://gerrit.openafs.org/10681
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsd/cm_conn.c

index 4f0ce22..8975023 100644 (file)
@@ -1669,8 +1669,10 @@ long cm_ConnByServer(cm_server_t *serverp, cm_user_t *userp, afs_uint32 replicat
     if (!tcp) {
         lock_ConvertRToW(&cm_connLock);
         for (tcp = serverp->connsp; tcp; tcp=tcp->nextp) {
-            if (tcp->userp == userp)
-                break;
+           if (tcp->userp == userp &&
+                (replicated && (tcp->flags & CM_CONN_FLAG_REPLICATION) ||
+                 !replicated && !(tcp->flags & CM_CONN_FLAG_REPLICATION)))
+               break;
         }
         if (tcp) {
             InterlockedIncrement(&tcp->refCount);