17698: Add comment to clarify locking.
authorTom Clegg <tom@curii.com>
Mon, 23 Aug 2021 14:01:40 +0000 (10:01 -0400)
committerTom Clegg <tom@curii.com>
Mon, 23 Aug 2021 14:01:40 +0000 (10:01 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

services/keepstore/handlers.go

index 4698d1fafa07ba9dfaff033aa447563449edd369..910033ebb1d8408c90a4bde441d7edc8d99b109a 100644 (file)
@@ -912,7 +912,11 @@ func PutBlock(ctx context.Context, volmgr *RRVolumeManager, block []byte, hash s
        pending := result.Copy()
        var allFull atomic.Value
        allFull.Store(true)
+
+       // We hold the lock for the duration of the "each volume" loop
+       // below, except when it is released during cond.Wait().
        mtx.Lock()
+
        for _, mnt := range writables {
                // Wait until our decision to use this mount does not
                // depend on the outcome of pending writes.