From 1d69a9c658655b77dd4e5275bff99caad6b38416 Mon Sep 17 00:00:00 2001 From: Maksim An Date: Tue, 1 Oct 2024 14:04:53 -0700 Subject: [PATCH] scsi: relax mount re-use constraint (#2280) This is to fix a case with shared scratch enabled where the pause container scratch and workload container scratch should be the same mountpoint. This effectively changes the SCSI mount logic to have the same semantics as before the SCSI refactor, which mainly affected: * where the `runc` config.json for a container is written * scratch encryption The old semantics ensured that the scratch (in a shared scratch case) is encrypted only once and also ensured that runc config.json for a given container is written to a unique location: either container's scratch (when scratch isn't shared) or tmpfs (when scratch is shared). As before, the eventual hope is to remove guestPath support, and always generate a path, but that requires more extensive work to pass this path to the GCS. Signed-off-by: Kevin Parsons Signed-off-by: Maksim An Co-authored-by: Kevin Parsons --- internal/uvm/scsi/manager_test.go | 6 +++--- internal/uvm/scsi/mount.go | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/uvm/scsi/manager_test.go b/internal/uvm/scsi/manager_test.go index 8c52d51b24..a854690af7 100644 --- a/internal/uvm/scsi/manager_test.go +++ b/internal/uvm/scsi/manager_test.go @@ -191,11 +191,11 @@ func TestGuestPath(t *testing.T) { if err != nil { t.Fatal(err) } - // m3 should get the guest path it asked for. - if m3.GuestPath() != "/mnt2" { + // m3 asked for a guest path, but it is already mounted, so it should get that one instead. + if m3.GuestPath() != "/mnt1" { t.Errorf("wrong guest path for m3: %s", m2.GuestPath()) } - if !reflect.DeepEqual(gb.mountPaths(), []string{"/mnt1", "/mnt2"}) { + if !reflect.DeepEqual(gb.mountPaths(), []string{"/mnt1"}) { t.Errorf("wrong mount paths after adding m3: %v", gb.mountPaths()) } diff --git a/internal/uvm/scsi/mount.go b/internal/uvm/scsi/mount.go index 1f2fb831cc..68e36f1c9c 100644 --- a/internal/uvm/scsi/mount.go +++ b/internal/uvm/scsi/mount.go @@ -123,7 +123,6 @@ func (mm *mountManager) trackMount(controller, lun uint, path string, c *mountCo } } else if controller == mount.controller && lun == mount.lun && - (path == "" || path == mount.path) && reflect.DeepEqual(c, mount.config) { mount.refCount++