diff --git a/.changelog/25253.txt b/.changelog/25253.txt new file mode 100644 index 000000000..4ecd5fadb --- /dev/null +++ b/.changelog/25253.txt @@ -0,0 +1,3 @@ +```release-note:bug +csi: Fixed a CSI ExpandVolume bug where the namespace was left out of the staging path +``` diff --git a/client/pluginmanager/csimanager/volume.go b/client/pluginmanager/csimanager/volume.go index 18251afcb..f59f3c939 100644 --- a/client/pluginmanager/csimanager/volume.go +++ b/client/pluginmanager/csimanager/volume.go @@ -293,7 +293,7 @@ func (v *volumeManager) unstageVolume(ctx context.Context, volNS, volID, remoteI // plugin to perform unstaging stagingPath := v.stagingDirForVolume(v.containerMountPoint, volNS, volID, usage) - // This it the path from the host, which we need to use to verify whether + // This is the path from the host, which we need to use to verify whether // the path is the right one to pass to the plugin container hostStagingPath := v.stagingDirForVolume(v.mountRoot, volNS, volID, usage) _, err := os.Stat(hostStagingPath) @@ -416,8 +416,14 @@ func (v *volumeManager) ExpandVolume(ctx context.Context, volNS, volID, remoteID "volume_id", volID, "alloc_id", allocID, "error", err) } + // This is the staging path inside the container, which we pass to the + // plugin to perform expansion stagingPath := v.stagingDirForVolume(v.containerMountPoint, volNS, volID, usage) - _, err = os.Stat(stagingPath) + + // This is the path from the host, which we need to use to verify whether + // the path is the right one to pass to the plugin container + hostStagingPath := v.stagingDirForVolume(v.mountRoot, volNS, volID, usage) + _, err = os.Stat(hostStagingPath) if err != nil && errors.Is(err, fs.ErrNotExist) { // COMPAT: it's possible to get an unmount request that includes the // namespace even for volumes that were mounted before the path included