diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index 9818846be..653e32d3a 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.110 - ====================================== + Add dm_hold_control_dev to allow holding of control device open. Add dm_report_compact_given_fields to remove given empty fields from report. Use libdm status parsing and local mem raid dmeventd plugin. Use local mem pool and lock only lvm2 execution for mirror dmeventd plugin. diff --git a/libdm/.exported_symbols.DM_1_02_110 b/libdm/.exported_symbols.DM_1_02_110 index 71d04a9e3..da742eef7 100644 --- a/libdm/.exported_symbols.DM_1_02_110 +++ b/libdm/.exported_symbols.DM_1_02_110 @@ -1 +1,2 @@ dm_report_compact_given_fields +dm_hold_control_dev diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c index e9566c202..58a8dfe51 100644 --- a/libdm/ioctl/libdm-iface.c +++ b/libdm/ioctl/libdm-iface.c @@ -81,6 +81,7 @@ static dm_bitset_t _dm_bitset = NULL; static uint32_t _dm_device_major = 0; static int _control_fd = -1; +static int _hold_control_fd_open = 0; static int _version_checked = 0; static int _version_ok = 1; static unsigned _ioctl_buffer_double_factor = 0; @@ -2079,9 +2080,18 @@ repeat_ioctl: return 0; } +void dm_hold_control_dev(int hold_open) +{ + _hold_control_fd_open = hold_open ? 1 : 0; + + log_debug("Hold of control device is now %sset.", + _hold_control_fd_open ? "" : "un"); +} + void dm_lib_release(void) { - _close_control_fd(); + if (!_hold_control_fd_open) + _close_control_fd(); dm_timestamp_destroy(_dm_ioctl_timestamp); _dm_ioctl_timestamp = NULL; update_devs(); diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h index fcbf7cf68..08b24feea 100644 --- a/libdm/libdevmapper.h +++ b/libdm/libdevmapper.h @@ -1168,6 +1168,9 @@ void dm_lib_init(void) __attribute__((constructor)); void dm_lib_release(void); void dm_lib_exit(void) __attribute__((destructor)); +/* An optimisation for clients making repeated calls involving dm ioctls */ +void dm_hold_control_dev(int hold_open); + /* * Use NULL for all devices. */