LVM2 ./WHATS_NEW ./WHATS_NEW_DM ./configure ./ ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2010-08-16 22:54:37
Modified files:
. : WHATS_NEW WHATS_NEW_DM configure configure.in
daemons/dmeventd: .exported_symbols Makefile.in
libdevmapper-event.c libdevmapper-event.h
doc : example.conf.in
lib/activate : activate.c activate.h
lib/config : defaults.h
lib/mirror : mirrored.c
lib/misc : configure.h.in
lib/snapshot : snapshot.c
tools : lvchange.c vgchange.c
Log message:
Various small cleanups and fixes related to monitoring.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1703&r2=1.1704
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.409&r2=1.410
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/configure.diff?cvsroot=lvm2&r1=1.138&r2=1.139
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/configure.in.diff?cvsroot=lvm2&r1=1.152&r2=1.153
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/.exported_symbols.diff?cvsroot=lvm2&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/Makefile.in.diff?cvsroot=lvm2&r1=1.44&r2=1.45
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/libdevmapper-event.c.diff?cvsroot=lvm2&r1=1.33&r2=1.34
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/libdevmapper-event.h.diff?cvsroot=lvm2&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/example.conf.in.diff?cvsroot=lvm2&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.173&r2=1.174
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.h.diff?cvsroot=lvm2&r1=1.68&r2=1.69
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/defaults.h.diff?cvsroot=lvm2&r1=1.65&r2=1.66
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/mirror/mirrored.c.diff?cvsroot=lvm2&r1=1.75&r2=1.76
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/configure.h.in.diff?cvsroot=lvm2&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/snapshot/snapshot.c.diff?cvsroot=lvm2&r1=1.47&r2=1.48
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvchange.c.diff?cvsroot=lvm2&r1=1.122&r2=1.123
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgchange.c.diff?cvsroot=lvm2&r1=1.110&r2=1.111
WHATS_NEW +3 -0
@@ -1,5 +1,8 @@ Version 2.02.73 - ================================ + Fix some exit statuses when starting/stopping monitoring fails. + Enable snapshot monitoring by default when dmeventd is enabled. + Move cloned libdevmapper-event client code from segments into lib/activate. Fix 'lvconvert --splitmirrors' in cluster operation. Fix clvmd init script exit code when executed as non-root user. Change default alignment of pe_start to 1MB.
WHATS_NEW_DM +3 -0
@@ -1,5 +1,8 @@ Version 1.02.54 - ================================ + Add dmeventd/executable to lvm.conf to test alternative dmeventd. + Export dm_event_handler_set_dmeventd_path to override built-in dmeventd path. + Generate libdevmapper-event exported symbols. Remove superfluous NULL pointer tests before dm_free from dmeventd. Assume dm-mod autoloading support is in kernel 2.6.36 and higher, not 2.6.35. Fix udev rules to support udev database content generated by older rules.
configure +177 -1
215 lines not on this page · raw message
configure.in +1 -0
@@ -1251,6 +1251,7 @@ AC_SUBST(DLM_LIBS) AC_SUBST(DL_LIBS) AC_SUBST(DMEVENTD) +AC_SUBST(DMEVENTD_PATH) AC_SUBST(DM_COMPAT) AC_SUBST(DM_DEVICE_GID) AC_SUBST(DM_DEVICE_MODE)
daemons/dmeventd/.exported_symbols +0 -19
@@ -1,19 +0,0 @@ -dm_event_handler_create -dm_event_handler_destroy -dm_event_handler_set_dso -dm_event_handler_set_dev_name -dm_event_handler_set_uuid -dm_event_handler_set_major -dm_event_handler_set_minor -dm_event_handler_set_event_mask -dm_event_handler_get_dso -dm_event_handler_get_devname -dm_event_handler_get_uuid -dm_event_handler_get_major -dm_event_handler_get_minor -dm_event_handler_get_event_mask -dm_event_register_handler -dm_event_unregister_handler -dm_event_get_registered_device -dm_event_handler_set_timeout -dm_event_handler_get_timeout
daemons/dmeventd/Makefile.in +4 -1
@@ -48,6 +48,9 @@ CFLOW_LIST_TARGET = $(LIB_NAME).cflow CFLOW_TARGET = dmeventd +EXPORTED_HEADER = $(srcdir)/libdevmapper-event.h +EXPORTED_FN_PREFIX = dm_event + include $(top_builddir)/make.tmpl all: device-mapper
@@ -102,4 +105,4 @@ install_device-mapper: install_include install_lib install_dmeventd -DISTCLEAN_TARGETS += libdevmapper-event.pc +DISTCLEAN_TARGETS += libdevmapper-event.pc .exported_symbols_generated
daemons/dmeventd/libdevmapper-event.c +30 -10
@@ -35,6 +35,8 @@struct dm_event_handler {char *dso; +char *dmeventd_path; +char *dev_name;char *uuid;
@@ -60,6 +62,7 @@if (!(dmevh =dm_malloc (sizeof (*dmevh))))return NULL ; + dmevh->dmeventd_path =NULL ; dmevh->dso = dmevh->dev_name = dmevh->uuid =NULL ; dmevh->major = dmevh->minor =0 ; dmevh->mask =0 ;
@@ -72,9 +75,24 @@ {_dm_event_handler_clear_dev_info (dmevh);dm_free (dmevh->dso); +dm_free (dmevh->dmeventd_path);dm_free (dmevh); } +int dm_event_handler_set_dmeventd_path (struct dm_event_handler *dmevh,const char *dmeventd_path) +{ +if (!dmeventd_path)/* noop */ +return 0 ; + +dm_free (dmevh->dmeventd_path); + + dmevh->dmeventd_path =dm_strdup (dmeventd_path); +if (!dmevh->dmeventd_path) +return -ENOMEM ; + +return 0 ; +} +int dm_event_handler_set_dso (struct dm_event_handler *dmevh,const char *path) {if (!path)/* noop */
@@ -387,13 +405,13 @@* * Returns: 1 on success, 0 otherwise */ -static int _start_daemon (struct dm_event_fifos *fifos) +static int _start_daemon (char *dmeventd_path,struct dm_event_fifos *fifos) {int pid, ret =0 ;int status;struct stat statbuf; -char dmeventdpath[] =DMEVENTD_PATH ;/* const type for execvp */ -char *const args[] = { dmeventdpath,NULL }; +char default_dmeventd_path[] =DMEVENTD_PATH ; +char *args[] = { dmeventd_path ? : default_dmeventd_path,NULL };if (stat (fifos->client_path, &statbuf)) goto start_server;
@@ -449,17 +467,19 @@ }/* Initialize client. */ -static int _init_client (struct dm_event_fifos *fifos) +static int _init_client (char *dmeventd_path,struct dm_event_fifos *fifos) {/* FIXME? Is fifo the most suitable method? Why not share comms/daemon code with something else e.g. multipath? */ /* init fifos */ memset (fifos,0 ,sizeof (*fifos)); + +/* FIXME Make these either configurable or depend directly on dmeventd_path */ fifos->client_path =DM_EVENT_FIFO_CLIENT ; fifos->server_path =DM_EVENT_FIFO_SERVER ; -if (!_start_daemon (fifos)) { +if (!_start_daemon (dmeventd_path, fifos)) { stack;return 0 ; }
@@ -544,14 +564,14 @@ }/* Handle the event (de)registration call and return negative error codes. */ -static int _do_event (int cmd,struct dm_event_daemon_message *msg, +static int _do_event (int cmd,char *dmeventd_path,struct dm_event_daemon_message *msg,const char *dso_name,const char *dev_name,enum dm_event_mask evmask,uint32_t timeout) {int ret;struct dm_event_fifos fifos; -if (!_init_client (&fifos)) { +if (!_init_client (dmeventd_path, &fifos)) { stack;return -ESRCH ; }
@@ -585,7 +605,7 @@ uuid =dm_task_get_uuid (dmt); -if ((err =_do_event (DM_EVENT_CMD_REGISTER_FOR_EVENT , &msg, +if ((err =_do_event (DM_EVENT_CMD_REGISTER_FOR_EVENT , dmevh->dmeventd_path, &msg, dmevh->dso, uuid, dmevh->mask, dmevh->timeout)) <0 ) { log_error("%s: event registration failed: %s", dm_task_get_name(dmt),
@@ -614,7 +634,7 @@ uuid =dm_task_get_uuid (dmt); -if ((err =_do_event (DM_EVENT_CMD_UNREGISTER_FOR_EVENT , &msg, +if ((err =_do_event (DM_EVENT_CMD_UNREGISTER_FOR_EVENT , dmevh->dmeventd_path, &msg, dmevh->dso, uuid, dmevh->mask, dmevh->timeout)) <0 ) { log_error("%s: event deregistration failed: %s", dm_task_get_name(dmt),
@@ -689,7 +709,7 @@ uuid =dm_task_get_uuid (dmt);if (!(ret =_do_event (next ?DM_EVENT_CMD_GET_NEXT_REGISTERED_DEVICE : -DM_EVENT_CMD_GET_REGISTERED_DEVICE , +DM_EVENT_CMD_GET_REGISTERED_DEVICE , dmevh->dmeventd_path, &msg, dmevh->dso, uuid, dmevh->mask,0 ))) {/* FIXME this will probably horribly break if we get ill-formatted reply */
daemons/dmeventd/libdevmapper-event.h +8 -3
@@ -55,13 +55,18 @@/* * Path of shared library to handle events. * -* All of dso, device_name and uuid strings are duplicated, you do not -* need to keep the pointers valid after the call succeeds. Thes may -* return -ENOMEM though. +* All of dmeventd, dso, device_name and uuid strings are duplicated so +* you do not need to keep the pointers valid after the call succeeds. +* They may return -ENOMEM though. */ int dm_event_handler_set_dso (struct dm_event_handler *dmevh,const char *path);/* +* Path of dmeventd binary. +*/ +int dm_event_handler_set_dmeventd_path (struct dm_event_handler *dmevh,const char *dmeventd_path); + +/* * Identify the device to monitor by exactly one of device_name, uuid or * device number. String arguments are duplicated, see above. */
doc/example.conf.in +7 -3
@@ -509,9 +509,13 @@ # snapshot_library is the library used when monitoring a snapshot device. # # "libdevmapper-event-lvm2snapshot.so" monitors the filling of - # snapshots and emits a warning through syslog, when the use of - # snapshot exceedes 80%. The warning is repeated when 85%, 90% and - # 95% of the snapshot are filled. + # snapshots and emits a warning through syslog when the use of + # the snapshot exceeds 80%. The warning is repeated when 85%, 90% and + # 95% of the snapshot is filled. snapshot_library = "libdevmapper-event-lvm2snapshot.so" + + # Full path of the dmeventd binary. + # + # executable = "@DMEVENTD_PATH@" }
lib/activate/activate.c +107 -0
119 lines not on this page · raw message
lib/activate/activate.h +9 -1
@@ -44,7 +44,7 @@int target_present (struct cmd_context *cmd,const char *target_name,int use_modprobe);int target_version (const char *target_name,uint32_t *maj, -uint32_t *min,uint32_t *patchlevel); +uint32_t *min,uint32_t *patchlevel);int list_segment_modules (struct dm_pool *mem,const struct lv_segment *seg,struct dm_list *modules); int list_lv_modules(struct dm_pool *mem, const struct logical_volume *lv,
@@ -102,6 +102,14 @@int monitor_dev_for_events (struct cmd_context *cmd,struct logical_volume *lv,int do_reg); +#ifdef DMEVENTD +# include "libdevmapper-event.h" +char *get_monitor_dso_path (struct cmd_context *cmd,const char *libpath); +int target_registered_with_dmeventd (struct cmd_context *cmd,const char *libpath,const char *lvid,int *pending); +int target_register_events (struct cmd_context *cmd,const char *dso,const char *lvid, +int evmask __attribute__((unused)),int set,int timeout); +#endif +/* * Returns 1 if PV has a dependency tree that uses anything in VG. */
lib/config/defaults.h +1 -0
@@ -48,6 +48,7 @@#define DEFAULT_MIRROR_IMAGE_FAULT_POLICY "remove"#define DEFAULT_MIRROR_MAX_IMAGES 8/* limited by kernel DM_KCOPYD_MAX_REGIONS */ #define DEFAULT_DMEVENTD_MIRROR_LIB "libdevmapper-event-lvm2mirror.so" +#define DEFAULT_DMEVENTD_SNAPSHOT_LIB "libdevmapper-event-lvm2snapshot.so"#define DEFAULT_DMEVENTD_MONITOR 1#define DEFAULT_BACKGROUND_POLLING 1
lib/mirror/mirrored.c +27 -119
186 lines not on this page · raw message
lib/misc/configure.h.in +6 -0
@@ -417,6 +417,9 @@ /* Define to 1 if you have the <utmpx.h> header file. */ #undef HAVE_UTMPX_H +/* Define to 1 if you have the <valgrind/memcheck.h> header file. */ +#undef HAVE_VALGRIND_MEMCHECK_H + /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK
@@ -522,6 +525,9 @@ /* Define to 1 to enable synchronisation with udev processing. */ #undef UDEV_SYNC_SUPPORT +/* Enable a valgrind aware build of pool */ +#undef VALGRIND_POOL + /* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>, <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the #define below would cause a syntax error. */
lib/snapshot/snapshot.c +11 -109
154 lines not on this page · raw message
tools/lvchange.c +1 -1
@@ -97,7 +97,7 @@if ((dmeventd_monitor_mode () !=DMEVENTD_MONITOR_IGNORE ) && !monitor_dev_for_events (cmd, lv,dmeventd_monitor_mode ())) - stack; + return_0;return 1 ; }
tools/vgchange.c +16 -15
@@ -15,14 +15,17 @@#include "tools.h" +/* +* Increments *count by the number of _new_ monitored devices. +*/ static int _monitor_lvs_in_vg (struct cmd_context *cmd, -struct volume_group *vg,int reg) +struct volume_group *vg,int reg,int *count) {struct lv_list *lvl;struct logical_volume *lv;struct lvinfo info;int lv_active; -int count =0 ; +int r =ECMD_PROCESSED ; dm_list_iterate_items(lvl, &vg->lvs) { lv = lvl->lv;
@@ -39,16 +42,13 @@continue ;if (!monitor_dev_for_events (cmd, lv, reg)) { + r =ECMD_FAILED ;continue ; }else - count++; + (*count)++; } -/* -* returns the number of _new_ monitored devices -*/ - -return count; +return r; } static int _poll_lvs_in_vg(struct cmd_context *cmd,
@@ -160,17 +160,18 @@static int _vgchange_monitoring (struct cmd_context *cmd,struct volume_group *vg) { -int monitored; +int ret_max =ECMD_PROCESSED ; +int monitored =0 ;if (lvs_in_vg_activated (vg) &&dmeventd_monitor_mode () !=DMEVENTD_MONITOR_IGNORE ) { - monitored =_monitor_lvs_in_vg (cmd, vg,dmeventd_monitor_mode ()); + ret_max =max (ret_max,_monitor_lvs_in_vg (cmd, vg,dmeventd_monitor_mode (), &monitored));log_print ("%d logical volume(s) in volume group " "\"%s\" %smonitored" , monitored, vg->name, (dmeventd_monitor_mode ()) ?"" :"un" ); } -return ECMD_PROCESSED ; +return ret_max; }static int _vgchange_background_polling (struct cmd_context *cmd,struct volume_group *vg)
@@ -190,7 +191,7 @@static int _vgchange_available (struct cmd_context *cmd,struct volume_group *vg) {int lv_open, active, monitored; -int available, ret; +int available, ret_max =ECMD_PROCESSED ;int activate =1 ;/*
@@ -219,7 +220,7 @@log_verbose ("%d logical volume(s) in volume group \"%s\" " "already active" , active, vg->name);if (dmeventd_monitor_mode () !=DMEVENTD_MONITOR_IGNORE ) { - monitored =_monitor_lvs_in_vg (cmd, vg,dmeventd_monitor_mode ()); + ret_max =max (ret_max,_monitor_lvs_in_vg (cmd, vg,dmeventd_monitor_mode (), &monitored)); log_verbose("%d existing logical volume(s) in volume " "group \"%s\" %smonitored", monitored, vg->name,
@@ -227,13 +228,13 @@ } } - ret =_activate_lvs_in_vg (cmd, vg, available); + ret_max =max (ret_max,_activate_lvs_in_vg (cmd, vg, available));/* Print message only if there was not found a missing VG */ if (!vg->cmd_missing_vgs)log_print ("%d logical volume(s) in volume group \"%s\" now active" ,lvs_in_vg_activated (vg), vg->name); -return ret; +return ret_max; }static int _vgchange_alloc (struct cmd_context *cmd,struct volume_group *vg)