1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-17 06:04:23 +03:00

Extend debug log messages to distinguish between the 3 states:

trust udev; verify udev; perform dev node operations directly.
This commit is contained in:
Alasdair Kergon 2011-06-27 22:38:53 +00:00
parent 0437bccc3c
commit 9032898eb1
2 changed files with 19 additions and 8 deletions

View File

@ -828,20 +828,24 @@ static int _other_node_ops(node_op_t type)
static void _log_node_op(const char *action_str, struct node_op_parms *nop) static void _log_node_op(const char *action_str, struct node_op_parms *nop)
{ {
const char *rely = nop->rely_on_udev ? " [trust_udev]" : "" ;
const char *verify = nop->warn_if_udev_failed ? " [verify_udev]" : "";
switch (nop->type) { switch (nop->type) {
case NODE_ADD: case NODE_ADD:
log_debug("%s: %s NODE_ADD (%" PRIu32 ",%" PRIu32 ") %u:%u 0%o", log_debug("%s: %s NODE_ADD (%" PRIu32 ",%" PRIu32 ") %u:%u 0%o%s%s",
nop->dev_name, action_str, nop->major, nop->minor, nop->uid, nop->gid, nop->mode); nop->dev_name, action_str, nop->major, nop->minor, nop->uid, nop->gid, nop->mode,
rely, verify);
break; break;
case NODE_DEL: case NODE_DEL:
log_debug("%s: %s NODE_DEL", nop->dev_name, action_str); log_debug("%s: %s NODE_DEL%s%s", nop->dev_name, action_str, rely, verify);
break; break;
case NODE_RENAME: case NODE_RENAME:
log_debug("%s: %s NODE_RENAME to %s", nop->old_name, action_str, nop->dev_name); log_debug("%s: %s NODE_RENAME to %s%s%s", nop->old_name, action_str, nop->dev_name, rely, verify);
break; break;
case NODE_READ_AHEAD: case NODE_READ_AHEAD:
log_debug("%s: %s NODE_READ_AHEAD %" PRIu32 " (flags=%" PRIu32 log_debug("%s: %s NODE_READ_AHEAD %" PRIu32 " (flags=%" PRIu32 ")%s%s",
")", nop->dev_name, action_str, nop->read_ahead, nop->read_ahead_flags); nop->dev_name, action_str, nop->read_ahead, nop->read_ahead_flags, rely, verify);
break; break;
default: default:
; /* NOTREACHED */ ; /* NOTREACHED */
@ -859,6 +863,13 @@ static int _stack_node_op(node_op_t type, const char *dev_name, uint32_t major,
size_t len = strlen(dev_name) + strlen(old_name) + 2; size_t len = strlen(dev_name) + strlen(old_name) + 2;
char *pos; char *pos;
/*
* Clear warn_if_udev_failed if rely_on_udev is set. It doesn't get
* checked in this case - this just removes the flag from log messages.
*/
if (rely_on_udev)
warn_if_udev_failed = 0;
/* /*
* Note: warn_if_udev_failed must have valid content * Note: warn_if_udev_failed must have valid content
*/ */
@ -947,7 +958,7 @@ static void _pop_node_ops(void)
nop->read_ahead, nop->read_ahead_flags, nop->read_ahead, nop->read_ahead_flags,
nop->warn_if_udev_failed); nop->warn_if_udev_failed);
} else } else
_log_node_op("Skipping (udev)", nop); _log_node_op("Skipping", nop);
_del_node_op(nop); _del_node_op(nop);
} }
} }

View File

@ -985,7 +985,7 @@ static int _deactivate_node(const char *name, uint32_t major, uint32_t minor,
/* FIXME Until kernel returns actual name so dm-iface.c can handle it */ /* FIXME Until kernel returns actual name so dm-iface.c can handle it */
rm_dev_node(name, dmt->cookie_set && !(udev_flags & DM_UDEV_DISABLE_DM_RULES_FLAG), rm_dev_node(name, dmt->cookie_set && !(udev_flags & DM_UDEV_DISABLE_DM_RULES_FLAG),
dmt->cookie_set && !(udev_flags & DM_UDEV_DISABLE_LIBRARY_FALLBACK)); dmt->cookie_set && (udev_flags & DM_UDEV_DISABLE_LIBRARY_FALLBACK));
/* FIXME Remove node from tree or mark invalid? */ /* FIXME Remove node from tree or mark invalid? */