From ea7c621b0a63f261c7927f1cdf5b0eff2fb70757 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Mon, 6 Dec 2010 17:37:09 +0000 Subject: Fix debug logging of derived flag LCK_CACHE in clvmd. --- daemons/clvmd/lvm-functions.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'daemons/clvmd/lvm-functions.c') diff --git a/daemons/clvmd/lvm-functions.c b/daemons/clvmd/lvm-functions.c index 7fda9928..5b4a7ee1 100644 --- a/daemons/clvmd/lvm-functions.c +++ b/daemons/clvmd/lvm-functions.c @@ -44,11 +44,7 @@ struct lv_info { int lock_mode; }; -/* - * FIXME: 8bit value passed here - - * so only LCK_XXX defines < 0x100 can be decoded - */ -static const char *decode_locking_cmd(unsigned char cmdl) +static const char *decode_full_locking_cmd(uint32_t cmdl) { static char buf[128]; const char *type; @@ -117,11 +113,20 @@ static const char *decode_locking_cmd(unsigned char cmdl) cmdl & LCK_NONBLOCK ? "|NONBLOCK" : "", cmdl & LCK_HOLD ? "|HOLD" : "", cmdl & LCK_LOCAL ? "|LOCAL" : "", - cmdl & LCK_CLUSTER_VG ? "|CLUSTER_VG" : ""); + cmdl & LCK_CLUSTER_VG ? "|CLUSTER_VG" : "", + cmdl & LCK_CACHE ? "|CACHE" : ""); return buf; } +/* + * Only processes 8 bits: excludes LCK_CACHE. + */ +static const char *decode_locking_cmd(unsigned char cmdl) +{ + return decode_full_locking_cmd((uint32_t) cmdl); +} + static const char *decode_flags(unsigned char flags) { static char buf[128]; @@ -676,15 +681,6 @@ void do_lock_vg(unsigned char command, unsigned char lock_flags, char *resource) uint32_t lock_cmd = command; char *vgname = resource + 2; - DEBUGLOG("do_lock_vg: resource '%s', cmd = %s, flags = %s, memlock = %d\n", - resource, decode_locking_cmd(command), decode_flags(lock_flags), memlock()); - - /* P_#global causes a full cache refresh */ - if (!strcmp(resource, "P_" VG_GLOBAL)) { - do_refresh_cache(); - return; - } - lock_cmd &= (LCK_SCOPE_MASK | LCK_TYPE_MASK | LCK_HOLD); /* @@ -693,6 +689,15 @@ void do_lock_vg(unsigned char command, unsigned char lock_flags, char *resource) if (strncmp(resource, "P_#", 3) && !strncmp(resource, "P_", 2)) lock_cmd |= LCK_CACHE; + DEBUGLOG("do_lock_vg: resource '%s', cmd = %s, flags = %s, memlock = %d\n", + resource, decode_full_locking_cmd(lock_cmd), decode_flags(lock_flags), memlock()); + + /* P_#global causes a full cache refresh */ + if (!strcmp(resource, "P_" VG_GLOBAL)) { + do_refresh_cache(); + return; + } + pthread_mutex_lock(&lvm_lock); switch (lock_cmd) { case LCK_VG_COMMIT: -- cgit