X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/6d95130da47af9fd0290d3c8f80a0364faf74957..e6ccda1f6925da119589e93b54d22508cf979069:/services/keepstore/trash_worker.go diff --git a/services/keepstore/trash_worker.go b/services/keepstore/trash_worker.go index 4063765726..5e8a5a963c 100644 --- a/services/keepstore/trash_worker.go +++ b/services/keepstore/trash_worker.go @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: AGPL-3.0 -package main +package keepstore import ( "errors" @@ -12,12 +12,7 @@ import ( "github.com/sirupsen/logrus" ) -// RunTrashWorker is used by Keepstore to initiate trash worker channel goroutine. -// The channel will process trash list. -// For each (next) trash request: -// Delete the block indicated by the trash request Locator -// Repeat -// +// RunTrashWorker processes the trash request queue. func RunTrashWorker(volmgr *RRVolumeManager, logger logrus.FieldLogger, cluster *arvados.Cluster, trashq *WorkQueue) { for item := range trashq.NextItem { trashRequest := item.(TrashRequest) @@ -41,10 +36,12 @@ func TrashItem(volmgr *RRVolumeManager, logger logrus.FieldLogger, cluster *arva var volumes []*VolumeMount if uuid := trashRequest.MountUUID; uuid == "" { - volumes = volmgr.AllWritable() - } else if mnt := volmgr.Lookup(uuid, true); mnt == nil { + volumes = volmgr.Mounts() + } else if mnt := volmgr.Lookup(uuid, false); mnt == nil { logger.Warnf("trash request for nonexistent mount: %v", trashRequest) return + } else if !mnt.KeepMount.AllowTrash { + logger.Warnf("trash request for mount with ReadOnly=true, AllowTrashWhenReadOnly=false: %v", trashRequest) } else { volumes = []*VolumeMount{mnt} }