X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/adda93976055fde37e92fa3fde7c08f529687132..70e5c7a3c6a5860d702d5e5c219dc0f3a3696d35:/services/keepstore/trash_worker.go diff --git a/services/keepstore/trash_worker.go b/services/keepstore/trash_worker.go index 696c3e53a6..cbb831ebc0 100644 --- a/services/keepstore/trash_worker.go +++ b/services/keepstore/trash_worker.go @@ -1,3 +1,7 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + package main import ( @@ -5,7 +9,6 @@ import ( "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 +38,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)