From c3e5b4976d0b0bd1ed24dbc48b46f915ea316152 Mon Sep 17 00:00:00 2001 From: Peter Rajnoha Date: Mon, 26 Sep 2011 10:17:51 +0000 Subject: [PATCH] Add log_error even for general device in use when we can't do the sysfs checks. --- lib/activate/activate.c | 11 +++++++++-- libdm/libdm-deptree.c | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/activate/activate.c b/lib/activate/activate.c index 21f597bcc..4ae419264 100644 --- a/lib/activate/activate.c +++ b/lib/activate/activate.c @@ -533,8 +533,15 @@ int lv_check_not_in_use(struct cmd_context *cmd __attribute__((unused)), return 1; /* If sysfs is not used, use open_count information only. */ - if (!*dm_sysfs_dir()) - return !info->open_count; + if (!*dm_sysfs_dir()) { + if (info->open_count) { + log_error("Logical volume %s/%s in use.", + lv->vg->name, lv->name); + return 0; + } + + return 1; + } if (dm_device_has_holders(info->major, info->minor)) { log_error("Logical volume %s/%s is used by another device.", diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index b1f27d863..c38f15c87 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -947,8 +947,15 @@ static int _check_device_not_in_use(struct dm_info *info) return 1; /* If sysfs is not used, use open_count information only. */ - if (!*dm_sysfs_dir()) - return !info->open_count; + if (!*dm_sysfs_dir()) { + if (info->open_count) { + log_error("Device %" PRIu32 ":%" PRIu32 " in use", + info->major, info->minor); + return 0; + } + + return 1; + } if (dm_device_has_holders(info->major, info->minor)) { log_error("Device %" PRIu32 ":%" PRIu32 " is used " -- 2.43.5