All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dmeventd: compare dso name with "-"
@ 2015-10-27  7:36 Lidong Zhong
  2015-10-27 10:50 ` Zdenek Kabelac
  0 siblings, 1 reply; 3+ messages in thread
From: Lidong Zhong @ 2015-10-27  7:36 UTC (permalink / raw)
  To: lvm-devel

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.

Signed-off-by: Lidong Zhong <lzhong@suse.com>
---
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(-)

diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index d6accbf..a16f198 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -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. */
-- 
1.8.1.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] dmeventd: compare dso name with "-"
  2015-10-27  7:36 [PATCH] dmeventd: compare dso name with "-" Lidong Zhong
@ 2015-10-27 10:50 ` Zdenek Kabelac
  2015-10-28  3:49   ` Lidong Zhong
  0 siblings, 1 reply; 3+ messages in thread
From: Zdenek Kabelac @ 2015-10-27 10:50 UTC (permalink / raw)
  To: lvm-devel

Dne 27.10.2015 v 08:36 Lidong Zhong napsal(a):
> 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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] dmeventd: compare dso name with "-"
  2015-10-27 10:50 ` Zdenek Kabelac
@ 2015-10-28  3:49   ` Lidong Zhong
  0 siblings, 0 replies; 3+ messages in thread
From: Lidong Zhong @ 2015-10-28  3:49 UTC (permalink / raw)
  To: lvm-devel

>>> On 10/27/2015 at 06:50 PM, in message <562F56FB.2070008@redhat.com>, Zdenek
Kabelac <zkabelac@redhat.com> wrote: 
> Dne 27.10.2015 v 08:36 Lidong Zhong napsal(a): 
> > 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) 
>  

Hi Zdenek,

The fix works well for dmevent_tool. 

Regards,
Lidong

> Regards 
>  
> Zdenek 
>  
> -- 
> lvm-devel mailing list 
> lvm-devel at redhat.com 
> https://www.redhat.com/mailman/listinfo/lvm-devel 
>  
>  





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-28  3:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-27  7:36 [PATCH] dmeventd: compare dso name with "-" Lidong Zhong
2015-10-27 10:50 ` Zdenek Kabelac
2015-10-28  3:49   ` Lidong Zhong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.