Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 146999 Details for
Bug 225487
mirror remove leaves device mapper devices behind (dmeventd messages need id)
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
patch to add IDs to dmeventd messages
dmeventd_message_id.RHEL4.patch (text/plain), 5.49 KB, created by
Ben Marzinski
on 2007-01-31 04:23:15 UTC
(
hide
)
Description:
patch to add IDs to dmeventd messages
Filename:
MIME Type:
Creator:
Ben Marzinski
Created:
2007-01-31 04:23:15 UTC
Size:
5.49 KB
patch
obsolete
>diff -urpN device-mapper-base/dmeventd/dmeventd.c device-mapper-patched/dmeventd/dmeventd.c >--- device-mapper-base/dmeventd/dmeventd.c 2007-01-25 08:16:20.000000000 -0600 >+++ device-mapper-patched/dmeventd/dmeventd.c 2007-01-30 22:05:58.000000000 -0600 >@@ -146,6 +146,7 @@ static LIST_INIT(_dso_registry); > > /* Structure to keep parsed register variables from client message. */ > struct message_data { >+ char *id; > char *dso_name; /* Name of DSO. */ > char *device_uuid; /* Mapped device path. */ > union { >@@ -320,6 +321,8 @@ static int _fetch_string(char **ptr, cha > /* Free message memory. */ > static void _free_message(struct message_data *message_data) > { >+ if (message_data->id) >+ dm_free(message_data->id); > if (message_data->dso_name) > dm_free(message_data->dso_name); > >@@ -342,7 +345,8 @@ static int _parse_message(struct message > * Retrieve application identifier, mapped device > * path and events # string from message. > */ >- if (_fetch_string(&message_data->dso_name, &p, ' ') && >+ if (_fetch_string(&message_data->id, &p, ' ') && >+ _fetch_string(&message_data->dso_name, &p, ' ') && > _fetch_string(&message_data->device_uuid, &p, ' ') && > _fetch_string(&message_data->events.str, &p, ' ') && > _fetch_string(&message_data->timeout.str, &p, ' ')) { >@@ -1056,7 +1060,8 @@ static int _registered_device(struct mes > { > struct dm_event_daemon_message *msg = message_data->msg; > >- const char *fmt = "%s %s %u"; >+ const char *fmt = "%s %s %s %u"; >+ const char *id = message_data->id; > const char *dso = thread->dso_data->dso_name; > const char *dev = thread->device.uuid; > unsigned events = ((thread->status == DM_THREAD_RUNNING) >@@ -1066,7 +1071,7 @@ static int _registered_device(struct mes > if (msg->data) > dm_free(msg->data); > >- msg->size = dm_asprintf(&(msg->data), fmt, dso, dev, events); >+ msg->size = dm_asprintf(&(msg->data), fmt, id, dso, dev, events); > > _unlock_mutex(); > >@@ -1180,7 +1185,8 @@ static int _get_timeout(struct message_d > _lock_mutex(); > if ((thread = _lookup_thread_status(message_data))) { > msg->size = >- dm_asprintf(&(msg->data), "%" PRIu32, thread->timeout); >+ dm_asprintf(&(msg->data), "%s %" PRIu32, message_data->id, >+ thread->timeout); > } else { > msg->data = NULL; > msg->size = 0; >diff -urpN device-mapper-base/dmeventd/libdevmapper-event.c device-mapper-patched/dmeventd/libdevmapper-event.c >--- device-mapper-base/dmeventd/libdevmapper-event.c 2007-01-22 09:03:57.000000000 -0600 >+++ device-mapper-patched/dmeventd/libdevmapper-event.c 2007-01-30 22:00:07.000000000 -0600 >@@ -30,6 +30,8 @@ > #include <sys/wait.h> > #include <arpa/inet.h> /* for htonl, ntohl */ > >+static int sequence_nr = 0; >+ > struct dm_event_handler { > char *dso; > >@@ -182,6 +184,20 @@ enum dm_event_mask dm_event_handler_get_ > return dmevh->mask; > } > >+static int check_message_id(struct dm_event_daemon_message *msg) >+{ >+ int pid, seq_nr; >+ >+ if ((scanf(msg->data, "%d:%d", &pid, &seq_nr) != 2) || >+ (pid != getpid()) || (seq_nr != sequence_nr)) { >+ log_error("invalid message ID on reply from dmeventd. " >+ "wanted id %d:%d. message was '%s'", getpid(), >+ sequence_nr, msg->data); >+ return 0; >+ } >+ return 1; >+} >+ > /* > * daemon_read > * @fifos >@@ -301,7 +317,7 @@ static int _daemon_talk(struct dm_event_ > { > const char *dso = dso_name ? dso_name : ""; > const char *dev = dev_name ? dev_name : ""; >- const char *fmt = "%s %s %u %" PRIu32; >+ const char *fmt = "%d:%d %s %s %u %" PRIu32; > int msg_size; > memset(msg, 0, sizeof(*msg)); > >@@ -310,8 +326,8 @@ static int _daemon_talk(struct dm_event_ > * into ASCII message string. > */ > msg->cmd = cmd; >- if ((msg_size = dm_asprintf(&(msg->data), fmt, dso, dev, evmask, >- timeout)) < 0) { >+ if ((msg_size = dm_asprintf(&(msg->data), fmt, getpid(), sequence_nr, >+ dso, dev, evmask, timeout)) < 0) { > log_error("_daemon_talk: message allocation failed"); > return -ENOMEM; > } >@@ -326,11 +342,14 @@ static int _daemon_talk(struct dm_event_ > return -EIO; > } > >- if (!_daemon_read(fifos, msg)) { >- stack; >- return -EIO; >- } >+ do { >+ if (!_daemon_read(fifos, msg)) { >+ stack; >+ return -EIO; >+ } >+ } while (!check_message_id(msg)); > >+ sequence_nr++; > return (int32_t) msg->cmd; > } > >@@ -598,15 +617,20 @@ static char *_fetch_string(char **src, c > static int _parse_message(struct dm_event_daemon_message *msg, char **dso_name, > char **uuid, enum dm_event_mask *evmask) > { >+ char *id = NULL; > char *p = msg->data; > >- if ((*dso_name = _fetch_string(&p, ' ')) && >+ if ((id = _fetch_string(&p, ' ')) && >+ (*dso_name = _fetch_string(&p, ' ')) && > (*uuid = _fetch_string(&p, ' '))) { > *evmask = atoi(p); > >+ free(id); > return 0; > } > >+ if (id) >+ free(id); > return -ENOMEM; > } > >@@ -696,6 +720,14 @@ int dm_event_get_registered_device(struc > > #if 0 /* left out for now */ > >+static char *_skip_string(char *src, const int delimiter) >+{ >+ src = srtchr(src, delimiter); >+ if (src && *(src + 1)) >+ return src + 1; >+ return NULL; >+} >+ > int dm_event_set_timeout(const char *device_path, uint32_t timeout) > { > struct dm_event_daemon_message msg; >@@ -715,8 +747,15 @@ int dm_event_get_timeout(const char *dev > if (!device_exists(device_path)) > return -ENODEV; > if (!(ret = _do_event(DM_EVENT_CMD_GET_TIMEOUT, &msg, NULL, device_path, >- 0, 0))) >- *timeout = atoi(msg.data); >+ 0, 0))) { >+ char *p = _skip_string(msg.data, ' '); >+ if (!p) { >+ log_error("malformed reply from dmeventd '%s'\n", >+ msg.data); >+ return -EIO; >+ } >+ *timeout = atoi(p); >+ } > if (msg.data) > dm_free(msg.data); > return ret;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 225487
: 146999 |
153306
|
153349