All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] update dmeventd plugins to use proper lvm2_log_fn_t
@ 2009-09-17  2:06 Mike Snitzer
  2009-09-25 22:15 ` Takahiro Yasui
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Snitzer @ 2009-09-17  2:06 UTC (permalink / raw)
  To: lvm-devel

The dmeventd plugins provide their own _temporary_log_fn.  But they were
not updated when lvm2_log_fn_t was last updated, see:
http://sources.redhat.com/git/?p=lvm2.git;a=commit;h=0ed40c04c

I verified this patch fixes a SEGV seen in the dmeventd snapshot plugin:

# lvs
  LV          VG   Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  testlv      test owi-a- 300.00M
  testlv_snap test swi-ao  52.00M testlv  92.68
# vgchange --monitor y test
  2 logical volume(s) in volume group "test" monitored

and messages file shows:

Sep 16 21:15:05 really-raw dmeventd[12522]: dmeventd ready for processing.
Sep 16 21:15:11 really-raw lvm[12522]: Monitoring snapshot test-testlv_snap
Sep 16 21:15:15 really-raw lvm[12522]: Snapshot test-testlv_snap is now 92% full.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>

---
diff --git a/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c b/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c
index 8869e80..503ec0d 100644
--- a/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c
+++ b/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c
@@ -126,8 +126,10 @@ out_parse:
 	return ME_IGNORE;
 }
 
-static void _temporary_log_fn(int level, const char *file __attribute((unused)),
+static void _temporary_log_fn(int level,
+			      const char *file __attribute((unused)),
 			      int line __attribute((unused)),
+			      int dm_errno __attribute((unused)),
 			      const char *format)
 {
 	if (!strncmp(format, "WARNING: ", 9) && (level < 5))
diff --git a/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c b/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c
index 3e250af..96c4688 100644
--- a/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c
+++ b/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c
@@ -57,6 +57,7 @@ static pthread_mutex_t _event_mutex = PTHREAD_MUTEX_INITIALIZER;
 static void _temporary_log_fn(int level,
 			      const char *file __attribute((unused)),
 			      int line __attribute((unused)),
+			      int dm_errno __attribute((unused)),
 			      const char *format)
 {
 	if (!strncmp(format, "WARNING: ", 9) && (level < 5))



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

* [PATCH] update dmeventd plugins to use proper lvm2_log_fn_t
  2009-09-17  2:06 [PATCH] update dmeventd plugins to use proper lvm2_log_fn_t Mike Snitzer
@ 2009-09-25 22:15 ` Takahiro Yasui
  2009-09-26  0:41   ` Alasdair G Kergon
  0 siblings, 1 reply; 3+ messages in thread
From: Takahiro Yasui @ 2009-09-25 22:15 UTC (permalink / raw)
  To: lvm-devel

Hi Mike,

I built the latest lvm2 but the following error messages were
displayed.

dmeventd_mirror.c: In function 'register_device':
dmeventd_mirror.c:256: warning: passing argument 1 of 'lvm2_log_fn' from incompatible pointer type
...
dmeventd_snapshot.c: In function 'register_device':
dmeventd_snapshot.c:170: warning: passing argument 1 of 'lvm2_log_fn' from incompatible pointer type

The prototype definition in lvm2cmd.h also needs to be updated.

Thanks,
Taka

-- 
Takahiro Yasui
Hitachi Computer Products (America), Inc.


Signed-off-by: Takahiro Yasui <tyasui@redhat.com>
---
 tools/lvm2cmd.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: LVM2.02.53-20090925/tools/lvm2cmd.h
===================================================================
--- LVM2.02.53-20090925.orig/tools/lvm2cmd.h
+++ LVM2.02.53-20090925/tools/lvm2cmd.h
@@ -18,7 +18,7 @@

 #ifndef _LVM_LOG_H
 typedef void (*lvm2_log_fn_t) (int level, const char *file, int line,
-                              const char *message);
+                              int dm_errno, const char *message);
 #endif

 #define LVM2_LOG_SUPPRESS      0


Mike Snitzer wrote:
> The dmeventd plugins provide their own _temporary_log_fn.  But they were
> not updated when lvm2_log_fn_t was last updated, see:
> http://sources.redhat.com/git/?p=lvm2.git;a=commit;h=0ed40c04c
> 
> I verified this patch fixes a SEGV seen in the dmeventd snapshot plugin:
> 
> # lvs
>   LV          VG   Attr   LSize   Origin Snap%  Move Log Copy%  Convert
>   testlv      test owi-a- 300.00M
>   testlv_snap test swi-ao  52.00M testlv  92.68
> # vgchange --monitor y test
>   2 logical volume(s) in volume group "test" monitored
> 
> and messages file shows:
> 
> Sep 16 21:15:05 really-raw dmeventd[12522]: dmeventd ready for processing.
> Sep 16 21:15:11 really-raw lvm[12522]: Monitoring snapshot test-testlv_snap
> Sep 16 21:15:15 really-raw lvm[12522]: Snapshot test-testlv_snap is now 92% full.
> 
> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
> 
> ---
> diff --git a/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c b/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c
> index 8869e80..503ec0d 100644
> --- a/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c
> +++ b/daemons/dmeventd/plugins/mirror/dmeventd_mirror.c
> @@ -126,8 +126,10 @@ out_parse:
>  	return ME_IGNORE;
>  }
>  
> -static void _temporary_log_fn(int level, const char *file __attribute((unused)),
> +static void _temporary_log_fn(int level,
> +			      const char *file __attribute((unused)),
>  			      int line __attribute((unused)),
> +			      int dm_errno __attribute((unused)),
>  			      const char *format)
>  {
>  	if (!strncmp(format, "WARNING: ", 9) && (level < 5))
> diff --git a/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c b/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c
> index 3e250af..96c4688 100644
> --- a/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c
> +++ b/daemons/dmeventd/plugins/snapshot/dmeventd_snapshot.c
> @@ -57,6 +57,7 @@ static pthread_mutex_t _event_mutex = PTHREAD_MUTEX_INITIALIZER;
>  static void _temporary_log_fn(int level,
>  			      const char *file __attribute((unused)),
>  			      int line __attribute((unused)),
> +			      int dm_errno __attribute((unused)),
>  			      const char *format)
>  {
>  	if (!strncmp(format, "WARNING: ", 9) && (level < 5))
> 
> --
> 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

* [PATCH] update dmeventd plugins to use proper lvm2_log_fn_t
  2009-09-25 22:15 ` Takahiro Yasui
@ 2009-09-26  0:41   ` Alasdair G Kergon
  0 siblings, 0 replies; 3+ messages in thread
From: Alasdair G Kergon @ 2009-09-26  0:41 UTC (permalink / raw)
  To: lvm-devel

Thanks for spotting that.
I've reissued the release.

Alasdair



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

end of thread, other threads:[~2009-09-26  0:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-17  2:06 [PATCH] update dmeventd plugins to use proper lvm2_log_fn_t Mike Snitzer
2009-09-25 22:15 ` Takahiro Yasui
2009-09-26  0:41   ` Alasdair G Kergon

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.