mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 22:30:23 +00:00
cephfs: fix unmountVolume function
This commit fixes bug in unmount function which caused unmountVolume to fail when targetPath was already unmounted. Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
parent
82bc993b32
commit
721640178b
@ -257,8 +257,9 @@ func bindMount(ctx context.Context, from, to string, readOnly bool, mntOptions [
|
|||||||
}
|
}
|
||||||
|
|
||||||
func unmountVolume(ctx context.Context, mountPoint string) error {
|
func unmountVolume(ctx context.Context, mountPoint string) error {
|
||||||
if err := execCommandErr(ctx, "umount", mountPoint); err != nil {
|
if _, stderr, err := util.ExecCommand(ctx, "umount", mountPoint); err != nil {
|
||||||
if strings.Contains(err.Error(), fmt.Sprintf("exit status 32: umount: %s: not mounted", mountPoint)) ||
|
err = fmt.Errorf("%w stderr: %s", err, stderr)
|
||||||
|
if strings.Contains(err.Error(), fmt.Sprintf("umount: %s: not mounted", mountPoint)) ||
|
||||||
strings.Contains(err.Error(), "No such file or directory") {
|
strings.Contains(err.Error(), "No such file or directory") {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user