mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
Decode numbers in clvmd debugging output.
This commit is contained in:
parent
bdf8c02f80
commit
e350c2f648
@ -9,6 +9,7 @@ Version 2.02.38 -
|
|||||||
|
|
||||||
Version 2.02.37 -
|
Version 2.02.37 -
|
||||||
=================================
|
=================================
|
||||||
|
Decode numbers in clvmd debugging output.
|
||||||
Add missing deactivation after activation failure in lvcreate -Zy.
|
Add missing deactivation after activation failure in lvcreate -Zy.
|
||||||
When activating, if precommitted metadata is still cached, assume it's live.
|
When activating, if precommitted metadata is still cached, assume it's live.
|
||||||
When removing LV symlinks, skip any where the VG name is not determined.
|
When removing LV symlinks, skip any where the VG name is not determined.
|
||||||
|
@ -191,6 +191,58 @@ void debuglog(const char *fmt, ...)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *decode_cmd(unsigned char cmdl)
|
||||||
|
{
|
||||||
|
static char buf[128];
|
||||||
|
const char *command;
|
||||||
|
|
||||||
|
switch (cmdl) {
|
||||||
|
case CLVMD_CMD_TEST:
|
||||||
|
command = "TEST";
|
||||||
|
break;
|
||||||
|
case CLVMD_CMD_LOCK_VG:
|
||||||
|
command = "LOCK_VG";
|
||||||
|
break;
|
||||||
|
case CLVMD_CMD_LOCK_LV:
|
||||||
|
command = "LOCK_LV";
|
||||||
|
break;
|
||||||
|
case CLVMD_CMD_REFRESH:
|
||||||
|
command = "REFRESH";
|
||||||
|
break;
|
||||||
|
case CLVMD_CMD_SET_DEBUG:
|
||||||
|
command = "SET_DEBUG";
|
||||||
|
break;
|
||||||
|
case CLVMD_CMD_GET_CLUSTERNAME:
|
||||||
|
command = "GET_CLUSTERNAME";
|
||||||
|
break;
|
||||||
|
case CLVMD_CMD_VG_BACKUP:
|
||||||
|
command = "VG_BACKUP";
|
||||||
|
break;
|
||||||
|
case CLVMD_CMD_REPLY:
|
||||||
|
command = "REPLY";
|
||||||
|
break;
|
||||||
|
case CLVMD_CMD_VERSION:
|
||||||
|
command = "VERSION";
|
||||||
|
break;
|
||||||
|
case CLVMD_CMD_GOAWAY:
|
||||||
|
command = "GOAWAY";
|
||||||
|
break;
|
||||||
|
case CLVMD_CMD_LOCK:
|
||||||
|
command = "LOCK";
|
||||||
|
break;
|
||||||
|
case CLVMD_CMD_UNLOCK:
|
||||||
|
command = "UNLOCK";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
command = "unknown";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(buf, "%s (0x%x)", command, cmdl);
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int local_sock;
|
int local_sock;
|
||||||
@ -1169,8 +1221,8 @@ static void process_remote_command(struct clvm_header *msg, int msglen, int fd,
|
|||||||
/* Get the node name as we /may/ need it later */
|
/* Get the node name as we /may/ need it later */
|
||||||
clops->name_from_csid(csid, nodename);
|
clops->name_from_csid(csid, nodename);
|
||||||
|
|
||||||
DEBUGLOG("process_remote_command %d for clientid 0x%x XID %d on node %s\n",
|
DEBUGLOG("process_remote_command %s for clientid 0x%x XID %d on node %s\n",
|
||||||
msg->cmd, msg->clientid, msg->xid, nodename);
|
decode_cmd(msg->cmd), msg->clientid, msg->xid, nodename);
|
||||||
|
|
||||||
/* Check for GOAWAY and sulk */
|
/* Check for GOAWAY and sulk */
|
||||||
if (msg->cmd == CLVMD_CMD_GOAWAY) {
|
if (msg->cmd == CLVMD_CMD_GOAWAY) {
|
||||||
@ -1441,8 +1493,9 @@ static int process_local_command(struct clvm_header *msg, int msglen,
|
|||||||
int replylen = 0;
|
int replylen = 0;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
DEBUGLOG("process_local_command: msg=%p, msglen =%d, client=%p\n", msg,
|
DEBUGLOG("process_local_command: %s msg=%p, msglen =%d, client=%p\n",
|
||||||
msglen, client);
|
decode_cmd(msg->cmd), msg, msglen, client);
|
||||||
|
|
||||||
if (replybuf == NULL)
|
if (replybuf == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -61,6 +61,95 @@ struct lv_info {
|
|||||||
int lock_mode;
|
int lock_mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const char *decode_locking_cmd(unsigned char cmdl)
|
||||||
|
{
|
||||||
|
static char buf[128];
|
||||||
|
const char *type;
|
||||||
|
const char *scope;
|
||||||
|
const char *command;
|
||||||
|
|
||||||
|
switch (cmdl & LCK_TYPE_MASK) {
|
||||||
|
case LCK_NULL:
|
||||||
|
type = "NULL";
|
||||||
|
break;
|
||||||
|
case LCK_READ:
|
||||||
|
type = "READ";
|
||||||
|
break;
|
||||||
|
case LCK_PREAD:
|
||||||
|
type = "PREAD";
|
||||||
|
break;
|
||||||
|
case LCK_WRITE:
|
||||||
|
type = "WRITE";
|
||||||
|
break;
|
||||||
|
case LCK_EXCL:
|
||||||
|
type = "EXCL";
|
||||||
|
break;
|
||||||
|
case LCK_UNLOCK:
|
||||||
|
type = "UNLOCK";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
type = "unknown";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (cmdl & LCK_SCOPE_MASK) {
|
||||||
|
case LCK_VG:
|
||||||
|
scope = "VG";
|
||||||
|
break;
|
||||||
|
case LCK_LV:
|
||||||
|
scope = "LV";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
scope = "unknown";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (cmdl) {
|
||||||
|
case LCK_LV_EXCLUSIVE:
|
||||||
|
command = "LCK_LV_EXCLUSIVE";
|
||||||
|
break;
|
||||||
|
case LCK_LV_SUSPEND:
|
||||||
|
command = "LCK_LV_SUSPEND";
|
||||||
|
break;
|
||||||
|
case LCK_LV_UNLOCK:
|
||||||
|
command = "LCK_LV_UNLOCK";
|
||||||
|
break;
|
||||||
|
case LCK_LV_RESUME:
|
||||||
|
command = "LCK_LV_RESUME";
|
||||||
|
break;
|
||||||
|
case LCK_LV_ACTIVATE:
|
||||||
|
command = "LCK_LV_ACTIVATE";
|
||||||
|
break;
|
||||||
|
case LCK_LV_DEACTIVATE:
|
||||||
|
command = "LCK_LV_DEACTIVATE";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
command = "unknown";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(buf, "0x%x %s (%s|%s%s%s%s%s%s)", cmdl, command, type, scope,
|
||||||
|
cmdl & LCK_NONBLOCK ? "|NONBLOCK" : "",
|
||||||
|
cmdl & LCK_HOLD ? "|HOLD" : "",
|
||||||
|
cmdl & LCK_LOCAL ? "|LOCAL" : "",
|
||||||
|
cmdl & LCK_CLUSTER_VG ? "|CLUSTER_VG" : "",
|
||||||
|
cmdl & LCK_CACHE ? "|CACHE" : "");
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *decode_flags(unsigned char flags)
|
||||||
|
{
|
||||||
|
static char buf[128];
|
||||||
|
|
||||||
|
sprintf(buf, "0x%x (%s%s%s)", flags,
|
||||||
|
flags & LCK_PARTIAL_MODE ? "PARTIAL " : "",
|
||||||
|
flags & LCK_MIRROR_NOSYNC_MODE ? "MIRROR_NOSYNC " : "",
|
||||||
|
flags & LCK_DMEVENTD_MONITOR_MODE ? "DMEVENTD_MONITOR " : "");
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
char *get_last_lvm_error()
|
char *get_last_lvm_error()
|
||||||
{
|
{
|
||||||
return last_error;
|
return last_error;
|
||||||
@ -312,8 +401,8 @@ int do_lock_lv(unsigned char command, unsigned char lock_flags, char *resource)
|
|||||||
{
|
{
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
DEBUGLOG("do_lock_lv: resource '%s', cmd = 0x%x, flags = %x\n",
|
DEBUGLOG("do_lock_lv: resource '%s', cmd = %s, flags = %s\n",
|
||||||
resource, command, lock_flags);
|
resource, decode_locking_cmd(command), decode_flags(lock_flags));
|
||||||
|
|
||||||
pthread_mutex_lock(&lvm_lock);
|
pthread_mutex_lock(&lvm_lock);
|
||||||
if (!cmd->config_valid || config_files_changed(cmd)) {
|
if (!cmd->config_valid || config_files_changed(cmd)) {
|
||||||
@ -391,8 +480,8 @@ int pre_lock_lv(unsigned char command, unsigned char lock_flags, char *resource)
|
|||||||
before suspending cluster-wide.
|
before suspending cluster-wide.
|
||||||
*/
|
*/
|
||||||
if (command == LCK_LV_SUSPEND) {
|
if (command == LCK_LV_SUSPEND) {
|
||||||
DEBUGLOG("pre_lock_lv: resource '%s', cmd = 0x%x, flags = %d\n",
|
DEBUGLOG("pre_lock_lv: resource '%s', cmd = %s, flags = %s\n",
|
||||||
resource, command, lock_flags);
|
resource, decode_locking_cmd(command), decode_flags(lock_flags));
|
||||||
|
|
||||||
if (hold_lock(resource, LKM_PWMODE, LKF_NOQUEUE))
|
if (hold_lock(resource, LKM_PWMODE, LKF_NOQUEUE))
|
||||||
return errno;
|
return errno;
|
||||||
@ -411,8 +500,8 @@ int post_lock_lv(unsigned char command, unsigned char lock_flags,
|
|||||||
int oldmode;
|
int oldmode;
|
||||||
|
|
||||||
DEBUGLOG
|
DEBUGLOG
|
||||||
("post_lock_lv: resource '%s', cmd = 0x%x, flags = %d\n",
|
("post_lock_lv: resource '%s', cmd = %s, flags = %s\n",
|
||||||
resource, command, lock_flags);
|
resource, decode_locking_cmd(command), decode_flags(lock_flags));
|
||||||
|
|
||||||
/* If the lock state is PW then restore it to what it was */
|
/* If the lock state is PW then restore it to what it was */
|
||||||
oldmode = get_current_lock(resource);
|
oldmode = get_current_lock(resource);
|
||||||
@ -505,6 +594,7 @@ static void drop_vg_locks()
|
|||||||
*/
|
*/
|
||||||
void drop_metadata(const char *vgname)
|
void drop_metadata(const char *vgname)
|
||||||
{
|
{
|
||||||
|
DEBUGLOG("Dropping metadata for VG %s\n", vgname);
|
||||||
pthread_mutex_lock(&lvm_lock);
|
pthread_mutex_lock(&lvm_lock);
|
||||||
lvmcache_drop_metadata(vgname);
|
lvmcache_drop_metadata(vgname);
|
||||||
pthread_mutex_unlock(&lvm_lock);
|
pthread_mutex_unlock(&lvm_lock);
|
||||||
|
3
lib/cache/lvmcache.c
vendored
3
lib/cache/lvmcache.c
vendored
@ -506,7 +506,8 @@ struct volume_group *lvmcache_get_vg(const char *vgid, unsigned precommitted)
|
|||||||
return_NULL;
|
return_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_debug("Using cached metadata for VG %s.", vginfo->vgname);
|
log_debug("Using cached %smetadata for VG %s.",
|
||||||
|
vginfo->precommitted ? "pre-committed" : "", vginfo->vgname);
|
||||||
|
|
||||||
return vg;
|
return vg;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user