//export unmount
175785
func unmount(clientID C.h, service, volumeID *C.char) C.result {
	return C.result{}
}
50119
func (v *BtrfsVolume) Export(label, parent string, writer io.Writer, excludes []string) error {
	if len(excludes) > 0 {
		glog.Warning("btrfs backups do not support excluding directories")
	}
	if label = strings.TrimSpace(label); label == "" {
		glog.Errorf("%s: label cannot be empty", volume.DriverTypeBtrFS)
		return ErrBtrfsInvalidLabel
	} else if exists, err := v.snapshotExists(label); err != nil {
		return err
	} else if !exists {
		return volume.ErrSnapshotDoesNotExist
	}
	// TODO: add to tarfile and include metadata
	if err := runBtrfsSend(writer, v.sudoer, parent, v.snapshotPath(label)); err != nil {
		glog.Errorf("Could not export snapshot %s: %s", label, err)
		return err
	}
	return nil
}
424988
func (e *ganeshaExporter) Export(path string) error {
	// Call AddExport using dbus
	conn, err := dbus.SystemBus()
	if err != nil {
		return fmt.Errorf("error getting dbus session bus: %v", err)
	}
	obj := conn.Object("org.ganesha.nfsd", "/org/ganesha/nfsd/ExportMgr")
	call := obj.Call("org.ganesha.nfsd.exportmgr.AddExport", 0, e.config, fmt.Sprintf("export(path = %s)", path))
	if call.Err != nil {
		return fmt.Errorf("error calling org.ganesha.nfsd.exportmgr.AddExport: %v", call.Err)
	}

	return nil
}
942197
func (c *Core) unloadMounts(ctx context.Context) error {
	c.mountsLock.Lock()
	defer c.mountsLock.Unlock()

	if c.mounts != nil {
		mountTable := c.mounts.shallowClone()
		for _, e := range mountTable.Entries {
			backend := c.router.MatchingBackend(namespace.ContextWithNamespace(ctx, e.namespace), e.Path)
			if backend != nil {
				backend.Cleanup(ctx)
			}

			viewPath := e.ViewPath()
			removePathCheckers(c, e, viewPath)
		}
	}

	c.mounts = nil
	c.router = NewRouter()
	c.systemBarrierView = nil
	return nil
}
1175064
func (m *Mounter) Unmount(
	devPath string,
	path string,
	flags int,
	timeout int,
	opts map[string]string,
) error {
	m.Lock()
	// device gets overwritten if opts specifies fuse mount with
	// options.OptionsDeviceFuseMount.
	device := devPath
	path = normalizeMountPath(path)
	if value, ok := opts[options.OptionsDeviceFuseMount]; ok {
		// fuse mounts show-up with this key as device.
		device = value
	}
	info, ok := m.mounts[device]
	if !ok {
		m.Unlock()
		logrus.Warnf("Unable to unmount device %q path %q: %v",
			devPath, path, ErrEnoent.Error())
		return ErrEnoent
	}
	m.Unlock()
	info.Lock()
	defer info.Unlock()
	for i, p := range info.Mountpoint {
		if p.Path != path {
			continue
		}
		err := m.mountImpl.Unmount(path, flags, timeout)
		if err != nil {
			return err
		}
		// Blow away this mountpoint.
		info.Mountpoint[i] = info.Mountpoint[len(info.Mountpoint)-1]
		info.Mountpoint = info.Mountpoint[0 : len(info.Mountpoint)-1]
		m.maybeRemoveDevice(device)
		if options.IsBoolOptionSet(opts, options.OptionsDeleteAfterUnmount) {
			m.RemoveMountPath(path, opts)
		}

		return nil
	}
	logrus.Warnf("Device %q is not mounted at path %q", device, path)
	return nil
}
556308
func (container *Container) UnmountSecrets() error {
	p, err := container.SecretMountPath()
	if err != nil {
		return err
	}
	return os.RemoveAll(p)
}
158395
func (m *mount) unmount() error {
	log.Infof("Unmounting %s", m.MountPoint())

	// try unmounting with fuse lib
	err := fuse.Unmount(m.MountPoint())
	if err == nil {
		m.setActive(false)
		return nil
	}
	log.Warningf("fuse unmount err: %s", err)

	// try closing the fuseConn
	err = m.fuseConn.Close()
	if err == nil {
		m.setActive(false)
		return nil
	}
	log.Warningf("fuse conn error: %s", err)

	// try mount.ForceUnmountManyTimes
	if err := ForceUnmountManyTimes(m, 10); err != nil {
		return err
	}

	log.Infof("Seemingly unmounted %s", m.MountPoint())
	m.setActive(false)
	return nil
}
378382
func (r *Store) RemoveMount(ctx context.Context, alias string) error {
	if _, found := r.mounts[alias]; !found {
		return errors.Errorf("%s is not mounted", alias)
	}
	if _, found := r.mounts[alias]; !found {
		out.Yellow(ctx, "%s is not initialized", alias)
	}
	delete(r.mounts, alias)
	delete(r.cfg.Mounts, alias)
	return nil
}
959276
func RecursiveUnmount(target string) error {
	mounts, err := parseMountTable(PrefixFilter(target))
	if err != nil {
		return err
	}

	// Make the deepest mount be first
	sort.Slice(mounts, func(i, j int) bool {
		return len(mounts[i].Mountpoint) > len(mounts[j].Mountpoint)
	})

	for i, m := range mounts {
		logrus.Debugf("Trying to unmount %s", m.Mountpoint)
		err = unmount(m.Mountpoint, mntDetach)
		if err != nil {
			if i == len(mounts)-1 { // last mount
				if mounted, e := Mounted(m.Mountpoint); e != nil || mounted {
					return err
				}
			} else {
				// This is some submount, we can ignore this error for now, the final unmount will fail if this is a real problem
				logrus.WithError(err).Warnf("Failed to unmount submount %s", m.Mountpoint)
			}
		}

		logrus.Debugf("Unmounted %s", m.Mountpoint)
	}
	return nil
}
867632
func (mount *MountInfo) Unmount() error {
	ret := C.ceph_unmount(mount.mount)
	if ret != 0 {
		log.Errorf("Unmount: Failed to unmount")
		return cephError(ret)
	}
	return nil
}
354965
func Unexport(
	ctx context.Context,
	client api.Client,
	id int) error {

	return ExportDelete(ctx, client, id)
}
821230
func (e *kernelExporter) Export(_ string) error {
	// Execute exportfs
	cmd := exec.Command("exportfs", "-r")
	out, err := cmd.CombinedOutput()
	if err != nil {
		return fmt.Errorf("exportfs -r failed with error: %v, output: %s", err, out)
	}

	return nil
}
381058
func (util *portworxVolumeUtil) UnmountVolume(u *portworxVolumeUnmounter, mountPath string) error {
	driver, err := util.getLocalPortworxDriver(u.plugin.host)
	if err != nil || driver == nil {
		klog.Errorf("Failed to get portworx driver. Err: %v", err)
		return err
	}

	err = driver.Unmount(u.volName, mountPath)
	if err != nil {
		klog.Errorf("Error unmounting Portworx Volume (%v) on Path (%v): %v", u.volName, mountPath, err)
		return err
	}
	return nil
}
606448
func (n *Name) Export() (b *Buffer, err error) {
	b, err = n.MakeBuffer(allocGSSAPI)
	if err != nil {
		return nil, err
	}

	var min C.OM_uint32
	maj := C.wrap_gss_export_name(n.Fp_gss_export_name, &min,
		n.C_gss_name_t, b.C_gss_buffer_t)
	err = n.stashLastStatus(maj, min)
	if err != nil {
		b.Release()
		return nil, err
	}

	return b, nil
}
830672
func (m *deletedMounter) Unmount(
	sourcePath string,
	path string,
	flags int,
	timeout int,
	opts map[string]string,
) error {
	if sourcePath != AllDevices {
		return fmt.Errorf("DeletedMounter accepts only %v as sourcePath",
			AllDevices)
	}

	m.Lock()
	defer m.Unlock()

	failedUnmounts := make(DeviceMap)
	for k, v := range m.mounts {
		for _, p := range v.Mountpoint {
			logrus.Warnf("Unmounting deleted mount path %v->%v", k, p)
			if err := m.mountImpl.Unmount(p.Path, flags, timeout); err != nil {
				logrus.Warnf("Failed to unmount mount path %v->%v", k, p)
				addMountpoint(failedUnmounts, k, p)
			}
		}
	}
	m.mounts = failedUnmounts
	if len(m.mounts) > 0 {
		return fmt.Errorf("Not all paths could be unmounted")
	}

	return nil
}
613012
func (m *MountPoint) Cleanup() error {
	if m.Volume == nil || m.ID == "" {
		return nil
	}

	if err := m.Volume.Unmount(m.ID); err != nil {
		return errors.Wrapf(err, "error unmounting volume %s", m.Volume.Name())
	}

	m.active--
	if m.active == 0 {
		m.ID = ""
	}
	return nil
}
546952
func UnmountAll(mount string, flags int) error {
	for {
		if err := unmount(mount, flags); err != nil {
			// EINVAL is returned if the target is not a
			// mount point, indicating that we are
			// done. It can also indicate a few other
			// things (such as invalid flags) which we
			// unfortunately end up squelching here too.
			if err == unix.EINVAL {
				return nil
			}
			return err
		}
	}
}