From 6995a56884f31974e9b5a7c0c50e9c1aa0351a45 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Tue, 7 Jan 2014 10:57:01 -0500 Subject: [PATCH] Windows: cm_ConnByServer fix search for replication 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 Reviewed-by: Jeffrey Altman --- src/WINNT/afsd/cm_conn.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/WINNT/afsd/cm_conn.c b/src/WINNT/afsd/cm_conn.c index 4f0ce229b6..8975023c74 100644 --- a/src/WINNT/afsd/cm_conn.c +++ b/src/WINNT/afsd/cm_conn.c @@ -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);