@@ -36,10 +36,10 @@ int TagInfo::addTagHandle(const LVKey* pLVKey, const BBJob pJob, const uint64_t
3636
3737 TagInfo* l_TagInfo = 0 ;
3838 HandleInfo* l_HandleInfo = 0 ;
39+ int l_TransferQueueWasUnlocked = 0 ;
40+ int l_LocalMetadataLocked = 0 ;
3941 int l_TagInfoLocked = 0 ;
4042
41- int l_LocalMetadataUnlocked = unlockLocalMetadataIfNeeded (pLVKey, " addTagHandle" );
42-
4343 try
4444 {
4545 bfs::path l_JobStepPath (g_BBServer_Metadata_Path);
@@ -52,7 +52,12 @@ int TagInfo::addTagHandle(const LVKey* pLVKey, const BBJob pJob, const uint64_t
5252 LOG_ERROR_TEXT_RC_AND_BAIL (errorText, rc);
5353 }
5454
55+ l_TransferQueueWasUnlocked = unlockTransferQueueIfNeeded (pLVKey, " addTagHandle" );
56+ // This lock serializes amongst request/transfer threads on this bbServer...
57+ l_LocalMetadataLocked = lockLocalMetadataIfNeeded (pLVKey, " addTagHandle" );
58+ // This lock serializes amongst bbServers...
5559 rc = TagInfo::lock (l_JobStepPath);
60+
5661 if (!rc)
5762 {
5863 l_TagInfoLocked = 1 ;
@@ -150,6 +155,16 @@ int TagInfo::addTagHandle(const LVKey* pLVKey, const BBJob pJob, const uint64_t
150155 TagInfo::unlock ();
151156 }
152157
158+ if (l_LocalMetadataLocked)
159+ {
160+ unlockLocalMetadata (pLVKey, " addTagHandle" );
161+ }
162+
163+ if (l_TransferQueueWasUnlocked)
164+ {
165+ lockTransferQueue (pLVKey, " addTagHandle" );
166+ }
167+
153168 if (l_HandleInfo)
154169 {
155170 delete l_HandleInfo;
@@ -162,11 +177,6 @@ int TagInfo::addTagHandle(const LVKey* pLVKey, const BBJob pJob, const uint64_t
162177 l_TagInfo = 0 ;
163178 }
164179
165- if (l_LocalMetadataUnlocked)
166- {
167- lockLocalMetadata (pLVKey, " addTagHandle" );
168- }
169-
170180 return rc;
171181}
172182
0 commit comments