code: func RemoveDeviceDeferred(name string) error {
  	logrus.Debugf("devicemapper: RemoveDeviceDeferred START(%s)", name)
  	defer logrus.Debugf("devicemapper: RemoveDeviceDeferred END(%s)", name)
  	task, err := TaskCreateNamed(deviceRemove, name)
  	if task == nil {
  		return err
  	}
  
  	if err := DmTaskDeferredRemove(task.unmanaged); err != 1 {
  		return ErrTaskDeferredRemove
  	}
  
  	// set a task cookie and disable library fallback, or else libdevmapper will
  	// disable udev dm rules and delete the symlink under /dev/mapper by itself,
  	// even if the removal is deferred by the kernel.
  	cookie := new(uint)
  	flags := uint16(DmUdevDisableLibraryFallback)
  	if err := task.setCookie(cookie, flags); err != nil {
  		return fmt.Errorf("devicemapper: Can not set cookie: %s", err)
  	}
  
  	// libdevmapper and udev relies on System V semaphore for synchronization,
  	// semaphores created in `task.setCookie` will be cleaned up in `UdevWait`.
  	// So these two function call must come in pairs, otherwise semaphores will
  	// be leaked, and the  limit of number of semaphores defined in `/proc/sys/kernel/sem`
  	// will be reached, which will eventually make all following calls to 'task.SetCookie'
  	// fail.
  	// this call will not wait for the deferred removal's final executing, since no
  	// udev event will be generated, and the semaphore's value will not be incremented
  	// by udev, what UdevWait is just cleaning up the semaphore.
  	defer UdevWait(cookie)
  
  	dmSawEnxio = false
  	if err = task.run(); err != nil {
  		if dmSawEnxio {
  			return ErrEnxio
  		}
  		return fmt.Errorf("devicemapper: Error running RemoveDeviceDeferred %s", err)
  	}
  
  	return nil
  }
docs: // RemoveDeviceDeferred is a useful helper for cleaning up a device, but deferred.