diff --git a/pkg/controller/control.go b/pkg/controller/control.go index 1e76b279e..0e0a6d1ef 100644 --- a/pkg/controller/control.go +++ b/pkg/controller/control.go @@ -1382,7 +1382,8 @@ func tryFreeze(devicePath string, freezePoint string, mounter mount.Interface, e mounted = true // We must verify it is still safe to freeze the filesystem. If the source mount was unmounted by someone else - // before we bind mounted, the bind mount could refer to the root filesystem. + // before we bind mounted, the bind mount could refer to the root filesystem. It does not matter if the source + // mount is unmounted AFTER our bind mount, as the bind mount is not affected. var device string device, _, err = mount.GetDeviceNameFromMount(mounter, freezePoint) if err != nil || device != devicePath { diff --git a/pkg/frontend/tgt/frontend.go b/pkg/frontend/tgt/frontend.go index da2882bb1..9a3ce5db7 100644 --- a/pkg/frontend/tgt/frontend.go +++ b/pkg/frontend/tgt/frontend.go @@ -78,7 +78,7 @@ func (t *Tgt) Shutdown() error { // If the engine is shutting down during a snapshot (in the preparation phase, before the snapshot operation obtains // a lock) we may have left a frozen filesystem. This is a good opportunity to unfreeze it. if err := util.UnfreezeFilesystemForDevice(t.Endpoint()); err != nil { - logrus.WithError(err).Errorf("Failed to clean up frozen file system during shutdown") + logrus.WithError(err).Errorf("Failed to clean up frozen file system; will continue tgt shutdown") } if t.dev != nil { diff --git a/pkg/util/fsfreeze.go b/pkg/util/fsfreeze.go index 479d7b7fa..64028365a 100644 --- a/pkg/util/fsfreeze.go +++ b/pkg/util/fsfreeze.go @@ -31,17 +31,26 @@ const ( // GetFreezePointFromDevicePath returns the absolute path to the canonical location we will try to mount a filesystem to // before freezeing it. func GetFreezePointFromDevicePath(devicePath string) string { + if devicePath == "" { + return "" + } return GetFreezePointFromVolumeName(filepath.Base(devicePath)) } // GetFreezePointFromVolumeName returns the absolute path to the canonical location we will try to mount a filesystem to // before freezeing it. func GetFreezePointFromVolumeName(volumeName string) string { + if volumeName == "" { + return "" + } return filepath.Join(freezePointDirectory, volumeName) } // GetDevicePathFromVolumeName mirrors longhorndev.getDev. It returns the device path that go-iscsi-helper will use. func GetDevicePathFromVolumeName(volumeName string) string { + if volumeName == "" { + return "" + } return filepath.Join(longhorndev.DevPath, volumeName) }