X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/5fd9b5a5fb88f40b999ab6c9fa9435ad01f595ff..0561bd0c3c07257fd58ded6c7cfa5feeae97af57:/services/keepstore/trash_worker.go diff --git a/services/keepstore/trash_worker.go b/services/keepstore/trash_worker.go index 27d6216d01..51fbb94791 100644 --- a/services/keepstore/trash_worker.go +++ b/services/keepstore/trash_worker.go @@ -1,11 +1,15 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + package main import ( "errors" - "log" "time" "git.curoverse.com/arvados.git/sdk/go/arvados" + log "github.com/Sirupsen/logrus" ) // RunTrashWorker is used by Keepstore to initiate trash worker channel goroutine. @@ -35,7 +39,17 @@ func TrashItem(trashRequest TrashRequest) { return } - for _, volume := range KeepVM.AllWritable() { + var volumes []Volume + if uuid := trashRequest.MountUUID; uuid == "" { + volumes = KeepVM.AllWritable() + } else if v := KeepVM.Lookup(uuid, true); v == nil { + log.Printf("warning: trash request for nonexistent mount: %v", trashRequest) + return + } else { + volumes = []Volume{v} + } + + for _, volume := range volumes { mtime, err := volume.Mtime(trashRequest.Locator) if err != nil { log.Printf("%v Delete(%v): %v", volume, trashRequest.Locator, err)