Stop a bcache device
    If no device is given, all backing devices will be detached from the cache, which will subsequently be stopped.

    .. warning::
        'Stop' on an individual backing device means hard-stop;
        no attempt at flushing will be done and the bcache device will seemingly 'disappear' from the device lists

    CLI example:

    .. code-block:: bash

        salt '*' bcache.stop

def stop(dev=None):
    '''
    Stop a bcache device
    If no device is given, all backing devices will be detached from the cache, which will subsequently be stopped.

    .. warning::
        'Stop' on an individual backing device means hard-stop;
        no attempt at flushing will be done and the bcache device will seemingly 'disappear' from the device lists

    CLI example:

    .. code-block:: bash

        salt '*' bcache.stop

    '''
    if dev is not None:
        log.warning('Stopping %s, device will only reappear after reregistering!', dev)
        if not _bcsys(dev, 'stop', 'goaway', 'error', 'Error stopping {0}'.format(dev)):
            return False
        return _wait(lambda: _sysfs_attr(_bcpath(dev)) is False, 'error', 'Device {0} did not stop'.format(dev), 300)
    else:
        cache = uuid()
        if not cache:
            log.warning('bcache already stopped?')
            return None

        if not _alltrue(detach()):
            return False
        elif not _fssys('stop', 'goaway', 'error', 'Error stopping cache'):
            return False

        return _wait(lambda: uuid() is False, 'error', 'Cache did not stop', 300)