feat: use force unmount to fix unmount failure issie
This commit is contained in:
parent
f19db6ef3e
commit
ba1f1acedc
@ -108,7 +108,7 @@ func (n *Driver) Run(testMode bool) {
|
|||||||
}
|
}
|
||||||
klog.V(2).Infof("\nDRIVER INFORMATION:\n-------------------\n%s\n\nStreaming logs below:", versionMeta)
|
klog.V(2).Infof("\nDRIVER INFORMATION:\n-------------------\n%s\n\nStreaming logs below:", versionMeta)
|
||||||
|
|
||||||
n.ns = NewNodeServer(n, mount.New(""))
|
n.ns = NewNodeServer(n, mount.New("").(mount.MounterForceUnmounter))
|
||||||
s := NewNonBlockingGRPCServer()
|
s := NewNonBlockingGRPCServer()
|
||||||
s.Start(n.endpoint,
|
s.Start(n.endpoint,
|
||||||
NewDefaultIdentityServer(n),
|
NewDefaultIdentityServer(n),
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
@ -154,7 +155,15 @@ func (ns *NodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu
|
|||||||
}
|
}
|
||||||
|
|
||||||
klog.V(2).Infof("NodeUnpublishVolume: unmounting volume %s on %s", volumeID, targetPath)
|
klog.V(2).Infof("NodeUnpublishVolume: unmounting volume %s on %s", volumeID, targetPath)
|
||||||
err := mount.CleanupMountPoint(targetPath, ns.mounter, true /*extensiveMountPointCheck*/)
|
var err error
|
||||||
|
extensiveMountPointCheck := true
|
||||||
|
forceUnmounter, ok := ns.mounter.(mount.MounterForceUnmounter)
|
||||||
|
if ok {
|
||||||
|
klog.V(2).Infof("force unmount %s on %s", volumeID, targetPath)
|
||||||
|
err = mount.CleanupMountWithForce(targetPath, forceUnmounter, extensiveMountPointCheck, 30*time.Second)
|
||||||
|
} else {
|
||||||
|
err = mount.CleanupMountPoint(targetPath, ns.mounter, extensiveMountPointCheck)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, status.Errorf(codes.Internal, "failed to unmount target %q: %v", targetPath, err)
|
return nil, status.Errorf(codes.Internal, "failed to unmount target %q: %v", targetPath, err)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user