From cb63efc6f9566fe8ecc4103710511287742fceae Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Thu, 22 Oct 2009 17:45:23 +0000 Subject: [PATCH] Fix clvmd segfault when refresh_toolcontext fails. (brassow, bz 506986) --- WHATS_NEW | 1 + daemons/clvmd/lvm-functions.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 0fee2fa1b..1401be7fa 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.54 - ===================================== + Fix clvmd segfault when refresh_toolcontext fails. Remember to clear 'global lock held during cache refresh' state after use. Use udev flags support in LVM. Delay announcing mirror monitoring to syslog until initialisation succeeded. diff --git a/daemons/clvmd/lvm-functions.c b/daemons/clvmd/lvm-functions.c index a974fadf3..e56d11b4b 100644 --- a/daemons/clvmd/lvm-functions.c +++ b/daemons/clvmd/lvm-functions.c @@ -601,20 +601,23 @@ int do_check_lvm1(const char *vgname) int do_refresh_cache() { - int ret; DEBUGLOG("Refreshing context\n"); log_notice("Refreshing context"); pthread_mutex_lock(&lvm_lock); - ret = refresh_toolcontext(cmd); + if (!refresh_toolcontext(cmd)) { + pthread_mutex_unlock(&lvm_lock); + return -1; + } + init_full_scan_done(0); lvmcache_label_scan(cmd, 2); dm_pool_empty(cmd->mem); pthread_mutex_unlock(&lvm_lock); - return ret==1?0:-1; + return 0; }