Skip to content

Commit 0b362e3

Browse files
committed
Fix potential deadlock in CacheState::lock
1 parent 84709f0 commit 0b362e3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cargo/util/cache_lock.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,10 @@ impl CacheState {
408408
.lock_exclusive(gctx, DOWNLOAD_EXCLUSIVE_DESCR, blocking)
409409
{
410410
Ok(LockAcquired) => {}
411-
Ok(WouldBlock) => return Ok(WouldBlock),
411+
Ok(WouldBlock) => {
412+
self.mutate_lock.decrement();
413+
return Ok(WouldBlock);
414+
}
412415
Err(e) => {
413416
self.mutate_lock.decrement();
414417
return Err(e);

0 commit comments

Comments
 (0)