// Done signals Wait and runs the unmounter if set by MountAndSetUnmount.
// It can be called multiple times with no harm. Each call triggers a call to
// the unmounter.
342831
func (mi *MountInterrupter) Done() error {
	mi.Lock()
	defer mi.Unlock()
	if mi.fun != nil {
		err := mi.fun()
		if err != nil {
			mi.log.Errorf("Mount interrupter callback failed: %v", err)
			return err
		}
	}
	mi.once.Do(func() {
		close(mi.done)
	})
	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
}
1263240
func (c *Core) unmount(ctx context.Context, path string) error {
	// Ensure we end the path in a slash
	if !strings.HasSuffix(path, "/") {
		path += "/"
	}

	// Prevent protected paths from being unmounted
	for _, p := range protectedMounts {
		if strings.HasPrefix(path, p) {
			return fmt.Errorf("cannot unmount %q", path)
		}
	}
	return c.unmountInternal(ctx, path, MountTableUpdateStorage)
}
1045893
func Unmount(r mountRunner, target string) error {
	cmd := umountCmd(target, false)
	glog.Infof("Will run: %s", cmd)
	out, err := r.CombinedOutput(cmd)
	if err == nil {
		return nil
	}
	glog.Warningf("initial unmount error: %v, out: %s", err, out)

	// Try again, using force if needed.
	cmd = umountCmd(target, true)
	glog.Infof("Will run: %s", cmd)
	out, err = r.CombinedOutput(cmd)
	glog.Infof("unmount force err=%v, out=%s", err, out)
	if err != nil {
		return errors.Wrap(err, out)
	}
	return nil
}
1098901
func Done(ctx context.Context) bool {
	select {
	case <-ctx.Done():
		return true
	default:
		return false
	}
	return false
}
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
}
577245
func Unmount(target string) error {
	if err := exec.Command("auplink", target, "flush").Run(); err != nil {
		logrus.Warnf("Couldn't run auplink before unmount %s: %s", target, err)
	}
	if err := unix.Unmount(target, 0); err != nil {
		return err
	}
	return nil
}
325993
func (op *UpdateMachineOperation) Done(err error) error {
	return errors.Annotatef(err, "updating machine %q", op.m)
}
9626
func (i *PendingItem) done() error {
	tracer.CounterAdd(i.a, "itemsProcessing", -1)
	i.a = nil
	return nil
}
553391
func (d *Driver) Cleanup() error {
	err := d.DeviceSet.Shutdown(d.home)
	umountErr := mount.RecursiveUnmount(d.home)

	// in case we have two errors, prefer the one from Shutdown()
	if err != nil {
		return err
	}

	return umountErr
}
732890
func (mounter *Mounter) Unmount(target string) error {
	klog.V(4).Infof("Unmounting %s", target)
	command := exec.Command("umount", target)
	output, err := command.CombinedOutput()
	if err != nil {
		return fmt.Errorf("Unmount failed: %v\nUnmounting arguments: %s\nOutput: %s\n", err, target, string(output))
	}
	return nil
}
457855
func (op *DestroyRemoteApplicationOperation) Done(err error) error {
	if err != nil {
		if !op.Force {
			return errors.Annotatef(err, "cannot destroy remote application %q", op.app)
		}
		op.AddError(errors.Errorf("force destroy of remote application %v failed but proceeded despite encountering ERROR %v", op.app, err))
	}
	return nil
}
439978
func (b *rescanBatch) done(err error) {
	for _, c := range b.errChans {
		c <- err
	}
}
1062613
func (m *googlePubSubMessage) Done(ack bool) {
	if ack == true {
		m.OriginalMessage.Ack()
	} else {
		m.OriginalMessage.Nack()
	}
}
238833
func (m *MockVolumeDriver) Unmount(arg0, arg1 string, arg2 map[string]string) error {
	ret := m.ctrl.Call(m, "Unmount", arg0, arg1, arg2)
	ret0, _ := ret[0].(error)
	return ret0
}
1334985
func (c *cipdSubcommand) done(result interface{}, err error) int {
	err = c.writeJSONOutput(result, err)
	if err != nil {
		c.printError(err)
		return 1
	}
	return 0
}
1209857
func (ri *readerOffsetsIterator) Done() {
	if !ri.del {
		return
	}
	ri.del = false

	j, psub, pi := 0, 0, 0
	for i, v := range ri.r.offsets {
		for pi < len(ri.r.prefixes) && i >= ri.r.prefixes[pi].total {
			ri.r.prefixes[pi].total -= psub
			pi++
		}

		if v&(1<<31) > 0 {
			psub++
			continue
		}

		if i != j {
			ri.r.offsets[j] = ri.r.offsets[i]
		}
		j++
	}

	ri.r.offsets = ri.r.offsets[:j]
}