Skip to content

Commit eb30487

Browse files
authored
fix: skip filesystem resize for raw block volumes in NodeExpandVolume (#295)
For raw block volumes, the block device is already resized at the storage layer
1 parent 1a6bab6 commit eb30487

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/spdk/nodeserver.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,16 @@ func (ns *nodeServer) NodeExpandVolume(_ context.Context, req *csi.NodeExpandVol
465465
return nil, status.Errorf(codes.Internal, "could not find device path for volume %s", volumeID)
466466
}
467467

468+
// For raw block volumes, the block device has already been resized at the
469+
// storage layer. Skipping filesystem resize is correct here because:
470+
// - resize2fs (ext4) can operate on an unmounted raw device, so it worked accidentally
471+
// - xfs_growfs requires a mounted filesystem path and cannot operate on raw block devices
472+
// Neither tool should be invoked for block volumes.
473+
if cap := req.GetVolumeCapability(); cap != nil && cap.GetBlock() != nil {
474+
klog.Infof("NodeExpandVolume: volume %s is a block device, skipping filesystem resize", volumeID)
475+
return &csi.NodeExpandVolumeResponse{}, nil
476+
}
477+
468478
resizer := mount.NewResizeFs(exec.New())
469479
needsResize, err := resizer.NeedResize(devicePath, volumeMountPath)
470480
if err != nil {

0 commit comments

Comments
 (0)