From 772459f93ca5d77160c4b827a781a53ef91cc31c Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 8 Dec 2025 16:43:35 -0800 Subject: fix: restore volume mount when VolumeConfigure fails (#7669) * fix: restore volume mount when VolumeConfigure fails When volume.configure.replication command fails (e.g., due to corrupted .vif file), the volume was left unmounted and the master was already notified that the volume was deleted, causing the volume to disappear. This fix attempts to re-mount the volume when ConfigureVolume fails, restoring the volume state and preventing data loss. Fixes #7666 * include mount restore error in response message --- weed/server/volume_grpc_admin.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/weed/server/volume_grpc_admin.go b/weed/server/volume_grpc_admin.go index 52e085684..4125f503a 100644 --- a/weed/server/volume_grpc_admin.go +++ b/weed/server/volume_grpc_admin.go @@ -134,6 +134,11 @@ func (vs *VolumeServer) VolumeConfigure(ctx context.Context, req *volume_server_ if err := vs.store.ConfigureVolume(needle.VolumeId(req.VolumeId), req.Replication); err != nil { glog.Errorf("volume configure %v: %v", req, err) resp.Error = fmt.Sprintf("volume configure %v: %v", req, err) + // Try to re-mount to restore the volume state + if mountErr := vs.store.MountVolume(needle.VolumeId(req.VolumeId)); mountErr != nil { + glog.Errorf("volume configure failed to restore mount %v: %v", req, mountErr) + resp.Error += fmt.Sprintf(". Also failed to restore mount: %v", mountErr) + } return resp, nil } -- cgit v1.2.3