Skip to contentSkip to conversation

dmeventd: compare dso name with "-"

PATCH New Lidong Zhong 2 participants 3 messages Oct 27, 2015 – Oct 28, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmeventd: compare dso name with "-"

If the dso name is not set in client, then it will be replaced by "-". So the server should compare the dso name with "-" to decide whether it is set.

---
Hi list,

Currently I notice that there are a lot of patches for dmeventd. It may be a good chance to mention the problem I met before again.

344 int daemon_talk(struct dm_event_fifos *fifos,

345         struct dm_event_daemon_message *msg, int cmd,
346         const char *dso_name, const char *dev_name,
347         enum dm_event_mask evmask, uint32_t timeout)

348 {
349 int msg_size;
350 memset(msg, 0, sizeof(*msg));
351
352 /*

353      * Set command and pack the arguments
354      * into ASCII message string.
355      */

356 if ((msg_size =
357 ((cmd == DM_EVENT_CMD_HELLO) ?
358 dm_asprintf(&(msg->data), "%d:%d HELLO", getpid(), _sequence_nr) :
359 dm_asprintf(&(msg->data), "%d:%d %s %s %u %" PRIu32,
360 getpid(), _sequence_nr,
361 dso_name ? : "-", dev_name ? : "-", evmask, timeout)))
362 < 0) {

We can see that it will set the dso_name to "-" if the client doesn't give. So the server will never get the variable as empty. And it is a problem for dmevent_tool. We can fix it with the following patch.

Regards,
Lidong

 daemons/dmeventd/dmeventd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
daemons/dmeventd/dmeventd.c +2 -2
index d6accbf..a16f198 100644
@@ -1213,12 +1213,12 @@ static int _want_registered_device(char *dso_name, char *device_uuid,
 				   struct thread_status *thread)
 {
 	/* If DSO names and device paths are equal. */
-	if (dso_name && device_uuid)
+	if (strcmp(dso_name, "-") && device_uuid)
 		return !strcmp(dso_name, thread->dso_data->dso_name) &&
 		    !strcmp(device_uuid, thread->device.uuid);
 
 	/* If DSO names are equal. */
-	if (dso_name)
+	if (strcmp(dso_name, "-"))
 		return !strcmp(dso_name, thread->dso_data->dso_name);
 
 	/* If device paths are equal. */
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH 1/1 dmeventd: compare dso name with "-"

Dne 27.10.2015 v 08:36 Lidong Zhong napsal(a):

Quoted 3 lines

If the dso name is not set in client, then it will be replaced by "-". So the server should compare the dso name with "-" to decide whether it is set.

Hi

Tried to fix this differently:

https://www.redhat.com/archives/lvm-devel/2015-October/msg00163.html

Please let me know if this has fixed problem for you. (dmevent_tool is from already 'dead' project dmraid - so untested)

Regards

Zdenek

#2 lore raw

PATCH 1/1 dmeventd: compare dso name with "-"

Quoted 1 line
Quoted 1 line
Quoted 1 line

On 10/27/2015 at 06:50 PM, in message <[email protected]>, Zdenek

Quoted 7 lines · Kabelac

Dne 27.10.2015 v 08:36 Lidong Zhong napsal(a):

Quoted 3 lines

If the dso name is not set in client, then it will be replaced by "-". So the server should compare the dso name with "-" to decide whether it is set.

Hi

Quoted 8 lines

Tried to fix this differently:

https://www.redhat.com/archives/lvm-devel/2015-October/msg00163.html

Please let me know if this has fixed problem for you. (dmevent_tool is from already 'dead' project dmraid - so untested)

Hi Zdenek,

The fix works well for dmevent_tool.

Regards,
Lidong

Quoted 10 lines

Regards

Zdenek

Signature · 3 lines
lvm-devel mailing list 
lvm-devel at redhat.com 
https://www.redhat.com/mailman/listinfo/lvm-devel