Skip to content

Commit bc5b267

Browse files
committed
Update Pinned() method to read from state with proper locking
Signed-off-by: tobwen <[email protected]>
1 parent 9e37833 commit bc5b267

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

libpod/volume.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,14 @@ func (v *Volume) UsesVolumeDriver() bool {
289289
// Pinned returns whether this volume is marked as pinned.
290290
// Pinned volumes are excluded from system prune operations by default.
291291
func (v *Volume) Pinned() bool {
292-
return v.config.Pinned
292+
v.lock.Lock()
293+
defer v.lock.Unlock()
294+
295+
if err := v.update(); err != nil {
296+
return false
297+
}
298+
299+
return v.state.Pinned
293300
}
294301

295302
// SetPinned sets the pinned status of the volume.

0 commit comments

Comments
 (0)