diff --git a/block.c b/block.c index 9b7c49c..77c907c 100644 --- a/block.c +++ b/block.c @@ -595,6 +595,15 @@ static void cache_load(int mtd) _cache_load("/dev/dm-*"); } +static int cache_load_dev_by_base_name(char *name) +{ + char fullpath[PATH_MAX]; + int res = snprintf(fullpath, sizeof(fullpath), "/dev/%s", name); + if (res < 0 || res >= PATH_MAX) + return -1; + _cache_load(fullpath); + return 0; +} static struct probe_info* find_block_info(char *uuid, char *label, char *path) { @@ -1253,7 +1262,8 @@ static int mount_action(char *action, char *device, int type) if (config_load(NULL)) return -1; - cache_load(1); + if (cache_load_dev_by_base_name(device)) + return -1; list_for_each_entry(pr, &devices, list) if (!strcmp(basename(pr->dev), device))