diff --git a/0001-RAID-Make-RAID-4-5-6-display-sync-status-under-headi.patch b/0001-RAID-Make-RAID-4-5-6-display-sync-status-under-headi.patch deleted file mode 100644 index 96d6c20..0000000 --- a/0001-RAID-Make-RAID-4-5-6-display-sync-status-under-headi.patch +++ /dev/null @@ -1,119 +0,0 @@ -From e1917809477c4850cc1094121001d61a2b70ef26 Mon Sep 17 00:00:00 2001 -From: Jonathan Brassow -Date: Tue, 23 Oct 2012 21:19:27 -0500 -Subject: [PATCH 1/1] RAID: Make RAID 4/5/6 display sync status under heading - s/Copy%/Cpy%Sync - -The heading 'Copy%' is specific to PVMOVE volumes, but can be generalized -to apply to LVM mirrors also. It is a bit awkward to use 'Copy%' for -RAID 4/5/6, however - 'Sync%' would be more appropriate. This is why -RAID 4/5/6 have not displayed their sync status by any means available to -'lvs' yet. - -Example (old): -[root@hayes-02 lvm2]# lvs vg - LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sy Convert - lv vg -wi-a---- 1.00g - raid1 vg rwi-a-r-- 1.00g 100.00 - raid4 vg rwi-a-r-- 1.01g - raid5 vg rwi-a-r-- 1.01g - raid6 vg rwi-a-r-- 1.01g - -This patch changes the heading to 'Cpy%Sync' and allows RAID 4/5/6 to print -their sync percent in this field. - -Example (new): -[root@hayes-02 lvm2]# lvs vg - LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert - lv vg -wi-a---- 1.00g - raid1 vg rwi-a-r-- 1.00g 100.00 - raid4 vg rwi-a-r-- 1.01g 100.00 - raid5 vg rwi-a-r-- 1.01g 100.00 - raid6 vg rwi-a-r-- 1.01g 100.00 ---- - lib/report/columns.h | 3 ++- - lib/report/properties.c | 2 ++ - lib/report/report.c | 20 +++++++++++++------- - man/lvs.8.in | 1 + - 4 files changed, 18 insertions(+), 8 deletions(-) - -diff --git a/lib/report/columns.h b/lib/report/columns.h -index 6299a2b..c83a086 100644 ---- a/lib/report/columns.h -+++ b/lib/report/columns.h -@@ -78,7 +78,8 @@ FIELD(LVS, lv, NUM, "OSize", lvid, 5, originsize, origin_size, "For snapshots, t - FIELD(LVS, lv, NUM, "Data%", lvid, 6, datapercent, data_percent, "For snapshot and thin pools and volumes, the percentage full if LV is active.", 0) - FIELD(LVS, lv, NUM, "Snap%", lvid, 6, snpercent, snap_percent, "For snapshots, the percentage full if LV is active.", 0) - FIELD(LVS, lv, NUM, "Meta%", lvid, 6, metadatapercent, metadata_percent, "For thin pools, the percentage of metadata full if LV is active.", 0) --FIELD(LVS, lv, NUM, "Copy%", lvid, 6, copypercent, copy_percent, "For mirrors and pvmove, current percentage in-sync.", 0) -+FIELD(LVS, lv, NUM, "Cpy%Sync", lvid, 8, copypercent, copy_percent, "For RAID, mirrors and pvmove, current percentage in-sync.", 0) -+FIELD(LVS, lv, NUM, "Cpy%Sync", lvid, 8, copypercent, sync_percent, "For RAID, mirrors and pvmove, current percentage in-sync.", 0) - FIELD(LVS, lv, STR, "Move", lvid, 4, movepv, move_pv, "For pvmove, Source PV of temporary LV created by pvmove.", 0) - FIELD(LVS, lv, STR, "Convert", lvid, 7, convertlv, convert_lv, "For lvconvert, Name of temporary LV created by lvconvert.", 0) - FIELD(LVS, lv, STR, "Log", lvid, 3, loglv, mirror_log, "For mirrors, the LV holding the synchronisation log.", 0) -diff --git a/lib/report/properties.c b/lib/report/properties.c -index c4f6ab9..fe197f5 100644 ---- a/lib/report/properties.c -+++ b/lib/report/properties.c -@@ -189,6 +189,8 @@ GET_LV_NUM_PROPERTY_FN(snap_percent, _snap_percent(lv)) - #define _snap_percent_set _not_implemented_set - GET_LV_NUM_PROPERTY_FN(copy_percent, _copy_percent(lv)) - #define _copy_percent_set _not_implemented_set -+GET_LV_NUM_PROPERTY_FN(sync_percent, _copy_percent(lv)) -+#define _sync_percent_set _not_implemented_set - GET_LV_STR_PROPERTY_FN(move_pv, lv_move_pv_dup(lv->vg->vgmem, lv)) - #define _move_pv_set _not_implemented_set - GET_LV_STR_PROPERTY_FN(convert_lv, lv_convert_lv_dup(lv->vg->vgmem, lv)) -diff --git a/lib/report/report.c b/lib/report/report.c -index b1e2bc1..1833458 100644 ---- a/lib/report/report.c -+++ b/lib/report/report.c -@@ -898,13 +898,14 @@ static int _copypercent_disp(struct dm_report *rh __attribute__((unused)), - return 0; - } - -- if ((!(lv->status & PVMOVE) && !(lv->status & MIRRORED)) || -- !lv_mirror_percent(lv->vg->cmd, lv, 0, &percent, -- NULL) || (percent == PERCENT_INVALID)) { -- *sortval = UINT64_C(0); -- dm_report_field_set_value(field, "", sortval); -- return 1; -- } -+ if (lv->status & RAID) { -+ if (!lv_raid_percent(lv, &percent) || -+ (percent == PERCENT_INVALID)) -+ goto no_copypercent; -+ } else if ((!(lv->status & PVMOVE) && !(lv->status & MIRRORED)) || -+ !lv_mirror_percent(lv->vg->cmd, lv, 0, &percent, NULL) || -+ (percent == PERCENT_INVALID)) -+ goto no_copypercent; - - percent = copy_percent(lv); - -@@ -922,6 +923,11 @@ static int _copypercent_disp(struct dm_report *rh __attribute__((unused)), - dm_report_field_set_value(field, repstr, sortval); - - return 1; -+ -+no_copypercent: -+ *sortval = UINT64_C(0); -+ dm_report_field_set_value(field, "", sortval); -+ return 1; - } - - static int _dtpercent_disp(int metadata, struct dm_report *rh, -diff --git a/man/lvs.8.in b/man/lvs.8.in -index f31256c..d4d77b0 100644 ---- a/man/lvs.8.in -+++ b/man/lvs.8.in -@@ -113,6 +113,7 @@ seg_tags, - snap_percent, - stripes, - stripe_size, -+sync_percent, - thin_count, - transaction_id, - zero. --- -1.9.0 - diff --git a/0001-clvmd-avoid-logging-in-signal-handler.patch b/0001-clvmd-avoid-logging-in-signal-handler.patch deleted file mode 100644 index b7c64bc..0000000 --- a/0001-clvmd-avoid-logging-in-signal-handler.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 5070ffbca7b16e4139b3da72bdff0c9add517351 Mon Sep 17 00:00:00 2001 -From: Zdenek Kabelac -Date: Wed, 17 Apr 2013 23:16:30 +0200 -Subject: [PATCH] clvmd: avoid logging in signal handler - -debuglog in the main thread. ---- - daemons/clvmd/clvmd.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c -index c649bbe..a64bd54 100644 ---- a/daemons/clvmd/clvmd.c -+++ b/daemons/clvmd/clvmd.c -@@ -874,6 +874,7 @@ static void main_loop(int local_sock, int cmd_timeout) - int saved_errno = errno; - - reread_config = 0; -+ DEBUGLOG("got SIGHUP\n"); - if (clops->reread_config) - clops->reread_config(); - errno = saved_errno; -@@ -982,6 +983,8 @@ static void main_loop(int local_sock, int cmd_timeout) - - closedown: - clops->cluster_closedown(); -+ if (quit) -+ DEBUGLOG("SIGTERM received\n"); - } - - static __attribute__ ((noreturn)) void wait_for_child(int c_pipe, int timeout) -@@ -2253,14 +2256,12 @@ static void sigusr2_handler(int sig) - - static void sigterm_handler(int sig) - { -- DEBUGLOG("SIGTERM received\n"); - quit = 1; - return; - } - - static void sighup_handler(int sig) - { -- DEBUGLOG("got SIGHUP\n"); - reread_config = 1; - } - --- -1.8.4.5 - diff --git a/0001-lvmetad-Init-lazily-to-avoid-socket-access-on-config.patch b/0001-lvmetad-Init-lazily-to-avoid-socket-access-on-config.patch deleted file mode 100644 index bd5263d..0000000 --- a/0001-lvmetad-Init-lazily-to-avoid-socket-access-on-config.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 983f0b46f2de85b8de0e2d7f8afbdf53f132a87a Mon Sep 17 00:00:00 2001 -From: Petr Rockai -Date: Mon, 29 Oct 2012 21:39:46 +0100 -Subject: [PATCH] lvmetad: Init lazily, to avoid socket access on config - overrides. - -Signed-off-by: Andrey Borzenkov ---- - lib/cache/lvmetad.c | 28 ++++++++++++++++++++++------ - 1 file changed, 22 insertions(+), 6 deletions(-) - -diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c -index 6a374ac..72e07fd 100644 ---- a/lib/cache/lvmetad.c -+++ b/lib/cache/lvmetad.c -@@ -33,7 +33,8 @@ static struct cmd_context *_lvmetad_cmd = NULL; - - void lvmetad_disconnect(void) - { -- daemon_close(_lvmetad); -+ if (_lvmetad_connected) -+ daemon_close(_lvmetad); - _lvmetad_connected = 0; - _lvmetad_cmd = NULL; - } -@@ -41,19 +42,25 @@ void lvmetad_disconnect(void) - void lvmetad_init(struct cmd_context *cmd) - { - if (!_lvmetad_use && !access(LVMETAD_PIDFILE, F_OK)) -- log_warn("WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!"); -+ log_warn("WARNING: lvmetad is running but disabled." -+ " Restart lvmetad before enabling it!"); -+ _lvmetad_cmd = cmd; -+} -+ -+static void _lvmetad_connect() -+{ - if (_lvmetad_use && _lvmetad_socket && !_lvmetad_connected) { - assert(_lvmetad_socket); - _lvmetad = lvmetad_open(_lvmetad_socket); -- if (_lvmetad.socket_fd >= 0 && !_lvmetad.error) { -+ if (_lvmetad.socket_fd >= 0 && !_lvmetad.error) - _lvmetad_connected = 1; -- _lvmetad_cmd = cmd; -- } - } - } - - void lvmetad_warning(void) - { -+ if (!_lvmetad_connected) -+ _lvmetad_connect(); - if (_lvmetad_use && (_lvmetad.socket_fd < 0 || _lvmetad.error)) - log_warn("WARNING: Failed to connect to lvmetad: %s. Falling back to internal scanning.", - strerror(_lvmetad.error)); -@@ -61,7 +68,11 @@ void lvmetad_warning(void) - - int lvmetad_active(void) - { -- return _lvmetad_use && _lvmetad_connected; -+ if (!_lvmetad_use) -+ return 0; -+ if (!_lvmetad_connected) -+ _lvmetad_connect(); -+ return _lvmetad_connected; - } - - void lvmetad_set_active(int active) -@@ -873,6 +884,11 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, activation_handler handler) - char *future_token; - int was_silent; - -+ if (!lvmetad_active()) { -+ log_error("Cannot proceed since lvmetad is not active."); -+ return 0; -+ } -+ - if (!(iter = dev_iter_create(cmd->lvmetad_filter, 1))) { - log_error("dev_iter creation failed"); - return 0; --- -1.8.4.5 - diff --git a/0001-toolcontext-Only-reopen-stdin-if-readable.patch b/0001-toolcontext-Only-reopen-stdin-if-readable.patch deleted file mode 100644 index ac43a67..0000000 --- a/0001-toolcontext-Only-reopen-stdin-if-readable.patch +++ /dev/null @@ -1,65 +0,0 @@ -Index: LVM2.2.02.98/lib/commands/toolcontext.c -=================================================================== ---- LVM2.2.02.98.orig/lib/commands/toolcontext.c 2014-04-14 14:06:23.245391597 +0800 -+++ LVM2.2.02.98/lib/commands/toolcontext.c 2014-04-14 14:06:47.761421565 +0800 -@@ -1315,6 +1315,7 @@ struct cmd_context *create_toolcontext(u - { - struct cmd_context *cmd; - FILE *new_stream; -+ int flags; - - #ifdef M_MMAP_MAX - mallopt(M_MMAP_MAX, 0); -@@ -1358,7 +1359,10 @@ struct cmd_context *create_toolcontext(u - goto out; - } - -- if (is_valid_fd(STDIN_FILENO)) { -+ /* nohup might set stdin O_WRONLY ! */ -+ if (is_valid_fd(STDIN_FILENO) && -+ ((flags = fcntl(STDIN_FILENO, F_GETFL)) > 0) && -+ (flags & O_ACCMODE) != O_WRONLY) { - if (!_reopen_stream(stdin, STDIN_FILENO, "r", "stdin", &new_stream)) - goto_out; - stdin = new_stream; -@@ -1368,7 +1372,9 @@ struct cmd_context *create_toolcontext(u - } - } - -- if (is_valid_fd(STDOUT_FILENO)) { -+ if (is_valid_fd(STDOUT_FILENO) && -+ ((flags = fcntl(STDOUT_FILENO, F_GETFL)) > 0) && -+ (flags & O_ACCMODE) != O_RDONLY) { - if (!_reopen_stream(stdout, STDOUT_FILENO, "w", "stdout", &new_stream)) - goto_out; - stdout = new_stream; -@@ -1629,6 +1635,7 @@ void destroy_toolcontext(struct cmd_cont - { - struct dm_config_tree *cft_cmdline; - FILE *new_stream; -+ int flags; - - if (cmd->dump_filter) - persistent_filter_dump(cmd->filter, 1); -@@ -1654,7 +1661,9 @@ void destroy_toolcontext(struct cmd_cont - #ifndef VALGRIND_POOL - if (cmd->linebuffer) { - /* Reset stream buffering to defaults */ -- if (is_valid_fd(STDIN_FILENO)) { -+ if (is_valid_fd(STDIN_FILENO) && -+ ((flags = fcntl(STDIN_FILENO, F_GETFL)) > 0) && -+ (flags & O_ACCMODE) != O_WRONLY) { - if (_reopen_stream(stdin, STDIN_FILENO, "r", "stdin", &new_stream)) { - stdin = new_stream; - setlinebuf(stdin); -@@ -1662,7 +1671,9 @@ void destroy_toolcontext(struct cmd_cont - cmd->linebuffer = NULL; /* Leave buffer in place (deliberate leak) */ - } - -- if (is_valid_fd(STDOUT_FILENO)) { -+ if (is_valid_fd(STDOUT_FILENO) && -+ ((flags = fcntl(STDOUT_FILENO, F_GETFL)) > 0) && -+ (flags & O_ACCMODE) != O_RDONLY) { - if (_reopen_stream(stdout, STDOUT_FILENO, "w", "stdout", &new_stream)) { - stdout = new_stream; - setlinebuf(stdout); diff --git a/LVM2.2.02.111.tgz b/LVM2.2.02.111.tgz new file mode 100644 index 0000000..edc8d6d --- /dev/null +++ b/LVM2.2.02.111.tgz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6d8f3e72fe07f614315d8e0c2d9f93c5fc7a4360d14e4f9b805750e21593dd24 +size 1487810 diff --git a/LVM2.2.02.111.tgz.asc b/LVM2.2.02.111.tgz.asc new file mode 100644 index 0000000..a019d9c --- /dev/null +++ b/LVM2.2.02.111.tgz.asc @@ -0,0 +1,7 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2.0.14 (GNU/Linux) + +iEYEABECAAYFAlQDxEEACgkQIoGRwVZ+LBdgbACfRZSdijneiht0fIZCLz3BhpGn +BXIAoIshSUrdKDUuNd94SIeAtZVbmVpi +=w0Qo +-----END PGP SIGNATURE----- diff --git a/LVM2.2.02.98.tgz b/LVM2.2.02.98.tgz deleted file mode 100644 index 70a61c8..0000000 --- a/LVM2.2.02.98.tgz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:71030a58fef7e00d82ca4144334548e46aad24551a3cfbe7c3059b1bd137d864 -size 1227919 diff --git a/LVM2.2.02.98.tgz.asc b/LVM2.2.02.98.tgz.asc deleted file mode 100644 index 6833858..0000000 --- a/LVM2.2.02.98.tgz.asc +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.11 (GNU/Linux) - -iEYEABECAAYFAlB8HicACgkQIoGRwVZ+LBd+mwCg2X9MFz3iFlnARwxVgNBCWgYY -KHYAn1fgrjMIeoQaKUEDjMrhvapj9wOK -=/QEd ------END PGP SIGNATURE----- diff --git a/add_scm_support.patch b/add_scm_support.patch deleted file mode 100644 index a9d849f..0000000 --- a/add_scm_support.patch +++ /dev/null @@ -1,24 +0,0 @@ -filters: add scm devices - -Fix this: -pvcreate /dev/scma - Device /dev/scma not found (or ignored by filtering). - -Upstream via: - 9602e68 filters: add scm devices - -Signed-off-by: Sebastian Ott ---- - lib/filters/device-types.h | 1 + - 1 file changed, 1 insertion(+) - ---- a/lib/filters/device-types.h -+++ b/lib/filters/device-types.h -@@ -56,5 +56,6 @@ static const device_info_t _device_info[ - {"blkext", 1}, /* Extended device partitions */ - {"fio", 16}, /* Fusion */ - {"mtip32xx", 16}, /* Micron PCIe SSDs */ -+ {"scm", 8}, /* Storage Class Memory (IBM S/390) */ - {"", 0} - }; - diff --git a/avoid_reading_failed_dev_in_mirrored_log.diff b/avoid_reading_failed_dev_in_mirrored_log.diff deleted file mode 100644 index 3e41af8..0000000 --- a/avoid_reading_failed_dev_in_mirrored_log.diff +++ /dev/null @@ -1,144 +0,0 @@ -commit b248ba0a396d7fc9a459eea02cfdc70b33ce3441 -Author: Jonathan Brassow -Date: Thu Oct 25 00:42:45 2012 -0500 - - mirror: Avoid reading mirrors with failed devices in mirrored log - - Commit 9fd7ac7d035f0b2f8dcc3cb19935eb181816bd76 did not handle mirrors - that contained mirrored logs. This is because the status line of the - mirror does not give an indication of the health of the mirrored log, - as you can see here: - [root@bp-01 lvm2]# dmsetup status vg-lv vg-lv_mlog - vg-lv: 0 409600 mirror 2 253:6 253:7 400/400 1 AA 3 disk 253:5 A - vg-lv_mlog: 0 8192 mirror 2 253:3 253:4 7/8 1 AD 1 core - Thus, the possibility for LVM commands to hang still persists when mirror - have mirrored logs. I discovered this while performing some testing that - does polling with 'pvs' while doing I/O and killing devices. The 'pvs' - managed to get between the mirrored log device failure and the attempt - by dmeventd to repair it. The result was a very nasty block in LVM - commands that is very difficult to remove - even for someone who knows - what is going on. Thus, it is absolutely essential that the log of a - mirror be recursively checked for mirror devices which may be failed - as well. - - Despite what the code comment says in the aforementioned commit... - + * _mirrored_transient_status(). FIXME: It is unable to handle mirrors - + * with mirrored logs because it does not have a way to get the status of - + * the mirror that forms the log, which could be blocked. - ... it is possible to get the status of the log because the log device - major/minor is given to us by the status output of the top-level mirror. - We can use that to query the log device for any DM status and see if it - is a mirror that needs to be bypassed. This patch does just that and is - now able to avoid reading from mirrors that have failed devices in a - mirrored log. - -diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c -index 6cc57d0..40f719e 100644 ---- a/lib/activate/dev_manager.c -+++ b/lib/activate/dev_manager.c -@@ -139,6 +139,7 @@ static int _info_run(const char *name, const char *dlid, struct dm_info *info, - * _parse_mirror_status - * @mirror_status_string - * @image_health: return for allocated copy of image health characters -+ * @log_device: return for 'dev_t' of log device - * @log_health: NULL if corelog, otherwise alloc'ed log health char - * - * This function takes the mirror status string, breaks it up and returns -@@ -149,8 +150,10 @@ static int _info_run(const char *name, const char *dlid, struct dm_info *info, - * Returns: 1 on success, 0 on failure - */ - static int _parse_mirror_status(char *mirror_status_str, -- char **images_health, char **log_health) -+ char **images_health, -+ dev_t *log_dev, char **log_health) - { -+ int major, minor; - char *p = NULL; - char **args, **log_args; - unsigned num_devs, log_argc; -@@ -174,10 +177,14 @@ static int _parse_mirror_status(char *mirror_status_str, - return_0; - - *log_health = NULL; -- if (!strcmp(log_args[0], "disk") && -- !(*log_health = dm_strdup(log_args[2]))) -- return_0; -- -+ *log_dev = 0; -+ if (!strcmp(log_args[0], "disk")) { -+ if (!(*log_health = dm_strdup(log_args[2]))) -+ return_0; -+ if (sscanf(log_args[1], "%d:%d", &major, &minor) != 2) -+ return_0; -+ *log_dev = MKDEV((dev_t)major, minor); -+ } - if (!(*images_health = dm_strdup(args[2 + num_devs]))) - return_0; - -@@ -199,9 +206,7 @@ static int _parse_mirror_status(char *mirror_status_str, - * attempting to read a mirror, a circular dependency would be created.) - * - * This function is a slimmed-down version of lib/mirror/mirrored.c: -- * _mirrored_transient_status(). FIXME: It is unable to handle mirrors -- * with mirrored logs because it does not have a way to get the status of -- * the mirror that forms the log, which could be blocked. -+ * _mirrored_transient_status(). - * - * If a failed device is detected in the status string, then it must be - * determined if 'block_on_error' or 'handle_errors' was used when -@@ -217,23 +222,17 @@ static int _ignore_blocked_mirror_devices(struct device *dev, - char *mirror_status_str) - { - unsigned i, check_for_blocking = 0; -+ dev_t log_dev; - char *images_health, *log_health; -- - uint64_t s,l; - char *params, *target_type = NULL; - void *next = NULL; - struct dm_task *dmt; - - if (!_parse_mirror_status(mirror_status_str, -- &images_health, &log_health)) -+ &images_health, &log_dev, &log_health)) - goto_out; - -- if (log_health && (log_health[0] != 'A')) { -- log_debug("%s: Mirror log device marked as failed", -- dev_name(dev)); -- check_for_blocking = 1; -- } -- - for (i = 0; images_health[i]; i++) - if (images_health[i] != 'A') { - log_debug("%s: Mirror image %d marked as failed", -@@ -241,6 +240,29 @@ static int _ignore_blocked_mirror_devices(struct device *dev, - check_for_blocking = 1; - } - -+ if (!check_for_blocking && log_dev) { -+ if (log_health[0] != 'A') { -+ log_debug("%s: Mirror log device marked as failed", -+ dev_name(dev)); -+ check_for_blocking = 1; -+ } else { -+ struct device *tmp_dev; -+ char buf[16]; -+ -+ if (dm_snprintf(buf, sizeof(buf), "%d:%d", -+ (int)MAJOR(log_dev), -+ (int)MINOR(log_dev)) < 0) -+ goto_out; -+ -+ if (!(tmp_dev = dev_create_file(buf, NULL, NULL, 1))) -+ goto_out; -+ -+ tmp_dev->dev = log_dev; -+ if (!device_is_usable(tmp_dev)) -+ goto_out; -+ } -+ } -+ - if (!check_for_blocking) - return 0; - diff --git a/clmvd-fix-decriptor-leak-on-restart.patch b/clmvd-fix-decriptor-leak-on-restart.patch deleted file mode 100644 index 9398661..0000000 --- a/clmvd-fix-decriptor-leak-on-restart.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 7b1315411f1de73801fd38f264ca507ae3807e53 Mon Sep 17 00:00:00 2001 -From: Zdenek Kabelac -Date: Tue, 6 Aug 2013 16:07:50 +0200 -Subject: [PATCH] clmvd: fix decriptor leak on restart - -Do not leave descriptor used for dup2() openned. ---- - daemons/clvmd/clvmd.c | 4 ++++ - 2 files changed, 5 insertions(+) - -diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c -index f05776f..eaa75ca 100644 ---- a/daemons/clvmd/clvmd.c -+++ b/daemons/clvmd/clvmd.c -@@ -1085,6 +1085,10 @@ static void be_daemon(int timeout) - log_error("Error setting terminal FDs to /dev/null: %m"); - exit(5); - } -+ if ((devnull > STDERR_FILENO) && close(devnull)) { -+ log_sys_error("close", "/dev/null"); -+ exit(7); -+ } - if (chdir("/")) { - log_error("Error setting current directory to /: %m"); - exit(6); --- -1.8.4.5 - diff --git a/cluster_support_mirrord_log.diff b/cluster_support_mirrord_log.diff index 217b78a..bbf49a6 100644 --- a/cluster_support_mirrord_log.diff +++ b/cluster_support_mirrord_log.diff @@ -1,7 +1,27 @@ -Index: LVM2.2.02.98/daemons/cmirrord/cluster.c -=================================================================== ---- LVM2.2.02.98.orig/daemons/cmirrord/cluster.c -+++ LVM2.2.02.98/daemons/cmirrord/cluster.c +Subject: Parallelize dispatching +--- + daemons/cmirrord/Makefile.in | 2 + daemons/cmirrord/cluster.c | 110 +++++++++++++++++++++++++++---------------- + daemons/cmirrord/functions.c | 37 ++++++++++++-- + daemons/cmirrord/local.c | 3 - + lib/metadata/mirror.c | 24 --------- + lib/mirror/mirrored.c | 5 + + tools/lvconvert.c | 9 --- + 7 files changed, 109 insertions(+), 81 deletions(-) + +--- a/daemons/cmirrord/Makefile.in ++++ b/daemons/cmirrord/Makefile.in +@@ -26,7 +26,7 @@ TARGETS = cmirrord + + include $(top_builddir)/make.tmpl + +-LIBS += -ldevmapper ++LIBS += -ldevmapper -lpthread + LMLIBS += $(CPG_LIBS) $(SACKPT_LIBS) + CFLAGS += $(CPG_CFLAGS) $(SACKPT_CFLAGS) $(EXTRA_EXEC_CFLAGS) + LDFLAGS += $(EXTRA_EXEC_LDFLAGS) +--- a/daemons/cmirrord/cluster.c ++++ b/daemons/cmirrord/cluster.c @@ -22,6 +22,7 @@ #include #include @@ -10,7 +30,7 @@ Index: LVM2.2.02.98/daemons/cmirrord/cluster.c #if CMIRROR_HAS_CHECKPOINT #include #include -@@ -118,9 +119,11 @@ struct clog_cpg { +@@ -151,9 +152,11 @@ struct clog_cpg { struct checkpoint_data *checkpoint_list; int idx; char debugging[DEBUGGING_HISTORY][128]; @@ -18,11 +38,11 @@ Index: LVM2.2.02.98/daemons/cmirrord/cluster.c }; static struct dm_list clog_cpg_list; -+static pthread_rwlock_t clog_cpg_lock =PTHREAD_RWLOCK_INITIALIZER; ++static pthread_rwlock_t clog_cpg_lock = PTHREAD_RWLOCK_INITIALIZER; /* * cluster_send -@@ -135,12 +138,14 @@ int cluster_send(struct clog_request *rq +@@ -168,12 +171,14 @@ int cluster_send(struct clog_request *rq struct iovec iov; struct clog_cpg *entry; @@ -37,7 +57,7 @@ Index: LVM2.2.02.98/daemons/cmirrord/cluster.c if (!found) { rq->u_rq.error = -ENOENT; -@@ -221,11 +226,11 @@ static struct clog_request *get_matching +@@ -254,11 +259,11 @@ static struct clog_request *get_matching return NULL; } @@ -50,7 +70,7 @@ Index: LVM2.2.02.98/daemons/cmirrord/cluster.c struct clog_request *tmp = (struct clog_request *)rq_buffer; /* -@@ -332,9 +337,13 @@ static struct clog_cpg *find_clog_cpg(cp +@@ -369,9 +374,13 @@ static struct clog_cpg *find_clog_cpg(cp { struct clog_cpg *match; @@ -65,7 +85,7 @@ Index: LVM2.2.02.98/daemons/cmirrord/cluster.c return NULL; } -@@ -939,28 +948,17 @@ static int resend_requests(struct clog_c +@@ -981,34 +990,21 @@ static int resend_requests(struct clog_c return r; } @@ -77,8 +97,16 @@ Index: LVM2.2.02.98/daemons/cmirrord/cluster.c - - dm_list_iterate_items_safe(entry, tmp, &clog_cpg_list) { - r = cpg_dispatch(entry->handle, CS_DISPATCH_ALL); -- if (r != CS_OK) -- LOG_ERROR("cpg_dispatch failed: %d", r); +- if (r != CS_OK) { +- if ((r == CS_ERR_BAD_HANDLE) && +- ((entry->state == INVALID) || +- (entry->state == LEAVING))) +- /* It's ok if we've left the cluster */ +- r = CS_OK; +- else +- LOG_ERROR("cpg_dispatch failed: %s", +- str_ais_error(r)); +- } - - if (entry->free_me) { - free(entry); @@ -87,30 +115,35 @@ Index: LVM2.2.02.98/daemons/cmirrord/cluster.c - do_checkpoints(entry, 0); - - resend_requests(entry); -- } -+ struct clog_cpg * match = data; -+ r = cpg_dispatch (match->handle, CS_DISPATCH_BLOCKING); -+ if (r != CS_OK) -+ LOG_DBG("cpg_dispatch failed"); - ++ struct clog_cpg *match = data; ++ r = cpg_dispatch(match->handle, CS_DISPATCH_BLOCKING); ++ if (r != CS_OK) { ++ if ((r == CS_ERR_BAD_HANDLE) && ++ ((match->state == INVALID) || ++ (match->state == LEAVING))) ++ /* It's ok if we've left the cluster */ ++ r = CS_OK; ++ else ++ LOG_ERROR("cpg_dispatch failed: %s", ++ str_ais_error(r)); + } +- - return (r == CS_OK) ? 0 : -1; /* FIXME: good error number? */ } -+ static int flush_startup_list(struct clog_cpg *entry) - { - int r = 0; -@@ -1011,23 +1009,35 @@ static int flush_startup_list(struct clo +@@ -1061,23 +1057,37 @@ static int flush_startup_list(struct clo return 0; } -+static void do_cpg_message_callback(struct clog_cpg * match , uint32_t nodeid, void *msg, size_t msg_len); ++static void do_cpg_message_callback(struct clog_cpg *match, uint32_t nodeid, ++ void *msg, size_t msg_len); + static void cpg_message_callback(cpg_handle_t handle, const struct cpg_name *gname __attribute__((unused)), uint32_t nodeid, uint32_t pid __attribute__((unused)), void *msg, size_t msg_len) { -+ struct clog_cpg * entry; ++ struct clog_cpg *entry; + + entry = find_clog_cpg(handle); + if (!entry) { @@ -124,14 +157,15 @@ Index: LVM2.2.02.98/daemons/cmirrord/cluster.c + +} + -+static void do_cpg_message_callback(struct clog_cpg * match , uint32_t nodeid, void *msg, size_t msg_len) ++static void do_cpg_message_callback(struct clog_cpg *match, uint32_t nodeid, ++ void *msg, size_t msg_len) +{ int i; int r = 0; int i_am_server; int response = 0; struct clog_request *rq = msg; - struct clog_request *tmp_rq; + struct clog_request *tmp_rq, *tmp_rq2; - struct clog_cpg *match; - match = find_clog_cpg(handle); @@ -142,7 +176,7 @@ Index: LVM2.2.02.98/daemons/cmirrord/cluster.c /* * Perform necessary endian and version compatibility conversions -@@ -1324,7 +1334,7 @@ static void cpg_leave_callback(struct cl +@@ -1373,7 +1383,7 @@ static void cpg_leave_callback(struct cl size_t member_list_entries) { unsigned i; @@ -151,7 +185,7 @@ Index: LVM2.2.02.98/daemons/cmirrord/cluster.c uint32_t lowest = match->lowest_id; struct clog_request *rq, *n; struct checkpoint_data *p_cp, *c_cp; -@@ -1335,10 +1345,9 @@ static void cpg_leave_callback(struct cl +@@ -1384,10 +1394,9 @@ static void cpg_leave_callback(struct cl /* Am I leaving? */ if (my_cluster_id == left->nodeid) { LOG_DBG("Finalizing leave..."); @@ -164,7 +198,7 @@ Index: LVM2.2.02.98/daemons/cmirrord/cluster.c cluster_postsuspend(match->name.value, match->luid); -@@ -1466,11 +1475,13 @@ static void cpg_config_callback(cpg_hand +@@ -1515,11 +1524,13 @@ static void cpg_config_callback(cpg_hand struct clog_cpg *match; int found = 0; @@ -178,7 +212,7 @@ Index: LVM2.2.02.98/daemons/cmirrord/cluster.c if (!found) { LOG_ERROR("Unable to find match for CPG config callback"); -@@ -1487,6 +1498,16 @@ static void cpg_config_callback(cpg_hand +@@ -1536,6 +1547,16 @@ static void cpg_config_callback(cpg_hand else cpg_leave_callback(match, left_list, member_list, member_list_entries); @@ -195,7 +229,7 @@ Index: LVM2.2.02.98/daemons/cmirrord/cluster.c } cpg_callbacks_t cpg_callbacks = { -@@ -1554,12 +1575,16 @@ int create_cluster_cpg(char *uuid, uint6 +@@ -1603,12 +1624,16 @@ int create_cluster_cpg(char *uuid, uint6 size_t size; struct clog_cpg *new = NULL; struct clog_cpg *tmp; @@ -212,7 +246,7 @@ Index: LVM2.2.02.98/daemons/cmirrord/cluster.c new = malloc(sizeof(*new)); if (!new) { -@@ -1601,13 +1626,16 @@ int create_cluster_cpg(char *uuid, uint6 +@@ -1650,13 +1675,16 @@ int create_cluster_cpg(char *uuid, uint6 } new->cpg_state = VALID; @@ -232,7 +266,7 @@ Index: LVM2.2.02.98/daemons/cmirrord/cluster.c return 0; } -@@ -1676,9 +1704,11 @@ int destroy_cluster_cpg(char *uuid) +@@ -1725,9 +1753,11 @@ int destroy_cluster_cpg(char *uuid) { struct clog_cpg *del, *tmp; @@ -244,10 +278,8 @@ Index: LVM2.2.02.98/daemons/cmirrord/cluster.c return 0; } -Index: LVM2.2.02.98/daemons/cmirrord/functions.c -=================================================================== ---- LVM2.2.02.98.orig/daemons/cmirrord/functions.c -+++ LVM2.2.02.98/daemons/cmirrord/functions.c +--- a/daemons/cmirrord/functions.c ++++ b/daemons/cmirrord/functions.c @@ -19,6 +19,7 @@ #include #include @@ -299,7 +331,7 @@ Index: LVM2.2.02.98/daemons/cmirrord/functions.c return NULL; } -@@ -517,7 +529,9 @@ static int _clog_ctr(char *uuid, uint64_ +@@ -519,7 +531,9 @@ static int _clog_ctr(char *uuid, uint64_ LOG_DBG("Disk log ready"); } @@ -309,7 +341,7 @@ Index: LVM2.2.02.98/daemons/cmirrord/functions.c return 0; fail: -@@ -641,7 +655,10 @@ static int clog_dtr(struct dm_ulog_reque +@@ -643,7 +657,10 @@ static int clog_dtr(struct dm_ulog_reque LOG_DBG("[%s] Cluster log removed", SHORT_UUID(lc->uuid)); @@ -320,7 +352,7 @@ Index: LVM2.2.02.98/daemons/cmirrord/functions.c if (lc->disk_fd != -1 && close(lc->disk_fd)) LOG_ERROR("Failed to close disk log: %s", strerror(errno)); -@@ -713,8 +730,13 @@ int cluster_postsuspend(char *uuid, uint +@@ -715,8 +732,13 @@ int cluster_postsuspend(char *uuid, uint lc->resume_override = 0; /* move log to pending list */ @@ -334,7 +366,7 @@ Index: LVM2.2.02.98/daemons/cmirrord/functions.c return 0; } -@@ -818,9 +840,9 @@ no_disk: +@@ -820,9 +842,9 @@ no_disk: if (commit_log && (lc->disk_fd >= 0)) { rq->error = write_log(lc); if (rq->error) @@ -346,7 +378,7 @@ Index: LVM2.2.02.98/daemons/cmirrord/functions.c lc->touched = 0; } out: -@@ -902,8 +924,13 @@ int local_resume(struct dm_ulog_request +@@ -904,8 +926,13 @@ int local_resume(struct dm_ulog_request } /* move log to official list */ @@ -360,7 +392,7 @@ Index: LVM2.2.02.98/daemons/cmirrord/functions.c } return 0; -@@ -1910,7 +1937,6 @@ void log_debug(void) +@@ -1928,7 +1955,6 @@ void log_debug(void) LOG_ERROR(""); LOG_ERROR("LOG COMPONENT DEBUGGING::"); @@ -368,7 +400,7 @@ Index: LVM2.2.02.98/daemons/cmirrord/functions.c LOG_ERROR("Pending log list:"); dm_list_iterate_items(lc, &log_pending_list) { LOG_ERROR("%s", lc->uuid); -@@ -1920,6 +1946,7 @@ void log_debug(void) +@@ -1938,6 +1964,7 @@ void log_debug(void) print_bits(lc->clean_bits, 1); } @@ -376,10 +408,8 @@ Index: LVM2.2.02.98/daemons/cmirrord/functions.c dm_list_iterate_items(lc, &log_list) { LOG_ERROR("%s", lc->uuid); LOG_ERROR(" recoverer : %" PRIu32, lc->recoverer); -Index: LVM2.2.02.98/daemons/cmirrord/local.c -=================================================================== ---- LVM2.2.02.98.orig/daemons/cmirrord/local.c -+++ LVM2.2.02.98/daemons/cmirrord/local.c +--- a/daemons/cmirrord/local.c ++++ b/daemons/cmirrord/local.c @@ -29,13 +29,13 @@ static int cn_fd = -1; /* Connector (netlink) socket fd */ @@ -403,11 +433,9 @@ Index: LVM2.2.02.98/daemons/cmirrord/local.c memset(send_buf, 0, sizeof(send_buf)); -Index: LVM2.2.02.98/lib/metadata/mirror.c -=================================================================== ---- LVM2.2.02.98.orig/lib/metadata/mirror.c -+++ LVM2.2.02.98/lib/metadata/mirror.c -@@ -1909,10 +1909,6 @@ int add_mirror_log(struct cmd_context *c +--- a/lib/metadata/mirror.c ++++ b/lib/metadata/mirror.c +@@ -1946,10 +1946,6 @@ int add_mirror_log(struct cmd_context *c unsigned old_log_count; int r = 0; @@ -418,15 +446,16 @@ Index: LVM2.2.02.98/lib/metadata/mirror.c if (dm_list_size(&lv->segments) != 1) { log_error("Multiple-segment mirror is not supported"); -@@ -2076,25 +2072,6 @@ int lv_add_mirrors(struct cmd_context *c +@@ -2113,26 +2109,6 @@ int lv_add_mirrors(struct cmd_context *c return 0; } - if (vg_is_clustered(lv->vg)) { -- /* FIXME: review check of lv_is_active_remotely */ - /* FIXME: move this test out of this function */ - /* Skip test for pvmove mirrors, it can use local mirror */ - if (!(lv->status & (PVMOVE | LOCKED)) && +- lv_is_active(lv) && +- !lv_is_active_exclusive_locally(lv) && /* lv_is_active_remotely */ - !_cluster_mirror_is_available(lv)) { - log_error("Shared cluster mirrors are not available."); - return 0; @@ -444,32 +473,28 @@ Index: LVM2.2.02.98/lib/metadata/mirror.c /* For corelog mirror, activation code depends on * the global mirror_in_sync status. As we are adding -Index: LVM2.2.02.98/lib/mirror/mirrored.c -=================================================================== ---- LVM2.2.02.98.orig/lib/mirror/mirrored.c -+++ LVM2.2.02.98/lib/mirror/mirrored.c -@@ -366,12 +366,15 @@ static int _add_log(struct dm_pool *mem, +--- a/lib/mirror/mirrored.c ++++ b/lib/mirror/mirrored.c +@@ -361,12 +361,15 @@ static int _add_log(struct dm_pool *mem, return 0; } } else { - /* If core log, use mirror's UUID and set DM_CORELOG flag */ + /* If core log, use mirror's (UUID + CORE) and set DM_CORELOG flag */ - if (!(log_dlid = build_dm_uuid(mem, seg->lv->lvid.s, NULL))) { + if (!(log_dlid = build_dm_uuid(mem, seg->lv, NULL))) { log_error("Failed to build uuid for mirror LV %s.", seg->lv->name); return 0; } + if (clustered) -+ memcpy(&(log_dlid[strlen(log_dlid)-4]),"CORE",4); ++ memcpy(&log_dlid[strlen(log_dlid) - 4], "CORE", 4); + log_flags |= DM_CORELOG; } -Index: LVM2.2.02.98/tools/lvconvert.c -=================================================================== ---- LVM2.2.02.98.orig/tools/lvconvert.c -+++ LVM2.2.02.98/tools/lvconvert.c -@@ -1115,15 +1115,6 @@ static int _lvconvert_mirrors_parse_para +--- a/tools/lvconvert.c ++++ b/tools/lvconvert.c +@@ -1364,15 +1364,6 @@ static int _lvconvert_mirrors_parse_para return 0; } @@ -485,16 +510,3 @@ Index: LVM2.2.02.98/tools/lvconvert.c log_verbose("Setting logging type to %s", mirrorlog); /* -Index: LVM2.2.02.98/daemons/cmirrord/Makefile.in -=================================================================== ---- LVM2.2.02.98.orig/daemons/cmirrord/Makefile.in -+++ LVM2.2.02.98/daemons/cmirrord/Makefile.in -@@ -26,7 +26,7 @@ TARGETS = cmirrord - - include $(top_builddir)/make.tmpl - --LIBS += -ldevmapper -+LIBS += -ldevmapper -lpthread - LMLIBS += $(CPG_LIBS) $(SACKPT_LIBS) - CFLAGS += $(CPG_CFLAGS) $(SACKPT_CFLAGS) - diff --git a/clvmd-Avoid-a-3-way-deadlock-in-dead-client-cleanup.patch b/clvmd-Avoid-a-3-way-deadlock-in-dead-client-cleanup.patch deleted file mode 100644 index 616d844..0000000 --- a/clvmd-Avoid-a-3-way-deadlock-in-dead-client-cleanup.patch +++ /dev/null @@ -1,252 +0,0 @@ -From 25bed9968155f43ef0b8832383ef711e7ae1685d Mon Sep 17 00:00:00 2001 -From: Petr Rockai -Date: Mon, 9 Sep 2013 00:01:44 +0200 -Subject: [PATCH] clvmd: Avoid a 3-way deadlock in dead-client cleanup. - ---- - daemons/clvmd/clvmd.c | 177 +++++++++++++++++++++++++++----------------------- - daemons/clvmd/clvmd.h | 1 + - 2 files changed, 96 insertions(+), 82 deletions(-) - -Index: LVM2.2.02.98/daemons/clvmd/clvmd.c -=================================================================== ---- LVM2.2.02.98.orig/daemons/clvmd/clvmd.c 2014-03-18 16:14:07.237654914 +0800 -+++ LVM2.2.02.98/daemons/clvmd/clvmd.c 2014-03-18 16:14:07.272654866 +0800 -@@ -120,6 +120,7 @@ static void *pre_and_post_thread(void *a - static int send_message(void *buf, int msglen, const char *csid, int fd, - const char *errtext); - static int read_from_local_sock(struct local_client *thisfd); -+static int cleanup_zombie(struct local_client *thisfd); - static int process_local_command(struct clvm_header *msg, int msglen, - struct local_client *client, - unsigned short xid); -@@ -694,6 +695,7 @@ static int local_rendezvous_callback(str - newfd->bits.localsock.sent_out = FALSE; - newfd->bits.localsock.threadid = 0; - newfd->bits.localsock.finished = 0; -+ newfd->bits.localsock.cleanup_needed = 0; - newfd->bits.localsock.pipe_client = NULL; - newfd->bits.localsock.private = NULL; - newfd->bits.localsock.all_success = 1; -@@ -884,7 +886,7 @@ static void main_loop(int local_sock, in - for (thisfd = &local_client_head; thisfd != NULL; - thisfd = thisfd->next) { - -- if (thisfd->removeme) { -+ if (thisfd->removeme && !cleanup_zombie(thisfd)) { - struct local_client *free_fd; - lastfd->next = thisfd->next; - free_fd = thisfd; -@@ -911,7 +913,6 @@ static void main_loop(int local_sock, in - - /* Got error or EOF: Remove it from the list safely */ - if (ret <= 0) { -- struct local_client *free_fd; - int type = thisfd->type; - - /* If the cluster socket shuts down, so do we */ -@@ -921,12 +922,7 @@ static void main_loop(int local_sock, in - - DEBUGLOG("ret == %d, errno = %d. removing client\n", - ret, errno); -- lastfd->next = thisfd->next; -- free_fd = thisfd; -- safe_close(&(free_fd->fd)); -- -- /* Queue cleanup, this also frees the client struct */ -- add_to_lvmqueue(free_fd, NULL, 0, NULL); -+ thisfd->removeme = 1; - break; - } - -@@ -1089,6 +1085,95 @@ static void be_daemon(int timeout) - - } - -+static int cleanup_zombie(struct local_client *thisfd) -+{ -+ int *status; -+ -+ if (thisfd->type != LOCAL_SOCK) -+ return 0; -+ -+ if (!thisfd->bits.localsock.cleanup_needed) -+ return 0; -+ -+ DEBUGLOG("EOF on local socket: inprogress=%d\n", -+ thisfd->bits.localsock.in_progress); -+ -+ thisfd->bits.localsock.finished = 1; -+ -+ /* If the client went away in mid command then tidy up */ -+ if (thisfd->bits.localsock.in_progress) { -+ pthread_kill(thisfd->bits.localsock.threadid, SIGUSR2); -+ if (pthread_mutex_trylock(&thisfd->bits.localsock.mutex)) -+ goto bail; -+ thisfd->bits.localsock.state = POST_COMMAND; -+ pthread_cond_signal(&thisfd->bits.localsock.cond); -+ pthread_mutex_unlock(&thisfd->bits.localsock.mutex); -+ -+ /* Free any unsent buffers */ -+ free_reply(thisfd); -+ } -+ -+ /* Kill the subthread & free resources */ -+ if (thisfd->bits.localsock.threadid) { -+ DEBUGLOG("Waiting for child thread\n"); -+ pthread_mutex_lock(&thisfd->bits.localsock.mutex); -+ thisfd->bits.localsock.state = PRE_COMMAND; -+ pthread_cond_signal(&thisfd->bits.localsock.cond); -+ pthread_mutex_unlock(&thisfd->bits.localsock.mutex); -+ -+ if ((errno = pthread_join(thisfd->bits.localsock.threadid, -+ (void **) &status))) -+ log_sys_error("pthread_join", ""); -+ -+ DEBUGLOG("Joined child thread\n"); -+ -+ thisfd->bits.localsock.threadid = 0; -+ pthread_cond_destroy(&thisfd->bits.localsock.cond); -+ pthread_mutex_destroy(&thisfd->bits.localsock.mutex); -+ -+ /* Remove the pipe client */ -+ if (thisfd->bits.localsock.pipe_client != NULL) { -+ struct local_client *newfd; -+ struct local_client *lastfd = NULL; -+ struct local_client *free_fd = NULL; -+ -+ (void) close(thisfd->bits.localsock.pipe_client->fd); /* Close pipe */ -+ (void) close(thisfd->bits.localsock.pipe); -+ -+ /* Remove pipe client */ -+ for (newfd = &local_client_head; newfd != NULL; -+ newfd = newfd->next) { -+ if (thisfd->bits.localsock. -+ pipe_client == newfd) { -+ thisfd->bits.localsock. -+ pipe_client = NULL; -+ -+ lastfd->next = newfd->next; -+ free_fd = newfd; -+ newfd->next = lastfd; -+ free(free_fd); -+ break; -+ } -+ lastfd = newfd; -+ } -+ } -+ } -+ -+ /* Free the command buffer */ -+ free(thisfd->bits.localsock.cmd); -+ -+ /* Clear out the cross-link */ -+ if (thisfd->bits.localsock.pipe_client != NULL) -+ thisfd->bits.localsock.pipe_client->bits.pipe.client = -+ NULL; -+ -+ safe_close(&(thisfd->fd)); -+ thisfd->bits.localsock.cleanup_needed = 0; -+ return 0; -+bail: -+ return 1; -+} -+ - /* Called when we have a read from the local socket. - was in the main loop but it's grown up and is a big girl now */ - static int read_from_local_sock(struct local_client *thisfd) -@@ -1106,80 +1191,8 @@ static int read_from_local_sock(struct l - - /* EOF or error on socket */ - if (len <= 0) { -- int *status; -- -- DEBUGLOG("EOF on local socket: inprogress=%d\n", -- thisfd->bits.localsock.in_progress); -- -- thisfd->bits.localsock.finished = 1; -- -- /* If the client went away in mid command then tidy up */ -- if (thisfd->bits.localsock.in_progress) { -- pthread_kill(thisfd->bits.localsock.threadid, SIGUSR2); -- pthread_mutex_lock(&thisfd->bits.localsock.mutex); -- thisfd->bits.localsock.state = POST_COMMAND; -- pthread_cond_signal(&thisfd->bits.localsock.cond); -- pthread_mutex_unlock(&thisfd->bits.localsock.mutex); -- -- /* Free any unsent buffers */ -- free_reply(thisfd); -- } -- -- /* Kill the subthread & free resources */ -- if (thisfd->bits.localsock.threadid) { -- DEBUGLOG("Waiting for child thread\n"); -- pthread_mutex_lock(&thisfd->bits.localsock.mutex); -- thisfd->bits.localsock.state = PRE_COMMAND; -- pthread_cond_signal(&thisfd->bits.localsock.cond); -- pthread_mutex_unlock(&thisfd->bits.localsock.mutex); -- -- if ((errno = pthread_join(thisfd->bits.localsock.threadid, -- (void **) &status))) -- log_sys_error("pthread_join", ""); -- -- DEBUGLOG("Joined child thread\n"); -- -- thisfd->bits.localsock.threadid = 0; -- pthread_cond_destroy(&thisfd->bits.localsock.cond); -- pthread_mutex_destroy(&thisfd->bits.localsock.mutex); -- -- /* Remove the pipe client */ -- if (thisfd->bits.localsock.pipe_client != NULL) { -- struct local_client *newfd; -- struct local_client *lastfd = NULL; -- struct local_client *free_fd = NULL; -- -- (void) close(thisfd->bits.localsock.pipe_client->fd); /* Close pipe */ -- (void) close(thisfd->bits.localsock.pipe); -- -- /* Remove pipe client */ -- for (newfd = &local_client_head; newfd != NULL; -- newfd = newfd->next) { -- if (thisfd->bits.localsock. -- pipe_client == newfd) { -- thisfd->bits.localsock. -- pipe_client = NULL; -- -- lastfd->next = newfd->next; -- free_fd = newfd; -- newfd->next = lastfd; -- free(free_fd); -- break; -- } -- lastfd = newfd; -- } -- } -- } -- -- /* Free the command buffer */ -- free(thisfd->bits.localsock.cmd); -- -- /* Clear out the cross-link */ -- if (thisfd->bits.localsock.pipe_client != NULL) -- thisfd->bits.localsock.pipe_client->bits.pipe.client = -- NULL; -- -- safe_close(&(thisfd->fd)); -+ thisfd->bits.localsock.cleanup_needed = 1; -+ cleanup_zombie(thisfd); /* we ignore errors here */ - return 0; - } else { - int comms_pipe[2]; -Index: LVM2.2.02.98/daemons/clvmd/clvmd.h -=================================================================== ---- LVM2.2.02.98.orig/daemons/clvmd/clvmd.h 2012-10-15 22:24:58.000000000 +0800 -+++ LVM2.2.02.98/daemons/clvmd/clvmd.h 2014-03-18 16:14:07.272654866 +0800 -@@ -53,6 +53,7 @@ struct localsock_bits { - int finished; /* Flag to tell subthread to exit */ - int all_success; /* Set to 0 if any node (or the pre_command) - failed */ -+ int cleanup_needed; /* helper for cleanup_zombie */ - struct local_client *pipe_client; - pthread_t threadid; - enum { PRE_COMMAND, POST_COMMAND, QUIT } state; diff --git a/clvmd-Fix-node-up-down-handing-in-corosync-module.patch b/clvmd-Fix-node-up-down-handing-in-corosync-module.patch deleted file mode 100644 index 444f874..0000000 --- a/clvmd-Fix-node-up-down-handing-in-corosync-module.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 431eda63cc0ebff7c62dacb313cabcffbda6573a Mon Sep 17 00:00:00 2001 -From: Christine Caulfield -Date: Mon, 23 Sep 2013 13:23:00 +0100 -Subject: [PATCH] clvmd: Fix node up/down handing in corosync module - -The corosync cluster interface for clvmd did not correctly -deal with node up/down events so that when a node was removed -from the cluster clvmd would prevent remote operations -from happening, as it thought the node was up but not -running clvmd. - -This patch fixes that code by simplifying the case to node -being up or down - which was the original intention -and is supported by pacemaker and CPG in the higher layers. - -Signed-off-by: Christine Caulfield ---- - daemons/clvmd/clvmd-corosync.c | 31 ++++--------------------------- - 2 files changed, 5 insertions(+), 27 deletions(-) - -diff --git a/daemons/clvmd/clvmd-corosync.c b/daemons/clvmd/clvmd-corosync.c -index d85ec1e..9092c8a 100644 ---- a/daemons/clvmd/clvmd-corosync.c -+++ b/daemons/clvmd/clvmd-corosync.c -@@ -89,7 +89,7 @@ quorum_callbacks_t quorum_callbacks = { - - struct node_info - { -- enum {NODE_UNKNOWN, NODE_DOWN, NODE_UP, NODE_CLVMD} state; -+ enum {NODE_DOWN, NODE_CLVMD} state; - int nodeid; - }; - -@@ -255,26 +255,6 @@ static void corosync_cpg_confchg_callback(cpg_handle_t handle, - ninfo->state = NODE_DOWN; - } - -- for (i=0; inodeid = member_list[i].nodeid; -- dm_hash_insert_binary(node_hash, -- (char *)&ninfo->nodeid, -- COROSYNC_CSID_LEN, ninfo); -- } -- } -- ninfo->state = NODE_CLVMD; -- } -- - num_nodes = member_list_entries; - } - -@@ -440,7 +420,6 @@ static int _cluster_do_node_callback(struct local_client *master_client, - { - struct dm_hash_node *hn; - struct node_info *ninfo; -- int somedown = 0; - - dm_hash_iterate(hn, node_hash) - { -@@ -452,12 +431,10 @@ static int _cluster_do_node_callback(struct local_client *master_client, - DEBUGLOG("down_callback. node %d, state = %d\n", ninfo->nodeid, - ninfo->state); - -- if (ninfo->state != NODE_DOWN) -- callback(master_client, csid, ninfo->state == NODE_CLVMD); -- if (ninfo->state != NODE_CLVMD) -- somedown = -1; -+ if (ninfo->state == NODE_CLVMD) -+ callback(master_client, csid, 1); - } -- return somedown; -+ return 0; - } - - /* Real locking */ --- -1.8.4.5 - diff --git a/clvmd-fix-debugging-level-set-in-clvmd_set_debug-function.patch b/clvmd-fix-debugging-level-set-in-clvmd_set_debug-function.patch deleted file mode 100644 index ad06847..0000000 --- a/clvmd-fix-debugging-level-set-in-clvmd_set_debug-function.patch +++ /dev/null @@ -1,22 +0,0 @@ -Index: LVM2.2.02.98/daemons/clvmd/clvmd.c -=================================================================== ---- LVM2.2.02.98.orig/daemons/clvmd/clvmd.c -+++ LVM2.2.02.98/daemons/clvmd/clvmd.c -@@ -364,7 +364,7 @@ int main(int argc, char *argv[]) - /* Deal with command-line arguments */ - opterr = 0; - optind = 0; -- while ((opt = getopt_long(argc, argv, "vVhfd::t:RST:CI:E:", -+ while ((opt = getopt_long(argc, argv, "vVhfd:t:RST:CI:E:", - longopts, NULL)) != -1) { - switch (opt) { - case 'h': -@@ -451,7 +451,7 @@ int main(int argc, char *argv[]) - return debug_clvmd(debug_arg, clusterwide_opt)==1?0:1; - } - -- clvmd_set_debug(debug_opt); -+ clvmd_set_debug(debug_arg); - - /* Fork into the background (unless requested not to) */ - if (!foreground_mode) diff --git a/cmirrord-fix-s390-endian-issue.patch b/cmirrord-fix-s390-endian-issue.patch new file mode 100644 index 0000000..75ad78f --- /dev/null +++ b/cmirrord-fix-s390-endian-issue.patch @@ -0,0 +1,39 @@ +Index: LVM2.2.02.98/daemons/cmirrord/compat.c +=================================================================== +--- LVM2.2.02.98.orig/daemons/cmirrord/compat.c ++++ LVM2.2.02.98/daemons/cmirrord/compat.c +@@ -126,13 +126,13 @@ static int v5_endian_to_network(struct c + + u_rq->error = xlate32(u_rq->error); + u_rq->seq = xlate32(u_rq->seq); +- u_rq->request_type = xlate32(u_rq->request_type); +- u_rq->data_size = xlate64(u_rq->data_size); +- + rq->originator = xlate32(rq->originator); + + v5_data_endian_switch(rq, 1); + ++ u_rq->request_type = xlate32(u_rq->request_type); ++ u_rq->data_size = xlate32(u_rq->data_size); ++ + return size; + } + +@@ -167,7 +167,7 @@ static int v5_endian_from_network(struct + u_rq->error = xlate32(u_rq->error); + u_rq->seq = xlate32(u_rq->seq); + u_rq->request_type = xlate32(u_rq->request_type); +- u_rq->data_size = xlate64(u_rq->data_size); ++ u_rq->data_size = xlate32(u_rq->data_size); + + rq->originator = xlate32(rq->originator); + +@@ -187,7 +187,7 @@ int clog_request_from_network(void *data + + switch (version) { + case 5: /* Upstream */ +- if (version == unconverted_version) ++ if (version == vp[0]) + return 0; + break; + case 4: /* RHEL 5.[45] */ diff --git a/cmirrord_improvment_performance.patch b/cmirrord_improvment_performance.patch index 5a33b7a..2fc7c61 100644 --- a/cmirrord_improvment_performance.patch +++ b/cmirrord_improvment_performance.patch @@ -1,8 +1,8 @@ -diff --git a/daemons/cmirrord/cluster.c b/daemons/cmirrord/cluster.c -index fea739a..aa35f62 100644 ---- a/daemons/cmirrord/cluster.c -+++ b/daemons/cmirrord/cluster.c -@@ -353,6 +353,10 @@ static int handle_cluster_response(struct clog_cpg *entry, +Index: LVM2.2.02.111/daemons/cmirrord/cluster.c +=================================================================== +--- LVM2.2.02.111.orig/daemons/cmirrord/cluster.c ++++ LVM2.2.02.111/daemons/cmirrord/cluster.c +@@ -358,6 +358,10 @@ static int handle_cluster_response(struc /* FIXME: Ensure memcpy cannot explode */ memcpy(orig_rq, rq, sizeof(*rq) + rq->u_rq.data_size); @@ -13,11 +13,11 @@ index fea739a..aa35f62 100644 r = kernel_send(&orig_rq->u_rq); if (r) LOG_ERROR("Failed to send response to kernel"); -diff --git a/daemons/cmirrord/functions.c b/daemons/cmirrord/functions.c -index f6e0918..c1c3538 100644 ---- a/daemons/cmirrord/functions.c -+++ b/daemons/cmirrord/functions.c -@@ -362,7 +362,7 @@ static int find_disk_path(char *major_minor_str, char *path_rtn, int *unlink_pat +Index: LVM2.2.02.111/daemons/cmirrord/functions.c +=================================================================== +--- LVM2.2.02.111.orig/daemons/cmirrord/functions.c ++++ LVM2.2.02.111/daemons/cmirrord/functions.c +@@ -374,7 +374,7 @@ static int find_disk_path(char *major_mi // return r ? -errno : 0; } @@ -26,7 +26,7 @@ index f6e0918..c1c3538 100644 int argc, char **argv, uint64_t device_size) { int i; -@@ -431,6 +431,8 @@ static int _clog_ctr(char *uuid, uint64_t luid, +@@ -443,6 +443,8 @@ static int _clog_ctr(char *uuid, uint64_ log_sync = NOSYNC; else if (!strcmp(argv[i], "block_on_error")) block_on_error = 1; @@ -35,7 +35,7 @@ index f6e0918..c1c3538 100644 } lc = dm_zalloc(sizeof(*lc)); -@@ -594,7 +596,7 @@ static int clog_ctr(struct dm_ulog_request *rq) +@@ -608,7 +610,7 @@ static int clog_ctr(struct dm_ulog_reque return -EINVAL; } @@ -44,7 +44,7 @@ index f6e0918..c1c3538 100644 /* We join the CPG when we resume */ -@@ -1026,12 +1028,14 @@ static int clog_in_sync(struct dm_ulog_request *rq) +@@ -1053,12 +1055,14 @@ static int clog_in_sync(struct dm_ulog_r return 0; } @@ -60,7 +60,7 @@ index f6e0918..c1c3538 100644 { int r = 0; struct log_c *lc = get_log(rq->uuid, rq->luid); -@@ -1042,6 +1046,15 @@ static int clog_flush(struct dm_ulog_request *rq, int server) +@@ -1069,6 +1073,15 @@ static int clog_flush(struct dm_ulog_req if (!lc->touched) return 0; @@ -76,7 +76,7 @@ index f6e0918..c1c3538 100644 /* * Do the actual flushing of the log only * if we are the server. -@@ -1104,25 +1117,11 @@ static int mark_region(struct log_c *lc, uint64_t region, uint32_t who) +@@ -1131,25 +1144,11 @@ static int mark_region(struct log_c *lc, return 0; } @@ -103,7 +103,7 @@ index f6e0918..c1c3538 100644 if (rq->data_size % sizeof(uint64_t)) { LOG_ERROR("Bad data size given for mark_region request"); return -EINVAL; -@@ -1142,6 +1141,25 @@ static int clog_mark_region(struct dm_ulog_request *rq, uint32_t originator) +@@ -1169,6 +1168,25 @@ static int clog_mark_region(struct dm_ul return 0; } @@ -129,7 +129,7 @@ index f6e0918..c1c3538 100644 static int clear_region(struct log_c *lc, uint64_t region, uint32_t who) { int other_matches = 0; -@@ -1673,7 +1691,7 @@ int do_request(struct clog_request *rq, int server) +@@ -1700,7 +1718,7 @@ int do_request(struct clog_request *rq, r = clog_in_sync(&rq->u_rq); break; case DM_ULOG_FLUSH: @@ -138,18 +138,24 @@ index f6e0918..c1c3538 100644 break; case DM_ULOG_MARK_REGION: r = clog_mark_region(&rq->u_rq, rq->originator); -diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c -index 752a44b..fb78cb6 100644 ---- a/libdm/libdm-deptree.c -+++ b/libdm/libdm-deptree.c -@@ -2164,6 +2164,10 @@ static int _mirror_emit_segment_line(struct dm_task *dmt, struct load_segment *s - if (block_on_error) - EMIT_PARAMS(pos, " block_on_error"); +Index: LVM2.2.02.111/libdm/libdm-deptree.c +=================================================================== +--- LVM2.2.02.111.orig/libdm/libdm-deptree.c ++++ LVM2.2.02.111/libdm/libdm-deptree.c +@@ -2254,10 +2254,12 @@ static int _mirror_emit_segment_line(str + return_0; + } +- if (dm_log_userspace) +- EMIT_PARAMS(pos, "userspace %u %s clustered-%s", +- log_parm_count, seg->uuid, logtype); +- else + /* for cluster raid1, use integrated flush to improve performance */ -+ if (dm_log_userspace) -+ EMIT_PARAMS(pos, " integrated_flush"); -+ - EMIT_PARAMS(pos, " %u ", seg->mirror_area_count); ++ if (dm_log_userspace) { ++ log_parm_count ++; /* for integrated_flush */ ++ EMIT_PARAMS(pos, "userspace %u %s %s clustered-%s", ++ log_parm_count, seg->uuid, "integrated_flush", logtype); ++ } else + EMIT_PARAMS(pos, "%s %u", logtype, log_parm_count); - if (_emit_areas_line(dmt, seg, params, paramsize, &pos) <= 0) + if (seg->log) diff --git a/device-mapper-dmsetup-export.patch b/device-mapper-dmsetup-export.patch new file mode 100644 index 0000000..9ea1b89 --- /dev/null +++ b/device-mapper-dmsetup-export.patch @@ -0,0 +1,167 @@ +Index: LVM2.2.02.110/man/dmsetup.8.in +=================================================================== +--- LVM2.2.02.110.orig/man/dmsetup.8.in ++++ LVM2.2.02.110/man/dmsetup.8.in +@@ -45,6 +45,9 @@ dmsetup \(em low level logical volume ma + .RI [ device_name ] + .RE + .br ++.B dmsetup export ++.I [device_name] ++.br + .B dmsetup load + .I device_name + .RB [ \-\-table +@@ -309,6 +312,10 @@ device_name in subsequent dmsetup comman + If successful a device will appear as + /dev/mapper/. + See below for information on the table format. ++.IP \fBexport ++.I [device_name] ++.br ++Outputs information in key/value format to be imported by other programs. + .br + .TP + .B deps +Index: LVM2.2.02.110/tools/dmsetup.c +=================================================================== +--- LVM2.2.02.110.orig/tools/dmsetup.c ++++ LVM2.2.02.110/tools/dmsetup.c +@@ -1733,6 +1733,129 @@ static int _status(CMD_ARGS) + return r; + } + ++static int _export(CMD_ARGS) ++{ ++ int r = 0; ++ struct dm_task *dmt = NULL; ++ void *next = NULL; ++ uint64_t start, length; ++ char *target_type = NULL; ++ char *params; ++ const char *name = NULL; ++ const char *old_name = NULL; ++ const char *uuid = NULL; ++ struct dm_info info; ++ struct dm_deps *deps; ++ ++ if (names) ++ name = names->name; ++ else if (argc == 2) ++ name = argv[1]; ++ old_name = name; ++ ++ if (!(dmt = dm_task_create(DM_DEVICE_STATUS))) ++ goto out; ++ ++ if (!_set_task_device(dmt, name, 0)) ++ goto out; ++ ++ if (!dm_task_run(dmt)) ++ goto out; ++ ++ if (!dm_task_get_info(dmt, &info) || !info.exists) ++ goto out; ++ ++ if (!name) ++ name = dm_task_get_name(dmt); ++ ++ uuid = dm_task_get_uuid(dmt); ++ printf("DM_NAME=%s\n", name); ++ ++ if ((uuid = dm_task_get_uuid(dmt)) && *uuid) ++ printf("DM_UUID=%s\n", uuid); ++ ++ if (!info.exists) { ++ printf("DM_STATE=NOTPRESENT\n"); ++ goto out; ++ } ++ ++ if (!name) ++ name = dm_task_get_name(dmt); ++ ++ uuid = dm_task_get_uuid(dmt); ++ printf("DM_NAME=%s\n", name); ++ ++ if ((uuid = dm_task_get_uuid(dmt)) && *uuid) ++ printf("DM_UUID=%s\n", uuid); ++ ++ if (!info.exists) { ++ printf("DM_STATE=NOTPRESENT\n"); ++ goto out; ++ } ++ ++ printf("DM_STATE=%s\n", ++ info.suspended ? "SUSPENDED" : ++ (info.read_only ? "READONLY" : "ACTIVE")); ++ ++ if (!info.live_table && !info.inactive_table) ++ printf("DM_TABLE_STATE=NONE\n"); ++ else ++ printf("DM_TABLE_STATE=%s%s%s\n", ++ info.live_table ? "LIVE" : "", ++ info.live_table && info.inactive_table ? "/" : "", ++ info.inactive_table ? "INACTIVE" : ""); ++ ++ if (info.open_count != -1) ++ printf("DM_OPENCOUNT=%d\n", info.open_count); ++ ++ printf("DM_LAST_EVENT_NR=%" PRIu32 "\n", info.event_nr); ++ ++ printf("DM_MAJOR=%d\n", info.major); ++ printf("DM_MINOR=%d\n", info.minor); ++ ++ if (info.target_count != -1) ++ printf("DM_TARGET_COUNT=%d\n", info.target_count); ++ ++ /* export all table types */ ++ next = dm_get_next_target(dmt, next, &start, &length, ++ &target_type, ¶ms); ++ if (target_type) { ++ printf("DM_TARGET_TYPES=%s", target_type); ++ while (next) { ++ next = dm_get_next_target(dmt, next, &start, &length, ++ &target_type, ¶ms); ++ if (target_type) ++ printf(",%s", target_type); ++ } ++ printf("\n"); ++ } ++ ++ dm_task_destroy(dmt); ++ ++ // bnc#707614, revert to the original name ++ ++ if (!(dmt = dm_task_create(DM_DEVICE_DEPS))) ++ goto out; ++ ++ name = old_name; ++ if (!_set_task_device(dmt, name, 0)) ++ goto out; ++ ++ if (!dm_task_run(dmt)) ++ goto out; ++ ++ if (!(deps = dm_task_get_deps(dmt))) ++ goto out; ++ ++ printf("DM_DEPS=%d\n", deps->count); ++ ++ r = 1; ++ out: ++ if (dmt) ++ dm_task_destroy(dmt); ++ return r; ++} ++ + /* Show target names and their version numbers */ + static int _targets(CMD_ARGS) + { +@@ -3086,6 +3209,7 @@ static struct command _commands[] = { + {"info", "[]", 0, -1, 1, _info}, + {"deps", "[-o options] []", 0, -1, 1, _deps}, + {"status", "[] [--noflush] [--target ]", 0, -1, 1, _status}, ++ {"export", "[]", 0, -1, 1, _export}, + {"table", "[] [--target ] [--showkeys]", 0, -1, 1, _status}, + {"wait", " [] [--noflush]", 0, 2, 0, _wait}, + {"mknodes", "[]", 0, -1, 1, _mknodes}, diff --git a/device-mapper-gcc-warnings.patch b/device-mapper-gcc-warnings.patch new file mode 100644 index 0000000..991ae9c --- /dev/null +++ b/device-mapper-gcc-warnings.patch @@ -0,0 +1,45 @@ +Index: LVM2.2.02.109/libdm/datastruct/hash.c +=================================================================== +--- LVM2.2.02.109.orig/libdm/datastruct/hash.c ++++ LVM2.2.02.109/libdm/datastruct/hash.c +@@ -19,7 +19,7 @@ struct dm_hash_node { + struct dm_hash_node *next; + void *data; + unsigned keylen; +- char key[0]; ++ unsigned char key[0]; + }; + + struct dm_hash_table { +@@ -136,7 +136,7 @@ void dm_hash_destroy(struct dm_hash_tabl + static struct dm_hash_node **_find(struct dm_hash_table *t, const void *key, + uint32_t len) + { +- unsigned h = _hash(key, len) & (t->num_slots - 1); ++ unsigned h = _hash((unsigned char *)key, len) & (t->num_slots - 1); + struct dm_hash_node **c; + + for (c = &t->slots[h]; *c; c = &((*c)->next)) { +@@ -235,7 +235,8 @@ void dm_hash_wipe(struct dm_hash_table * + char *dm_hash_get_key(struct dm_hash_table *t __attribute__((unused)), + struct dm_hash_node *n) + { +- return n->key; ++ return (char *)n->key; ++ + } + + void *dm_hash_get_data(struct dm_hash_table *t __attribute__((unused)), +Index: LVM2.2.02.109/libdm/ioctl/libdm-iface.c +=================================================================== +--- LVM2.2.02.109.orig/libdm/ioctl/libdm-iface.c ++++ LVM2.2.02.109/libdm/ioctl/libdm-iface.c +@@ -1751,7 +1751,7 @@ static struct dm_ioctl *_do_dm_ioctl(str + dmt->secure_data ? "W " : "", + dmt->query_inactive_table ? "I " : "", + dmt->enable_checks ? "C" : "", +- dmt->sector, _sanitise_message(dmt->message), ++ (unsigned long long int)dmt->sector, _sanitise_message(dmt->message), + dmi->data_size, retry_repeat_count); + #ifdef DM_IOCTLS + if (ioctl(_control_fd, command, dmi) < 0 && diff --git a/device-mapper-link b/device-mapper-link new file mode 100644 index 0000000..67859ab --- /dev/null +++ b/device-mapper-link @@ -0,0 +1,21 @@ +Make sure + /dev/device-mapper +exists as a link to /dev/mapper/control + +Resolves: bnc#724578 +Signed-off-by: NeilBrown +--- + udev/10-dm.rules.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- LVM2.2.02.84.orig/udev/10-dm.rules.in ++++ LVM2.2.02.84/udev/10-dm.rules.in +@@ -14,7 +14,7 @@ + # DM_SUSPENDED - suspended state of DM device (0 or 1) + # DM_UDEV_RULES_VSN - DM udev rules version + +-KERNEL=="device-mapper", NAME="(DM_DIR)/control" ++KERNEL=="device-mapper", NAME="(DM_DIR)/control", SYMLINK+="device-mapper" + + SUBSYSTEM!="block", GOTO="dm_end" + KERNEL!="dm-[0-9]*", GOTO="dm_end" diff --git a/device-mapper-static.patch b/device-mapper-static.patch new file mode 100644 index 0000000..b7aae56 --- /dev/null +++ b/device-mapper-static.patch @@ -0,0 +1,28 @@ +Index: LVM2.2.02.109/libdm/Makefile.in +=================================================================== +--- LVM2.2.02.109.orig/libdm/Makefile.in ++++ LVM2.2.02.109/libdm/Makefile.in +@@ -39,9 +39,9 @@ INCLUDES += @VALGRIND_CFLAGS@ + endif + CFLAGS += $(UDEV_CFLAGS) + +-ifeq ("@STATIC_LINK@", "yes") ++#ifeq ("@STATIC_LINK@", "yes") + LIB_STATIC = $(interface)/libdevmapper.a +-endif ++#endif + + LIB_SHARED = $(interface)/libdevmapper.$(LIB_SUFFIX) + LIB_VERSION = $(LIB_VERSION_DM) +@@ -71,9 +71,9 @@ libdevmapper.$(LIB_SUFFIX) libdevmapper. + + INSTALL_TYPE = install_dynamic + +-ifeq ("@STATIC_LINK@", "yes") ++#ifeq ("@STATIC_LINK@", "yes") + INSTALL_TYPE += install_static +-endif ++#endif + + ifeq ("@PKGCONFIG@", "yes") + INSTALL_TYPE += install_pkgconfig diff --git a/device-mapper-type_punning.diff b/device-mapper-type_punning.diff index bf72591..4d1b610 100644 --- a/device-mapper-type_punning.diff +++ b/device-mapper-type_punning.diff @@ -2,8 +2,8 @@ lib/device/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---- LVM2.2.02.98.orig/lib/device/device.c -+++ LVM2.2.02.98/lib/device/device.c +--- LVM2.2.02.98.orig/lib/device/dev-type.c ++++ LVM2.2.02.98/lib/device/dev-type.c @@ -39,7 +39,7 @@ struct partition { uint8_t end_cyl; uint32_t start_sect; @@ -11,5 +11,5 @@ -} __attribute__((packed)); +} __attribute__((packed,may_alias)); - static int _is_partitionable(struct device *dev) + static int _is_partitionable(struct dev_types *dt, struct device *dev) { diff --git a/device_is_usable_mem_leak.diff b/device_is_usable_mem_leak.diff deleted file mode 100644 index dea541e..0000000 --- a/device_is_usable_mem_leak.diff +++ /dev/null @@ -1,148 +0,0 @@ -commit ec49f07b0dc89720f4a74a1212e106990099d2d6 -Author: Zdenek Kabelac -Date: Thu Dec 6 23:37:21 2012 +0100 - - mirrors: fix leak in device_is_usable mirror check - - Function _ignore_blocked_mirror_devices was not release - allocated strings images_health and log_health. - - In error paths it was also not releasing dm_task structure. - - Swaped return code of _ignore_blocked_mirror_devices and - use 1 as success. - - In _parse_mirror_status use log_error if memory allocation - fails and few more errors so they are no going unnoticed - as debug messages. - - On error path always clear return values and free strings. - - For dev_create_file use cache mem pool to avoid memleak. - -diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c -index 40f719e..3f74c2d 100644 ---- a/lib/activate/dev_manager.c -+++ b/lib/activate/dev_manager.c -@@ -158,6 +158,10 @@ static int _parse_mirror_status(char *mirror_status_str, - char **args, **log_args; - unsigned num_devs, log_argc; - -+ *images_health = NULL; -+ *log_health = NULL; -+ *log_dev = 0; -+ - if (!dm_split_words(mirror_status_str, 1, 0, &p) || - !(num_devs = (unsigned) atoi(p))) - /* On errors, we must assume the mirror is to be avoided */ -@@ -176,19 +180,31 @@ static int _parse_mirror_status(char *mirror_status_str, - log_argc, 0, log_args) < log_argc) - return_0; - -- *log_health = NULL; -- *log_dev = 0; - if (!strcmp(log_args[0], "disk")) { -- if (!(*log_health = dm_strdup(log_args[2]))) -- return_0; -- if (sscanf(log_args[1], "%d:%d", &major, &minor) != 2) -- return_0; -+ if (!(*log_health = dm_strdup(log_args[2]))) { -+ log_error("Allocation of log string failed."); -+ return 0; -+ } -+ if (sscanf(log_args[1], "%d:%d", &major, &minor) != 2) { -+ log_error("Parsing of log's major minor failed."); -+ goto out; -+ } - *log_dev = MKDEV((dev_t)major, minor); - } -- if (!(*images_health = dm_strdup(args[2 + num_devs]))) -- return_0; -+ -+ if (!(*images_health = dm_strdup(args[2 + num_devs]))) { -+ log_error("Allocation of images string failed."); -+ goto out; -+ } - - return 1; -+ -+out: -+ dm_free(*log_health); -+ *log_health = NULL; -+ *log_dev = 0; -+ -+ return 0; - } - - /* -@@ -227,11 +243,12 @@ static int _ignore_blocked_mirror_devices(struct device *dev, - uint64_t s,l; - char *params, *target_type = NULL; - void *next = NULL; -- struct dm_task *dmt; -+ struct dm_task *dmt = NULL; -+ int r = 0; - - if (!_parse_mirror_status(mirror_status_str, - &images_health, &log_dev, &log_health)) -- goto_out; -+ return_0; - - for (i = 0; images_health[i]; i++) - if (images_health[i] != 'A') { -@@ -254,7 +271,7 @@ static int _ignore_blocked_mirror_devices(struct device *dev, - (int)MINOR(log_dev)) < 0) - goto_out; - -- if (!(tmp_dev = dev_create_file(buf, NULL, NULL, 1))) -+ if (!(tmp_dev = dev_create_file(buf, NULL, NULL, 0))) - goto_out; - - tmp_dev->dev = log_dev; -@@ -263,8 +280,10 @@ static int _ignore_blocked_mirror_devices(struct device *dev, - } - } - -- if (!check_for_blocking) -- return 0; -+ if (!check_for_blocking) { -+ r = 1; -+ goto out; -+ } - - /* - * We avoid another system call if we can, but if a device is -@@ -293,16 +312,19 @@ static int _ignore_blocked_mirror_devices(struct device *dev, - strstr(params, "handle_errors")) { - log_debug("%s: I/O blocked to mirror device", - dev_name(dev)); -- return 1; -+ goto out; - } - } - } while (next); -- dm_task_destroy(dmt); -- -- return 0; - -+ r = 1; - out: -- return 1; -+ if (dmt) -+ dm_task_destroy(dmt); -+ dm_free(log_health); -+ dm_free(images_health); -+ -+ return r; - } - - int device_is_usable(struct device *dev) -@@ -356,7 +378,7 @@ int device_is_usable(struct device *dev) - &target_type, ¶ms); - - if (target_type && !strcmp(target_type, "mirror") && -- _ignore_blocked_mirror_devices(dev, start, length, params)) { -+ !_ignore_blocked_mirror_devices(dev, start, length, params)) { - log_debug("%s: Mirror device %s not usable.", - dev_name(dev), name); - goto out; diff --git a/display-dm-name-for-lv-name.diff b/display-dm-name-for-lv-name.diff index 490db77..e225f5b 100644 --- a/display-dm-name-for-lv-name.diff +++ b/display-dm-name-for-lv-name.diff @@ -1,14 +1,33 @@ --- - lib/config/defaults.h | 1 + - lib/display/display.c | 14 ++++++++++---- - lib/display/display.h | 1 + - 3 files changed, 12 insertions(+), 4 deletions(-) + lib/config/config_settings.h | 1 + + lib/config/defaults.h | 1 + + lib/display/display.c | 14 ++++++++++---- + lib/display/display.h | 1 + + 4 files changed, 13 insertions(+), 4 deletions(-) -Index: LVM2.2.02.98/lib/display/display.c -=================================================================== ---- LVM2.2.02.98.orig/lib/display/display.c 2012-10-15 22:24:58.000000000 +0800 -+++ LVM2.2.02.98/lib/display/display.c 2014-03-20 12:24:55.761578040 +0800 -@@ -535,10 +535,16 @@ int lvdisplay_full(struct cmd_context *c +--- a/lib/config/config_settings.h ++++ b/lib/config/config_settings.h +@@ -187,6 +187,7 @@ cfg_array(global_cache_check_options_CFG + cfg(global_cache_dump_executable_CFG, "cache_dump_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, CACHE_DUMP_CMD, vsn(2, 2, 108), NULL) + cfg(global_cache_repair_executable_CFG, "cache_repair_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, CACHE_REPAIR_CMD, vsn(2, 2, 108), NULL) + cfg_array(global_cache_repair_options_CFG, "cache_repair_options", global_CFG_SECTION, 0, CFG_TYPE_STRING, "#S" DEFAULT_CACHE_REPAIR_OPTIONS, vsn(2, 2, 108), NULL) ++cfg(global_display_dm_name_for_lv_name_CFG, "display_dm_name_for_lv_name", global_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_DISPLAY_DM_NAME_FOR_LV_NAME, vsn(2, 2, 98), NULL) + + cfg(activation_checks_CFG, "checks", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_ACTIVATION_CHECKS, vsn(2, 2, 86), NULL) + cfg(activation_udev_sync_CFG, "udev_sync", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_UDEV_SYNC, vsn(2, 2, 51), NULL) +--- a/lib/config/defaults.h ++++ b/lib/config/defaults.h +@@ -31,6 +31,7 @@ + #define DEFAULT_PROC_DIR "/proc" + #define DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV 1 + #define DEFAULT_SYSFS_SCAN 1 ++#define DEFAULT_DISPLAY_DM_NAME_FOR_LV_NAME 0 + #define DEFAULT_MD_COMPONENT_DETECTION 1 + #define DEFAULT_MD_CHUNK_ALIGNMENT 1 + #define DEFAULT_IGNORE_LVM_MIRRORS 1 +--- a/lib/display/display.c ++++ b/lib/display/display.c +@@ -461,10 +461,15 @@ int lvdisplay_full(struct cmd_context *c lv->vg->cmd->dev_dir, lv->vg->name, lv->name); else if (lv_is_visible(lv)) { /* Thin pool does not have /dev/vg/name link */ @@ -17,8 +36,7 @@ Index: LVM2.2.02.98/lib/display/display.c - lv->vg->cmd->dev_dir, - lv->vg->name, lv->name); + if (!lv_is_thin_pool(lv)) { -+ if (find_config_tree_bool(cmd, "global/display_dm_name_for_lv_name", -+ DEFAULT_DISPLAY_DM_NAME_FOR_LV_NAME)) { ++ if (find_config_tree_bool(cmd, global_display_dm_name_for_lv_name_CFG, NULL)) { + log_print("LV Path %smapper/%s-%s", lv->vg->cmd->dev_dir, + lv->vg->name, lv->name); + } else { @@ -29,27 +47,3 @@ Index: LVM2.2.02.98/lib/display/display.c log_print("LV Name %s", lv->name); } else log_print("Internal LV Name %s", lv->name); -Index: LVM2.2.02.98/lib/display/display.h -=================================================================== ---- LVM2.2.02.98.orig/lib/display/display.h 2014-03-20 12:24:30.403397837 +0800 -+++ LVM2.2.02.98/lib/display/display.h 2014-03-20 12:24:55.761578040 +0800 -@@ -18,6 +18,7 @@ - - #include "metadata-exported.h" - #include "locking.h" -+#include "defaults.h" - - #include - -Index: LVM2.2.02.98/lib/config/defaults.h -=================================================================== ---- LVM2.2.02.98.orig/lib/config/defaults.h 2014-03-20 12:24:30.403397837 +0800 -+++ LVM2.2.02.98/lib/config/defaults.h 2014-03-20 12:25:27.958815335 +0800 -@@ -31,6 +31,7 @@ - #define DEFAULT_PROC_DIR "/proc" - #define DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV 1 - #define DEFAULT_SYSFS_SCAN 1 -+#define DEFAULT_DISPLAY_DM_NAME_FOR_LV_NAME 0 - #define DEFAULT_MD_COMPONENT_DETECTION 1 - #define DEFAULT_MD_CHUNK_ALIGNMENT 1 - #define DEFAULT_MULTIPATH_COMPONENT_DETECTION 1 diff --git a/do_not_read_from_mirrors_have_failed_devices.diff b/do_not_read_from_mirrors_have_failed_devices.diff deleted file mode 100644 index f0c4f1a..0000000 --- a/do_not_read_from_mirrors_have_failed_devices.diff +++ /dev/null @@ -1,226 +0,0 @@ -commit 9fd7ac7d035f0b2f8dcc3cb19935eb181816bd76 -Author: Jonathan Brassow -Date: Tue Oct 23 23:10:33 2012 -0500 - - mirror: Avoid reading from mirrors that have failed devices - - Addresses: rhbz855398 (Allow VGs to be built on cluster mirrors), - and other issues. - - The LVM code attempts to avoid reading labels from devices that are - suspended to try to avoid situations that may cause the commands to - block indefinitely. When scanning devices, 'ignore_suspended_devices' - can be set so the code (lib/activate/dev_manager.c:device_is_usable()) - checks any DM devices it finds and avoids them if they are suspended. - - The mirror target has an additional mechanism that can cause I/O to - be blocked. If a device in a mirror fails, all I/O will be blocked - by the kernel until a new table (a linear target or a mirror with - replacement devices) is loaded. The mirror indicates that this condition - has happened by marking a 'D' for the faulty device in its status - output. This condition must also be checked by 'device_is_usable()' to - avoid the possibility of blocking LVM commands indefinitely due to an - attempt to read the blocked mirror for labels. - - Until now, mirrors were avoided if the 'ignore_suspended_devices' - condition was set. This check seemed to suggest, "if we are concerned - about suspended devices, then let's ignore mirrors altogether just - in case". This is insufficient and doesn't solve any problems. All - devices that are suspended are already avoided if - 'ignore_suspended_devices' is set; and if a mirror is blocking because - of an error condition, it will block the LVM command regardless of the - setting of that variable. - - Rather than avoiding mirrors whenever 'ignore_suspended_devices' is - set, this patch causes mirrors to be avoided whenever they are blocking - due to an error. (As mentioned above, the case where a DM device is - suspended is already covered.) This solves a number of issues that weren't - handled before. For example, pvcreate (or any command that does a - pv_read or vg_read, which eventually call device_is_usable()) will be - protected from blocked mirrors regardless of how - 'ignore_suspended_devices' is set. Additionally, a mirror that is - neither suspended nor blocking is /allowed/ to be read regardless - of how 'ignore_suspended_devices' is set. (The latter point being the - source of the fix for rhbz855398.) - -diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c -index 31c1c27..6cc57d0 100644 ---- a/lib/activate/dev_manager.c -+++ b/lib/activate/dev_manager.c -@@ -135,6 +135,154 @@ static int _info_run(const char *name, const char *dlid, struct dm_info *info, - return r; - } - -+/* -+ * _parse_mirror_status -+ * @mirror_status_string -+ * @image_health: return for allocated copy of image health characters -+ * @log_health: NULL if corelog, otherwise alloc'ed log health char -+ * -+ * This function takes the mirror status string, breaks it up and returns -+ * its components. For now, we only return the health characters. This -+ * is an internal function. If there are more things we want to return -+ * later, we can do that then. -+ * -+ * Returns: 1 on success, 0 on failure -+ */ -+static int _parse_mirror_status(char *mirror_status_str, -+ char **images_health, char **log_health) -+{ -+ char *p = NULL; -+ char **args, **log_args; -+ unsigned num_devs, log_argc; -+ -+ if (!dm_split_words(mirror_status_str, 1, 0, &p) || -+ !(num_devs = (unsigned) atoi(p))) -+ /* On errors, we must assume the mirror is to be avoided */ -+ return_0; -+ -+ p += strlen(p) + 1; -+ args = alloca((num_devs + 5) * sizeof(char *)); -+ -+ if ((unsigned)dm_split_words(p, num_devs + 4, 0, args) < num_devs + 4) -+ return_0; -+ -+ log_argc = (unsigned) atoi(args[3 + num_devs]); -+ log_args = alloca(log_argc * sizeof(char *)); -+ -+ if ((unsigned)dm_split_words(args[3 + num_devs] + strlen(args[3 + num_devs]) + 1, -+ log_argc, 0, log_args) < log_argc) -+ return_0; -+ -+ *log_health = NULL; -+ if (!strcmp(log_args[0], "disk") && -+ !(*log_health = dm_strdup(log_args[2]))) -+ return_0; -+ -+ if (!(*images_health = dm_strdup(args[2 + num_devs]))) -+ return_0; -+ -+ return 1; -+} -+ -+/* -+ * ignore_blocked_mirror_devices -+ * @dev -+ * @start -+ * @length -+ * @mirror_status_str -+ * -+ * When a DM 'mirror' target is created with 'block_on_error' or -+ * 'handle_errors', it will block I/O if there is a device failure -+ * until the mirror is reconfigured. Thus, LVM should never attempt -+ * to read labels from a mirror that has a failed device. (LVM -+ * commands are issued to repair mirrors; and if LVM is blocked -+ * attempting to read a mirror, a circular dependency would be created.) -+ * -+ * This function is a slimmed-down version of lib/mirror/mirrored.c: -+ * _mirrored_transient_status(). FIXME: It is unable to handle mirrors -+ * with mirrored logs because it does not have a way to get the status of -+ * the mirror that forms the log, which could be blocked. -+ * -+ * If a failed device is detected in the status string, then it must be -+ * determined if 'block_on_error' or 'handle_errors' was used when -+ * creating the mirror. This info can only be determined from the mirror -+ * table. The 'dev', 'start', 'length' trio allow us to correlate the -+ * 'mirror_status_str' with the correct device table in order to check -+ * for blocking. -+ * -+ * Returns: 1 if mirror should be ignored, 0 if safe to use -+ */ -+static int _ignore_blocked_mirror_devices(struct device *dev, -+ uint64_t start, uint64_t length, -+ char *mirror_status_str) -+{ -+ unsigned i, check_for_blocking = 0; -+ char *images_health, *log_health; -+ -+ uint64_t s,l; -+ char *params, *target_type = NULL; -+ void *next = NULL; -+ struct dm_task *dmt; -+ -+ if (!_parse_mirror_status(mirror_status_str, -+ &images_health, &log_health)) -+ goto_out; -+ -+ if (log_health && (log_health[0] != 'A')) { -+ log_debug("%s: Mirror log device marked as failed", -+ dev_name(dev)); -+ check_for_blocking = 1; -+ } -+ -+ for (i = 0; images_health[i]; i++) -+ if (images_health[i] != 'A') { -+ log_debug("%s: Mirror image %d marked as failed", -+ dev_name(dev), i); -+ check_for_blocking = 1; -+ } -+ -+ if (!check_for_blocking) -+ return 0; -+ -+ /* -+ * We avoid another system call if we can, but if a device is -+ * dead, we have no choice but to look up the table too. -+ */ -+ if (!(dmt = dm_task_create(DM_DEVICE_TABLE))) -+ goto_out; -+ -+ if (!dm_task_set_major_minor(dmt, MAJOR(dev->dev), MINOR(dev->dev), 1)) -+ goto_out; -+ -+ if (activation_checks() && !dm_task_enable_checks(dmt)) -+ goto_out; -+ -+ if (!dm_task_run(dmt)) -+ goto_out; -+ -+ do { -+ next = dm_get_next_target(dmt, next, &s, &l, -+ &target_type, ¶ms); -+ if ((s == start) && (l == length)) { -+ if (strcmp(target_type, "mirror")) -+ goto_out; -+ -+ if (strstr(params, "block_on_error") || -+ strstr(params, "handle_errors")) { -+ log_debug("%s: I/O blocked to mirror device", -+ dev_name(dev)); -+ return 1; -+ } -+ } -+ } while (next); -+ dm_task_destroy(dmt); -+ -+ return 0; -+ -+out: -+ return 1; -+} -+ - int device_is_usable(struct device *dev) - { - struct dm_task *dmt; -@@ -180,15 +328,15 @@ int device_is_usable(struct device *dev) - goto out; - } - -- /* FIXME Also check for mirror block_on_error and mpath no paths */ -- /* For now, we exclude all mirrors */ -- -+ /* FIXME Also check for mpath no paths */ - do { - next = dm_get_next_target(dmt, next, &start, &length, - &target_type, ¶ms); -- /* Skip if target type doesn't match */ -- if (target_type && !strcmp(target_type, "mirror") && ignore_suspended_devices()) { -- log_debug("%s: Mirror device %s not usable.", dev_name(dev), name); -+ -+ if (target_type && !strcmp(target_type, "mirror") && -+ _ignore_blocked_mirror_devices(dev, start, length, params)) { -+ log_debug("%s: Mirror device %s not usable.", -+ dev_name(dev), name); - goto out; - } - diff --git a/fix-closedown-before-thread-finish.patch b/fix-closedown-before-thread-finish.patch index de231ae..ba80525 100644 --- a/fix-closedown-before-thread-finish.patch +++ b/fix-closedown-before-thread-finish.patch @@ -1,7 +1,11 @@ -Index: LVM2.2.02.98/daemons/clvmd/clvmd-corosync.c -=================================================================== ---- LVM2.2.02.98.orig/daemons/clvmd/clvmd-corosync.c 2014-04-14 14:08:40.547558968 +0800 -+++ LVM2.2.02.98/daemons/clvmd/clvmd-corosync.c 2014-04-14 14:09:30.440619510 +0800 +--- + daemons/clvmd/clvmd-corosync.c | 6 +++- + daemons/clvmd/clvmd.c | 53 ++++++++++++++++++++++++++++++++++++++++- + daemons/clvmd/clvmd.h | 2 + + 3 files changed, 59 insertions(+), 2 deletions(-) + +--- a/daemons/clvmd/clvmd-corosync.c ++++ b/daemons/clvmd/clvmd-corosync.c @@ -251,8 +251,12 @@ static void corosync_cpg_confchg_callbac ninfo = dm_hash_lookup_binary(node_hash, (char *)&left_list[i].nodeid, @@ -16,17 +20,15 @@ Index: LVM2.2.02.98/daemons/clvmd/clvmd-corosync.c } num_nodes = member_list_entries; -Index: LVM2.2.02.98/daemons/clvmd/clvmd.c -=================================================================== ---- LVM2.2.02.98.orig/daemons/clvmd/clvmd.c 2014-04-14 14:08:40.582559010 +0800 -+++ LVM2.2.02.98/daemons/clvmd/clvmd.c 2014-04-14 14:09:59.751655009 +0800 -@@ -1602,6 +1602,56 @@ static void process_remote_command(struc - free(replyargs); +--- a/daemons/clvmd/clvmd.c ++++ b/daemons/clvmd/clvmd.c +@@ -1613,6 +1613,57 @@ static void process_remote_command(struc + dm_free(replyargs); } -+void decrease_inflight_expected_reply(char *nodename) ++void decrease_inflight_expected_reply(const char *nodename) +{ -+ struct local_client * thisfd; ++ struct local_client *thisfd; + struct node_reply *reply; + + DEBUGLOG("remote node %s down", nodename); @@ -34,30 +36,33 @@ Index: LVM2.2.02.98/daemons/clvmd/clvmd.c + for (thisfd = &local_client_head; thisfd != NULL; + thisfd = thisfd->next) { + /* in-flight request */ -+ if (thisfd->type == LOCAL_SOCK -+ && thisfd->bits.localsock.sent_out -+ && thisfd->bits.localsock.in_progress -+ && ! thisfd->bits.localsock.finished -+ && thisfd->bits.localsock.expected_replies > -+ thisfd->bits.localsock.num_replies) { ++ if (thisfd->type == LOCAL_SOCK && ++ thisfd->bits.localsock.sent_out && ++ thisfd->bits.localsock.in_progress && ++ !thisfd->bits.localsock.finished && ++ thisfd->bits.localsock.expected_replies > ++ thisfd->bits.localsock.num_replies) { + -+ pthread_mutex_lock(&thisfd->bits.localsock.reply_mutex); ++ pthread_mutex_lock(&thisfd->bits.localsock.mutex); + + reply = thisfd->bits.localsock.replies; + while (reply && strcmp(reply->node, nodename) != 0) { + reply = reply->next; + } -+ /* if the remote down server has replies,do not decrease the expected_replies */ ++ /* ++ * if the remote down server has replies, ++ * do not decrease the expected_replies ++ */ + if (reply) + continue; + + thisfd->bits.localsock.expected_replies--; -+ DEBUGLOG -+ ("remote node down, decrement the expected replies to (%ld),num_replies(%ld)", ++ DEBUGLOG("remote node down, decrement the expected replies to (%d), num_replies(%d)", + thisfd->bits.localsock.expected_replies, -+ thisfd->bits.localsock.num_replies) ++ thisfd->bits.localsock.num_replies); + -+ if (thisfd->bits.localsock.expected_replies <= thisfd->bits.localsock.num_replies) { ++ if (thisfd->bits.localsock.expected_replies <= ++ thisfd->bits.localsock.num_replies) { + /* tell pre_and_post thread to finish */ + if (thisfd->bits.localsock.threadid) { + thisfd->bits.localsock.all_success = 0; @@ -67,35 +72,31 @@ Index: LVM2.2.02.98/daemons/clvmd/clvmd.c + pthread_mutex_unlock(&thisfd->bits.localsock.mutex); + } + } -+ pthread_mutex_unlock(&thisfd->bits.localsock.reply_mutex); -+ ++ pthread_mutex_unlock(&thisfd->bits.localsock.mutex); + } + } -+ +} + /* Add a reply to a command to the list of replies for this client. If we have got a full set then send them to the waiting client down the local socket */ -@@ -1643,7 +1693,7 @@ static void add_reply_to_list(struct loc - client->bits.localsock.expected_replies); +@@ -1652,7 +1703,7 @@ static void add_reply_to_list(struct loc - /* If we have the whole lot then do the post-process */ -- if (++client->bits.localsock.num_replies == -+ if (++client->bits.localsock.num_replies >= - client->bits.localsock.expected_replies) { + /* If we have the whole lot then do the post-process */ /* Post-process the command */ - if (client->bits.localsock.threadid) { -Index: LVM2.2.02.98/daemons/clvmd/clvmd.h -=================================================================== ---- LVM2.2.02.98.orig/daemons/clvmd/clvmd.h 2014-04-14 14:08:40.564558988 +0800 -+++ LVM2.2.02.98/daemons/clvmd/clvmd.h 2014-04-14 14:09:30.442619512 +0800 -@@ -112,6 +112,8 @@ extern int do_post_command(struct local_ +- if (++client->bits.localsock.num_replies == ++ if (++client->bits.localsock.num_replies >= + client->bits.localsock.expected_replies) { + client->bits.localsock.state = POST_COMMAND; + pthread_cond_signal(&client->bits.localsock.cond); +--- a/daemons/clvmd/clvmd.h ++++ b/daemons/clvmd/clvmd.h +@@ -110,6 +110,8 @@ extern int do_post_command(struct local_ extern void cmd_client_cleanup(struct local_client *client); extern int add_client(struct local_client *new_client); + -+extern void decrease_inflight_expected_reply(); ++extern void decrease_inflight_expected_reply(const char *nodename); extern void clvmd_cluster_init_completed(void); extern void process_message(struct local_client *client, char *buf, int len, const char *csid); diff --git a/handle_extended_devt.diff b/handle_extended_devt.diff deleted file mode 100644 index b5a436b..0000000 --- a/handle_extended_devt.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- - lib/filters/filter.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- LVM2.2.02.98.orig/lib/filters/filter.c -+++ LVM2.2.02.98/lib/filters/filter.c -@@ -180,6 +180,10 @@ static int _scan_proc_dev(const char *pr - /* All types unrecognised initially */ - memset(_partitions, 0, sizeof(_partitions)); - -+ /* Extended devt will use MAJOR 259 -+ Consider it an non-partitionable block device */ -+ _partitions[259].max_partitions = 1; -+ - if (dm_snprintf(proc_devices, sizeof(proc_devices), - "%s/devices", proc) < 0) { - log_error("Failed to create /proc/devices string"); diff --git a/improve-mirror-legs-on-different-tag-pvs.patch b/improve-mirror-legs-on-different-tag-pvs.patch index c1af385..ecef5a9 100644 --- a/improve-mirror-legs-on-different-tag-pvs.patch +++ b/improve-mirror-legs-on-different-tag-pvs.patch @@ -13,22 +13,23 @@ one. Signed-off-by: Guangliang Zhao --- - lib/metadata/lv_manip.c | 25 ++++++++++++++++++++++--- - 1 file changed, 22 insertions(+), 3 deletions(-) + lib/metadata/lv_manip.c | 34 +++++++++++++++++++++++++++++++--- + 1 file changed, 31 insertions(+), 3 deletions(-) -diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c -index fb0199f..edafdf1 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c -@@ -1658,6 +1658,21 @@ static uint32_t _calc_required_extents(struct alloc_handle *ah, struct pv_area * +@@ -2481,6 +2481,25 @@ static uint32_t _calc_required_extents(s return required; } -+static void _replace_required_area(struct alloc_handle *ah, uint32_t max_to_allocate, ++static void _replace_required_area(struct alloc_handle *ah, ++ uint32_t max_to_allocate, + unsigned ix_pva, struct pv_area *pva, -+ struct alloc_state *alloc_state, alloc_policy_t alloc) ++ struct alloc_state *alloc_state, ++ alloc_policy_t alloc) +{ -+ uint32_t required = _calc_required_extents(ah, pva, ix_pva, max_to_allocate, alloc); ++ uint32_t required = _calc_required_extents(ah, pva, ix_pva, ++ max_to_allocate, alloc); + + /* + * We don't worry about the area replaced, because _clear_areas() and @@ -36,36 +37,39 @@ index fb0199f..edafdf1 100644 + * the alloc_state and reserved areas every time. + */ + if (required > alloc_state->areas[ix_pva - 1].used) -+ _reserve_area(&alloc_state->areas[ix_pva - 1], pva, required, ix_pva, pva->unreserved); ++ _reserve_area(alloc_state, pva, required, ix_pva - 1, ++ pva->unreserved); +} + - static int _reserve_required_area(struct alloc_handle *ah, uint32_t max_to_allocate, - unsigned ix_pva, struct pv_area *pva, - struct alloc_state *alloc_state, alloc_policy_t alloc) -@@ -1767,6 +1782,7 @@ static int _find_some_parallel_space(struct alloc_handle *ah, const struct alloc + static void _clear_areas(struct alloc_state *alloc_state) { + uint32_t s; +@@ -2575,6 +2594,7 @@ static int _find_some_parallel_space(str + const struct alloc_parms *alloc_parms = alloc_state->alloc_parms; unsigned ix = 0; unsigned last_ix; + int ret; struct pv_map *pvm; struct pv_area *pva; unsigned preferred_count = 0; -@@ -1875,9 +1891,12 @@ static int _find_some_parallel_space(struct alloc_handle *ah, const struct alloc +@@ -2695,9 +2715,17 @@ static int _find_some_parallel_space(str continue; case USE_AREA: - if(check_areas_separate_tags(ah, alloc_state, ix_offset, - ix + ix_offset, pva) >= 0) - goto next_pv; -+ if((ret = check_areas_separate_tags(ah, alloc_state, ix_offset, -+ ix + ix_offset, pva)) >= 0) { -+ _replace_required_area(ah, max_to_allocate, ret + 1, -+ pva, alloc_state, alloc_parms->alloc); ++ ret = check_areas_separate_tags(ah, ++ alloc_state, ix_offset, ++ ix + ix_offset, pva); ++ if (ret >= 0) { ++ _replace_required_area(ah, ++ max_to_allocate, ++ ret + 1, pva, ++ alloc_state, ++ alloc_parms->alloc); + continue; + } /* * Except with ALLOC_ANYWHERE, replace first area with this --- -1.7.10.4 - diff --git a/improve_probing.diff b/improve_probing.diff index 707ce51..5fac86a 100644 --- a/improve_probing.diff +++ b/improve_probing.diff @@ -1,39 +1,30 @@ ---- - lib/filters/filter.c | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) - ---- LVM2.2.02.98.orig/lib/filters/filter.c -+++ LVM2.2.02.98/lib/filters/filter.c -@@ -13,6 +13,12 @@ +Index: LVM2.2.02.111/lib/filters/filter-type.c +=================================================================== +--- LVM2.2.02.111.orig/lib/filters/filter-type.c ++++ LVM2.2.02.111/lib/filters/filter-type.c +@@ -12,6 +12,11 @@ + * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - +#include +#include +#undef MAJOR +#undef MINOR +#undef MKDEV -+ - #include "lib.h" - #include "dev-cache.h" - #include "filter.h" -@@ -111,11 +117,18 @@ static int _passes_lvm_type_device_filte - } - /* Check it's accessible */ -- if (!dev_open_readonly_quiet(dev)) { -+ if (!dev_open_flags(dev, O_RDONLY|O_NONBLOCK, 1, 1)) { - log_debug("%s: Skipping: open failed", name); + #include "lib.h" + #include "filter.h" +@@ -28,6 +33,13 @@ static int _passes_lvm_type_device_filte return 0; } -+ /* Skip cdrom device */ -+ #define CDROM_GET_CAPABILITY 0x5331 -+ if (ioctl(dev->fd, CDROM_GET_CAPABILITY) >= 0) { -+ log_debug("%s: Skipping: cdrom device", name ); -+ goto out; -+ } ++ /* Skip cdrom device */ ++ #define CDROM_GET_CAPABILITY 0x5331 ++ if (ioctl(dev->fd, CDROM_GET_CAPABILITY) >= 0) { ++ log_debug_devs("%s: Skipping: cdrom device", name ); ++ return 0; ++ } + - /* Check it's not too small */ - if (!dev_get_size(dev, &size)) { - log_debug("%s: Skipping: dev_get_size failed", name); + return 1; + } + diff --git a/lvconvert-cluster-mirrored-disk-failed.patch b/lvconvert-cluster-mirrored-disk-failed.patch index a4884ba..39bc02f 100644 --- a/lvconvert-cluster-mirrored-disk-failed.patch +++ b/lvconvert-cluster-mirrored-disk-failed.patch @@ -1,34 +1,47 @@ -Index: LVM2.2.02.98/daemons/clvmd/lvm-functions.c -=================================================================== ---- LVM2.2.02.98.orig/daemons/clvmd/lvm-functions.c -+++ LVM2.2.02.98/daemons/clvmd/lvm-functions.c -@@ -418,11 +418,13 @@ static int do_resume_lv(char *resource, - int oldmode, origin_only, exclusive, revert; +--- + daemons/clvmd/lvm-functions.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +--- a/daemons/clvmd/lvm-functions.c ++++ b/daemons/clvmd/lvm-functions.c +@@ -416,16 +416,18 @@ error: + /* Resume the LV if it was active */ + static int do_resume_lv(char *resource, unsigned char command, unsigned char lock_flags) + { +- int oldmode, origin_only, exclusive, revert; ++ int oldmode, origin_only, exclusive = 0, revert; ++#if 0 /* Is it open ? */ -+ /* oldmode = get_current_lock(resource); if (oldmode == -1 && (command & LCK_CLUSTER_VG)) { DEBUGLOG("do_resume_lv, lock not already held\n"); -- return 0; /* We don't need to do anything */ -+ return 0; + return 0; /* We don't need to do anything */ } -+ */ - origin_only = (lock_flags & LCK_ORIGIN_ONLY_MODE) ? 1 : 0; +- origin_only = (lock_flags & LCK_ORIGIN_ONLY_MODE) ? 1 : 0; exclusive = (oldmode == LCK_EXCL) ? 1 : 0; ++#endif ++ origin_only = (lock_flags & LCK_ORIGIN_ONLY_MODE) ? 1 : 0; revert = (lock_flags & LCK_REVERT_MODE) ? 1 : 0; -@@ -442,11 +444,13 @@ static int do_suspend_lv(char *resource, - unsigned exclusive; + if (!lv_resume_if_active(cmd, resource, origin_only, exclusive, revert, NULL)) +@@ -439,16 +441,17 @@ static int do_suspend_lv(char *resource, + { + int oldmode; + unsigned origin_only = (lock_flags & LCK_ORIGIN_ONLY_MODE) ? 1 : 0; +- unsigned exclusive; ++ unsigned exclusive = 0; + ++#if 0 /* Is it open ? */ -+ /* oldmode = get_current_lock(resource); if (oldmode == -1 && (command & LCK_CLUSTER_VG)) { DEBUGLOG("do_suspend_lv, lock not already held\n"); -- return 0; /* Not active, so it's OK */ -+ return 0; + return 0; /* Not active, so it's OK */ } -+ */ - +- exclusive = (oldmode == LCK_EXCL) ? 1 : 0; ++#endif + /* Always call lv_suspend to read commited and precommited data */ + if (!lv_suspend_if_active(cmd, resource, origin_only, exclusive, NULL, NULL)) diff --git a/lvm-path.patch b/lvm-path.patch deleted file mode 100644 index 8a4d31a..0000000 --- a/lvm-path.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: LVM2.2.02.98/scripts/lvm2_activation_generator_systemd_red_hat.c -=================================================================== ---- LVM2.2.02.98.orig/scripts/lvm2_activation_generator_systemd_red_hat.c -+++ LVM2.2.02.98/scripts/lvm2_activation_generator_systemd_red_hat.c -@@ -125,7 +125,7 @@ static int generate_unit(const char *dir - fputs("Before=local-fs.target shutdown.target\n" - "Wants=systemd-udev-settle.service\n\n" - "[Service]\n" -- "ExecStart=/usr/sbin/lvm vgchange -aay --sysinit\n" -+ "ExecStart=/sbin/lvm vgchange -aay --sysinit\n" - "Type=oneshot\n", f); - - if (fclose(f) < 0) { diff --git a/lvm2.changes b/lvm2.changes index 2433089..68a2f6d 100644 --- a/lvm2.changes +++ b/lvm2.changes @@ -1,3 +1,62 @@ +------------------------------------------------------------------- +Wed Sep 24 08:24:13 UTC 2014 - lwang@suse.com + +- All patches eliminated since update to 2.02.111 + - Eliminated 25 patches in lvm2 package: + no_buildroot_shared.diff: don't know why necessary change this + pipe_buff-definition.diff: don't know why necessary + handle_extended_devt.diff: not need(bnc#525060 not reproduce even without this patch) + support-drbd-filter.diff: source to patch not found + lvm-path.patch: if no_buildroot_shared.diff not add, this patch not needed. + suppress_locking_failer_message.patch: no doc as to why suppress warning + add_scm_support.patch: definition device_info_t _device_info is no longer exist + upstream patches(18): + man_page_sectors.diff + make_raid1_default.diff + remove-fedora-systemd.patch + 0001-lvmetad-Init-lazily-to-avoid-socket-access-on-config.patch + do_not_read_from_mirrors_have_failed_devices.diff + avoid_reading_failed_dev_in_mirrored_log.diff + mirrored_log_fixed_when_double_fault_occurs.diff + device_is_usable_mem_leak.diff + clmvd-fix-decriptor-leak-on-restart.patch + clvmd-Fix-node-up-down-handing-in-corosync-module.patch + clvmd-Avoid-a-3-way-deadlock-in-dead-client-cleanup.patch + 0001-clvmd-avoid-logging-in-signal-handler.patch + 0001-RAID-Make-RAID-4-5-6-display-sync-status-under-headi.patch + clvmd-fix-debugging-level-set-in-clvmd_set_debug-function.patch + 0001-toolcontext-Only-reopen-stdin-if-readable.patch + systemd-lvm2-activation-generator-report-only-error.patch + systemd-use-umask-022-for-generated-systemd-units-by.patch + remove-quote-in-lvm2-monitor.patch + + - Eliminated 6 patches in device-mapper package: + bug-479104_device-mapper-dmsetup-deps-export.patch:merged with device-mapper-dmsetup-export.patch + udev_sync-cookie_set-1-on-each-dm_task_set_cookie-ca.patch: already included in upstream + increase-minor-version.diff: not needed + segault_for_truncated_string_token.patch: upstream + s390-sectorsize4096.patch: upstream + add_integrate_flush_flag.patch: included in cmirrord_improvment_performance.patch + +------------------------------------------------------------------- +Wed Sep 24 02:34:46 UTC 2014 - lwang@suse.com + +- cmirrord has endian issue which cause cmirrord start fail on s390 + patch: cmirrord-fix-s390-endian-issue.patch(bnc#890452,bnc#893684) + +------------------------------------------------------------------- +Thu Sep 11 15:55:50 UTC 2014 - jeffm@suse.com + +- Integrated device-mapper and thin-provisioning packages into + lvm2 package. device-mapper and lvm2 have been included in + the same source repository for some time. + +------------------------------------------------------------------- +Thu Sep 11 05:17:27 UTC 2014 - jeffm@suse.com + +- Update to 2.02.111 + - Eliminated 21 patches. + ------------------------------------------------------------------- Wed Sep 3 01:48:48 CEST 2014 - ro@suse.de diff --git a/lvm2.spec b/lvm2.spec index 1760d85..4c88f33 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -16,10 +16,17 @@ # +%define lvm2_version 2.02.111 +%define device_mapper_version 1.02.90 +%define thin_provisioning_version 0.4.1 + Url: http://www.sourceware.org/lvm2/ Name: lvm2 +BuildRequires: autoconf +BuildRequires: automake BuildRequires: device-mapper-devel +BuildRequires: libaio-devel BuildRequires: libcorosync-devel BuildRequires: libdlm-devel BuildRequires: libselinux-devel @@ -30,7 +37,7 @@ BuildRequires: systemd-rpm-macros BuildRequires: pkgconfig(udev) Requires: device-mapper >= 1.02.25 Provides: lvm -Version: 2.02.98 +Version: %{lvm2_version} Release: 0 Summary: Logical Volume Manager Tools License: GPL-2.0 and LGPL-2.1 @@ -42,83 +49,55 @@ Source8: clvmd.ocf Source10: cmirrord.ocf Source14: baselibs.conf Source16: csm-converter.tar.gz +Source50: thin-provisioning-tools-v%{thin_provisioning_version}.tar.gz -Patch: improve_probing.diff +Patch1: improve_probing.diff Patch2: no-inc-audit.diff -Patch3: no_buildroot_shared.diff -Patch4: sys_mount_instead_linux_fs.diff -Patch6: man_page_sectors.diff +Patch3: sys_mount_instead_linux_fs.diff -Patch13: pipe_buff-definition.diff - -Patch20: support-drbd-filter.diff -Patch22: handle_extended_devt.diff #suse -Patch23: display-dm-name-for-lv-name.diff +Patch4: display-dm-name-for-lv-name.diff -Patch66: device-mapper-type_punning.diff -Patch67: lvm-path.patch +Patch5: device-mapper-type_punning.diff -#fate312248,patch68,69 -Patch68: make-mirror-legs-on-different-tag-pvs.patch -Patch69: improve-mirror-legs-on-different-tag-pvs.patch - -#upstream -Patch71: make_raid1_default.diff -#suppress warning -Patch72: suppress_locking_failer_message.patch -#upstream -Patch73: remove-fedora-systemd.patch +#fate312248, patch6,7 +Patch6: make-mirror-legs-on-different-tag-pvs.patch +Patch7: improve-mirror-legs-on-different-tag-pvs.patch #fate#315092 -Patch75: cmirrord_improvment_performance.patch +Patch8: cmirrord_improvment_performance.patch -#bnc#862076 -Patch76: 0001-lvmetad-Init-lazily-to-avoid-socket-access-on-config.patch - -#fate#314367 -Patch77: cluster_support_mirrord_log.diff -Patch78: lvconvert-cluster-mirrored-disk-failed.patch - -Patch79: add_scm_support.patch - -#upstream backport -Patch80: do_not_read_from_mirrors_have_failed_devices.diff -Patch81: avoid_reading_failed_dev_in_mirrored_log.diff -Patch82: mirrored_log_fixed_when_double_fault_occurs.diff -Patch83: device_is_usable_mem_leak.diff +#fate#314367, patch10,11 +Patch9: cluster_support_mirrord_log.diff +Patch10: lvconvert-cluster-mirrored-disk-failed.patch #forward-port from sle11 -Patch84: suppress_format1_size_warning.diff -Patch85: pvmove_support_clustered_vg.diff - -#upstream -Patch86: clmvd-fix-decriptor-leak-on-restart.patch -Patch87: clvmd-Fix-node-up-down-handing-in-corosync-module.patch -Patch88: clvmd-Avoid-a-3-way-deadlock-in-dead-client-cleanup.patch -Patch89: 0001-clvmd-avoid-logging-in-signal-handler.patch +Patch11: suppress_format1_size_warning.diff +Patch12: pvmove_support_clustered_vg.diff # Never upstream -Patch90: cmirrord_remove_date_time_from_compilation.patch +Patch13: cmirrord_remove_date_time_from_compilation.patch -#upstream, bnc#871176 -Patch91: 0001-RAID-Make-RAID-4-5-6-display-sync-status-under-headi.patch -#fixed in upstream,bnc#785467 -Patch92: clvmd-fix-debugging-level-set-in-clvmd_set_debug-function.patch -#upstream -Patch93: 0001-toolcontext-Only-reopen-stdin-if-readable.patch #suse, bnc873538 -Patch94: fix-closedown-before-thread-finish.patch -#upstream -Patch95: systemd-lvm2-activation-generator-report-only-error.patch +Patch14: fix-closedown-before-thread-finish.patch #suse, bnc#870824 -Patch96: use-mirrortype-asdefault-whenclvmdrunning.patch -# bnc#878481 -Patch97: systemd-use-umask-022-for-generated-systemd-units-by.patch -# bnc#878930 -Patch98: remove-quote-in-lvm2-monitor.patch -# bnc#875233 -Patch99: udev-Check-for-DM_NR_VALID_PATHS.patch +Patch15: use-mirrortype-asdefault-whenclvmdrunning.patch + +Patch16: version-plugins-in-libdir + +#suse, bnc#890452,bnc#893684 +Patch17: cmirrord-fix-s390-endian-issue.patch + +# device-mapper patches +#suse, bnc#707253(also merged patch for bnc#479104) +Patch200: device-mapper-dmsetup-export.patch +Patch201: device-mapper-gcc-warnings.patch +Patch202: device-mapper-static.patch +Patch203: device-mapper-link +#suse, bnc#78902,bnc#789019,bnc#789020 +Patch204: udev_rules-update.diff +#suse, bnc#875233 +Patch205: udev-Check-for-DM_NR_VALID_PATHS.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build # Not a real replacement but we drop evms @@ -132,57 +111,41 @@ Obsoletes: evms-gui <= 2.5.5 Obsoletes: evms-ha <= 2.5.5 %define _udevdir %(pkg-config --variable=udevdir udev) +%if %{defined systemd_requires} %{systemd_requires} +%endif %description Programs and man pages for configuring and using the LVM2 Logical Volume Manager. - %prep -%setup -q -n LVM2.%{version} -%patch -p1 -%patch2 -%patch3 -%patch4 +%setup -q -n LVM2.%{version} -a 50 -a 16 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 %patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 %patch13 -p1 -%patch20 -p1 -%patch22 -p1 -%patch23 -p1 -%patch66 -p1 -%patch67 -p1 -%patch68 -p1 -%patch69 -p1 -%patch71 -p1 -%patch72 -p1 -%patch73 -p1 -%patch75 -p1 -%patch76 -p1 -%patch77 -p1 -%patch78 -p1 -%patch79 -p1 -%patch80 -p1 -%patch81 -p1 -%patch82 -p1 -%patch83 -p1 -%patch84 -p1 -%patch85 -p1 -%patch86 -p1 -%patch87 -p1 -%patch88 -p1 -%patch89 -p1 -%patch90 -p1 -%patch91 -p1 -%patch92 -p1 -%patch93 -p1 -%patch94 -p1 -%patch95 -p1 -%patch96 -p1 -%patch97 -p1 -%patch98 -p1 -%patch99 -p1 +%patch14 -p1 +%patch15 -p1 +%patch16 -p1 +%patch17 -p1 + +%patch200 -p1 +%patch201 -p1 +%patch202 -p1 +%patch203 -p1 +%patch204 -p1 +%patch205 -p1 %build #set path so that thin_check can be found @@ -190,76 +153,86 @@ Volume Manager. export MODPROBE_CMD=/sbin/modprobe export CFLAGS="$RPM_OPT_FLAGS" export PATH=$PATH:/sbin:/usr/sbin -%configure --prefix=/ \ - --bindir=/bin --libdir=/%_lib --with-usrlibdir=%_libdir \ - --sbindir=/sbin --enable-dmeventd \ - --enable-udev_sync --enable-udev_rules \ - --enable-cmdlib --enable-applib --enable-dmeventd \ - --enable-realtime --enable-pkgconfig \ +sed -ie "s/%{device_mapper_version}/1.03.01/g" VERSION_DM +autoreconf -fvi +%configure \ + --prefix=/ \ + --bindir=/bin \ + --libdir=/%_lib \ + --with-usrlibdir=%_libdir \ + --with-usrsbindir=%_sbindir \ + --sbindir=/sbin \ + --enable-dmeventd \ + --enable-udev_sync \ + --enable-udev_rules \ + --enable-cmdlib \ + --enable-applib \ + --enable-dmeventd \ + --enable-realtime \ + --enable-pkgconfig \ --enable-selinux \ - --with-clvmd=corosync --with-cluster=internal --with-cluster=internal \ - --datarootdir=/usr/share --with-default-locking-dir=/run/lock/lvm \ - --enable-cmirrord --with-thin=internal --enable-lvmetad --with-default-pid-dir=/run \ - --with-default-dm-run-dir=/run --with-default-run-dir=/run/lvm --with-tmpfilesdir=%{_tmpfilesdir} + --with-clvmd=corosync \ + --with-cluster=internal \ + --datarootdir=/usr/share \ + --with-default-locking-dir=/run/lock/lvm \ + --enable-cmirrord \ + --enable-lvmetad \ + --with-default-pid-dir=/run \ + --with-default-dm-run-dir=/run \ + --with-default-run-dir=/run/lvm \ + --with-tmpfilesdir=%{_tmpfilesdir} \ + --with-thin=internal \ + --with-device-gid=6 \ + --with-device-mode=0640 \ + --with-device-uid=0 \ + --with-dmeventd-path=/sbin/dmeventd \ + --with-thin-check=/sbin/thin_check \ + --with-thin-dump=%{_sbindir}/thin_dump \ + --with-thin-repair=%{_sbindir}/thin_repair \ + --with-udev-prefix=/usr/ + export SUSE_ASNEEDED=0 -make -j1 # symlinks are generated in parallel! %{?_smp_mflags} + +make %{?_smp_mflags} #csm convert -tar zxvf %{S:16} pushd bnz -make +make %{?_smp_mflags} +popd + +pushd thin-provisioning-tools-%{thin_provisioning_version} +autoreconf -fiv +%configure --sbindir=/sbin --prefix=/usr +make %{?_smp_mflags} popd %install -make install_lvm2 DESTDIR=$RPM_BUILD_ROOT +%makeinstall +#make install_initscripts DESTDIR=$RPM_BUILD_ROOT make install_system_dirs DESTDIR=$RPM_BUILD_ROOT make install_systemd_units DESTDIR=$RPM_BUILD_ROOT make install_systemd_generators DESTDIR=$RPM_BUILD_ROOT make install_tmpfiles_configuration DESTDIR=$RPM_BUILD_ROOT -make -C liblvm install DESTDIR=$RPM_BUILD_ROOT -install -d -m 755 $RPM_BUILD_ROOT/etc/lvm -install -d -m 755 $RPM_BUILD_ROOT/etc/lvm/backup -install -d -m 755 $RPM_BUILD_ROOT/etc/lvm/archive +# Is this directory used anymore? install -d -m 755 $RPM_BUILD_ROOT/etc/lvm/metadata install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/etc/lvm mkdir -p $RPM_BUILD_ROOT/etc/init.d install -m755 -D %{S:8} $RPM_BUILD_ROOT/usr/lib/ocf/resource.d/lvm2/clvmd install -m755 -D %{S:10} $RPM_BUILD_ROOT/usr/lib/ocf/resource.d/lvm2/cmirrord - -rm -f $RPM_BUILD_ROOT/%_libdir/libdevmapper-event-lvm2.so -ln -sf libdevmapper-event-lvm2.so.2.02 $RPM_BUILD_ROOT/%_lib/libdevmapper-event-lvm2.so +#install -m755 -D %{S:7} $RPM_BUILD_ROOT%{_udevdir}/collect_lvm pushd $RPM_BUILD_ROOT/%_lib -rm -f $RPM_BUILD_ROOT/%_libdir/liblvm2app.so -rm -f $RPM_BUILD_ROOT/%_libdir/liblvm2cmd.so -ln -sf liblvm2cmd.so.2.02 liblvm2cmd.so -ln -sf liblvm2app.so.2.2 liblvm2app.so +ln -sf liblvm2cmd.so.2.02 liblvm2cmd.so +ln -sf liblvm2app.so.2.2 liblvm2app.so ln -sf device-mapper/libdevmapper-event-lvm2mirror.so libdevmapper-event-lvm2mirror.so.2.02 ln -sf device-mapper/libdevmapper-event-lvm2snapshot.so libdevmapper-event-lvm2snapshot.so.2.02 ln -sf device-mapper/libdevmapper-event-lvm2raid.so libdevmapper-event-lvm2raid.so.2.02 ln -sf device-mapper/libdevmapper-event-lvm2thin.so libdevmapper-event-lvm2thin.so.2.02 -popd -install -d $RPM_BUILD_ROOT/usr/sbin -pushd daemons/clvmd -make install DESTDIR=$RPM_BUILD_ROOT -popd -pushd daemons/cmirrord -make install DESTDIR=$RPM_BUILD_ROOT -popd -pushd man -make install DESTDIR=$RPM_BUILD_ROOT -popd -mv $RPM_BUILD_ROOT/sbin/clvmd $RPM_BUILD_ROOT/usr/sbin/clvmd -mv $RPM_BUILD_ROOT/sbin/cmirrord $RPM_BUILD_ROOT/usr/sbin/cmirrord -mkdir -p $RPM_BUILD_ROOT/usr/share -rm $RPM_BUILD_ROOT/etc/lvm/cache/.cache -#remove device-mapper man page -rm -f $RPM_BUILD_ROOT/%{_mandir}/man8/dm* -#remove device-mapper systemd events -rm -f $RPM_BUILD_ROOT/%{_unitdir}/dm-event.socket -rm -f $RPM_BUILD_ROOT/%{_unitdir}/dm-event.service -# install and collect_lvm -#install -m755 -D %{S:7} $RPM_BUILD_ROOT%{_udevdir}/collect_lvm +ln -sf device-mapper/libdevmapper-event-lvm2mirror.so libdevmapper-event-lvm2mirror.so +ln -sf device-mapper/libdevmapper-event-lvm2snapshot.so libdevmapper-event-lvm2snapshot.so +ln -sf device-mapper/libdevmapper-event-lvm2raid.so libdevmapper-event-lvm2raid.so +ln -sf device-mapper/libdevmapper-event-lvm2thin.so libdevmapper-event-lvm2thin.so +popd #csm-convert pushd bnz @@ -268,6 +241,10 @@ install -m755 -D csm-converter-helper $RPM_BUILD_ROOT/usr/sbin/csm-converter-hel mv README.csm-converter .. popd +pushd thin-provisioning-tools-%{thin_provisioning_version} +%makeinstall +popd + %pre %service_add_pre blk-availability.service lvm2-monitor.service lvm2-lvmetad.socket lvm2-lvmetad.service @@ -293,12 +270,19 @@ popd %dir /etc/lvm/backup %dir /etc/lvm/archive %dir /etc/lvm/metadata +%dir /etc/lvm/profile +%dir /etc/lvm/cache +%dir /usr/lib/systemd/system-generators +%dir /usr/lib/tmpfiles.d +%ghost /etc/lvm/cache/.cache +/etc/lvm/profile/*.profile %{_udevdir}/rules.d/11-dm-lvm.rules %{_udevdir}/rules.d/69-dm-lvm-metad.rules %{_unitdir}/blk-availability.service %{_unitdir}/lvm2-monitor.service %{_unitdir}/lvm2-lvmetad.socket %{_unitdir}/lvm2-lvmetad.service +%{_unitdir}/lvm2-pvscan@.service %{_tmpfilesdir}/lvm2.conf %config /etc/lvm/lvm.conf /usr/lib/systemd/system-generators/lvm2-activation-generator @@ -364,11 +348,13 @@ popd /%_lib/liblvm2cmd.so.2.02 /%_lib/liblvm2app.so /%_lib/liblvm2app.so.2.2 +/%_libdir/liblvm2app.so +/%_libdir/liblvm2cmd.so /%_lib/libdevmapper-event-lvm2mirror.so.2.02 /%_lib/libdevmapper-event-lvm2snapshot.so.2.02 /%_lib/libdevmapper-event-lvm2raid.so.2.02 /%_lib/libdevmapper-event-lvm2thin.so.2.02 -/%_lib/libdevmapper-event-lvm2.so +/%_libdir/libdevmapper-event-lvm2.so /%_lib/libdevmapper-event-lvm2.so.2.02 %{_mandir}/man5/lvm.conf.5.gz %{_mandir}/man8/blkdeactivate.8.gz @@ -420,10 +406,13 @@ popd %{_mandir}/man8/lvmsadc.8.gz %{_mandir}/man8/lvmsar.8.gz %{_mandir}/man8/lvmetad.8.gz +%{_mandir}/man7/lvmthin.7.gz +%{_mandir}/man8/lvm-dumpconfig.8.gz +%{_mandir}/man8/lvm2-activation-generator.8.gz %package clvm Url: http://sources.redhat.com/cluster/clvm/ -Version: 2.02.98 +Version: %{lvm2_version} Release: 0 Requires: corosync Requires: device-mapper >= 1.02.25 @@ -450,10 +439,13 @@ A daemon for using LVM2 Logival Volumes in a clustered environment. %doc README.csm-converter /usr/sbin/csm-converter /usr/sbin/csm-converter-helper +%{_unitdir}/lvm2-clvmd.service +%{_unitdir}/lvm2-cluster-activation.service +/usr/lib/systemd/lvm2-cluster-activation %package cmirrord Url: http://www.sourceware.org/lvm2/ -Version: 2.02.98 +Version: %{lvm2_version} Release: 0 Requires: corosync Requires: device-mapper >= 1.02.25 @@ -472,9 +464,10 @@ A daemon for using LVM2 Logival Volumes in a clustered environment. /usr/sbin/cmirrord /usr/lib/ocf/resource.d/lvm2/cmirrord %{_mandir}/man8/cmirrord.8.gz +/usr/lib/systemd/system/lvm2-cmirrord.service %package devel -Version: 2.02.98 +Version: %{lvm2_version} Release: 0 Requires: lvm2 = %{version} Summary: Development files for LVM2 @@ -490,4 +483,116 @@ This package provides development files for the LVM2 Logical Volume Manager. /usr/include/lvm2app.h %_libdir/pkgconfig/lvm2app.pc +########################################## +# Subpackage: device-mapper +########################################## +%package -n device-mapper + +%ifarch ppc64 +Obsoletes: device-mapper-64bit +%endif +Version: %{device_mapper_version} +Release: 0 +Summary: Device Mapper Tools +Group: System/Base +BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: boost-devel +BuildRequires: gcc-c++ +BuildRequires: libexpat-devel +BuildRequires: libselinux-devel +BuildRequires: libsepol-devel +BuildRequires: libstdc++-devel +BuildRequires: suse-module-tools +BuildRequires: systemd-rpm-macros +BuildRequires: pkgconfig(libudev) +Requires: expat +PreReq: %insserv_prereq %fillup_prereq + +%description -n device-mapper +Programs, libraries, and man pages for configuring and using the device +mapper. + +%post -n device-mapper +%service_add_post dm-event.service dm-event.socket +/sbin/ldconfig +%{?regenerate_initrd_post} + +%posttrans -n device-mapper +%{?regenerate_initrd_posttrans} + +%pre -n device-mapper +%service_add_pre dm-event.service dm-event.socket + +%preun -n device-mapper +%service_del_preun dm-event.service dm-event.socket + +%postun -n device-mapper +%service_del_postun dm-event.service dm-event.socket +/sbin/ldconfig + +%files -n device-mapper +%defattr(-,root,root) +%doc INSTALL COPYING COPYING.LIB README +%doc udev/12-dm-permissions.rules +/%_lib/libdevmapper.so.1.03 +/%_lib/libdevmapper-event.so.1.03 +/sbin/dmsetup +/sbin/dmeventd +/usr/sbin/thin_check +/usr/sbin/thin_dump +/usr/sbin/thin_restore +/usr/sbin/thin_metadata_size +/usr/sbin/thin_repair +/usr/sbin/thin_rmap +%{_mandir}/man8/dmsetup.8.gz +%{_mandir}/man8/dmeventd.8.gz +%{_mandir}/man8/thin_check.8.gz +%{_mandir}/man8/thin_dump.8.gz +%{_mandir}/man8/thin_restore.8.gz +%{_mandir}/man8/thin_metadata_size.8.gz +%{_mandir}/man8/thin_repair.8.gz +%{_mandir}/man8/thin_rmap.8.gz +%{_udevrulesdir}/10-dm.rules +%{_udevrulesdir}/13-dm-disk.rules +%{_udevrulesdir}/95-dm-notify.rules +%{_unitdir}/dm-event.socket +%{_unitdir}/dm-event.service +/usr/sbin/cache_check +/usr/sbin/cache_dump +/usr/sbin/cache_metadata_size +/usr/sbin/cache_repair +/usr/sbin/cache_restore +/usr/sbin/era_check +/usr/sbin/era_dump +/usr/sbin/era_invalidate +/usr/sbin/era_restore +/usr/sbin/pdata_tools +/usr/share/man/man8/cache_check.8.gz +/usr/share/man/man8/cache_dump.8.gz +/usr/share/man/man8/cache_repair.8.gz +/usr/share/man/man8/cache_restore.8.gz +/usr/share/man/man8/era_check.8.gz +/usr/share/man/man8/era_dump.8.gz +/usr/share/man/man8/era_invalidate.8.gz + +%package -n device-mapper-devel +Summary: Development package for the device mapper +Group: System/Base +Version: %{device_mapper_version} +Release: 0 +#Requires: %name = %version + +%description -n device-mapper-devel +Files needed for software development using the device mapper + +%files -n device-mapper-devel +%defattr(-,root,root) +/%_libdir/libdevmapper.so +/%_libdir/libdevmapper-event.so +%attr(644, root, root) %_libdir/libdevmapper.a +/usr/include/libdevmapper.h +/usr/include/libdevmapper-event.h +/%_libdir/pkgconfig/devmapper-event.pc +/%_libdir/pkgconfig/devmapper.pc + %changelog diff --git a/make-mirror-legs-on-different-tag-pvs.patch b/make-mirror-legs-on-different-tag-pvs.patch index 552c07d..513be03 100644 --- a/make-mirror-legs-on-different-tag-pvs.patch +++ b/make-mirror-legs-on-different-tag-pvs.patch @@ -18,19 +18,18 @@ always be placed on pvs with differnt tags. Signed-off-by: Guangliang Zhao --- - doc/example.conf.in | 17 +++++++++++++++++ - lib/config/defaults.h | 1 + - lib/metadata/lv_manip.c | 37 +++++++++++++++++++++++++++++++++++++ - man/lvcreate.8.in | 3 +++ - 4 files changed, 58 insertions(+) + conf/example.conf.in | 17 +++++++++++++++++ + lib/config/config_settings.h | 1 + + lib/config/defaults.h | 1 + + lib/metadata/lv_manip.c | 36 ++++++++++++++++++++++++++++++++++++ + man/lvcreate.8.in | 4 ++++ + 5 files changed, 59 insertions(+) -diff --git a/doc/example.conf.in b/doc/example.conf.in -index f7344bb..57e00d6 100644 ---- a/doc/example.conf.in -+++ b/doc/example.conf.in -@@ -224,6 +224,23 @@ allocation { - # algorithm. - maximise_cling = 1 +--- a/conf/example.conf.in ++++ b/conf/example.conf.in +@@ -315,6 +315,23 @@ allocation { + # + wipe_signatures_when_zeroing_new_lvs = 1 + # Set to 1 to guarantee that mirror leg will always be placed on + # different PVs(with different tags) from the other mirror legs. @@ -52,11 +51,19 @@ index f7344bb..57e00d6 100644 # Set to 1 to guarantee that mirror logs will always be placed on # different PVs from the mirror images. This was the default # until version 2.02.85. -diff --git a/lib/config/defaults.h b/lib/config/defaults.h -index 9730a2d..d08d004 100644 +--- a/lib/config/config_settings.h ++++ b/lib/config/config_settings.h +@@ -119,6 +119,7 @@ cfg(allocation_maximise_cling_CFG, "maxi + cfg(allocation_use_blkid_wiping_CFG, "use_blkid_wiping", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2, 2, 105), NULL) + cfg(allocation_wipe_signatures_when_zeroing_new_lvs_CFG, "wipe_signatures_when_zeroing_new_lvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2, 2, 105), NULL) + cfg(allocation_mirror_logs_require_separate_pvs_CFG, "mirror_logs_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_MIRROR_LOGS_REQUIRE_SEPARATE_PVS, vsn(2, 2, 85), NULL) ++cfg(allocation_mirror_legs_require_separate_pvs_CFG, "mirror_legs_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_MIRROR_LEGS_REQUIRE_SEPARATE_PVS, vsn(2, 2, 98), NULL) + cfg(allocation_cache_pool_metadata_require_separate_pvs_CFG, "cache_pool_metadata_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_CACHE_POOL_METADATA_REQUIRE_SEPARATE_PVS, vsn(2, 2, 106), NULL) + cfg_runtime(allocation_cache_pool_chunk_size_CFG, "cache_pool_chunk_size", allocation_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_INT, vsn(2, 2, 106), NULL) + cfg(allocation_thin_pool_metadata_require_separate_pvs_CFG, "thin_pool_metadata_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_METADATA_REQUIRE_SEPARATE_PVS, vsn(2, 2, 89), NULL) --- a/lib/config/defaults.h +++ b/lib/config/defaults.h -@@ -98,6 +98,7 @@ +@@ -125,6 +125,7 @@ #define DEFAULT_MAX_LV 0 #define DEFAULT_ALLOC_POLICY ALLOC_NORMAL #define DEFAULT_MIRROR_LOGS_REQUIRE_SEPARATE_PVS 0 @@ -64,11 +71,9 @@ index 9730a2d..d08d004 100644 #define DEFAULT_MAXIMISE_CLING 1 #define DEFAULT_CLUSTERED 0 -diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c -index 9f87854..fb0199f 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c -@@ -684,6 +684,9 @@ struct alloc_handle { +@@ -1409,6 +1409,9 @@ struct alloc_handle { unsigned maximise_cling; unsigned mirror_logs_separate; /* Force mirror logs on separate PVs? */ @@ -78,7 +83,7 @@ index 9f87854..fb0199f 100644 /* * RAID devices require a metadata area that accompanies each -@@ -868,6 +871,7 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd, +@@ -1598,6 +1601,7 @@ static struct alloc_handle *_alloc_init( ah->parity_count = parity_count; ah->region_size = region_size; ah->alloc = alloc; @@ -86,18 +91,17 @@ index 9f87854..fb0199f 100644 /* * For the purposes of allocation, area_count and parity_count are -@@ -879,6 +883,8 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd, +@@ -1609,6 +1613,7 @@ static struct alloc_handle *_alloc_init( ah->area_multiple = _calc_area_multiple(segtype, area_count + parity_count, stripes); - ah->mirror_logs_separate = find_config_tree_bool(cmd, "allocation/mirror_logs_require_separate_pvs", - DEFAULT_MIRROR_LOGS_REQUIRE_SEPARATE_PVS); -+ ah->mirror_legs_separate = find_config_tree_bool(cmd, "allocation/mirror_legs_require_separate_pvs", -+ DEFAULT_MIRROR_LEGS_REQUIRE_SEPARATE_PVS); + //FIXME: s/mirror_logs_separate/metadata_separate/ so it can be used by others? + ah->mirror_logs_separate = find_config_tree_bool(cmd, allocation_mirror_logs_require_separate_pvs_CFG, NULL); ++ ah->mirror_legs_separate = find_config_tree_bool(cmd, allocation_mirror_legs_require_separate_pvs_CFG, NULL); - if (segtype_is_raid(segtype)) { - if (metadata_area_count) { -@@ -1725,6 +1731,33 @@ static void _report_needed_allocation_space(struct alloc_handle *ah, - log_debug(" %" PRIu32 " %ss of %" PRIu32 " extents each", - metadata_count, metadata_type, metadata_size); + if (mirrors || stripes) + total_extents = new_extents; +@@ -2533,6 +2538,33 @@ static void _report_needed_allocation_sp + (metadata_count == 1) ? "" : "s", + metadata_size); } + +/* @@ -129,7 +133,7 @@ index 9f87854..fb0199f 100644 /* * Returns 1 regardless of whether any space was found, except on error. */ -@@ -1842,6 +1875,10 @@ static int _find_some_parallel_space(struct alloc_handle *ah, const struct alloc +@@ -2663,6 +2695,10 @@ static int _find_some_parallel_space(str continue; case USE_AREA: @@ -140,20 +144,16 @@ index 9f87854..fb0199f 100644 /* * Except with ALLOC_ANYWHERE, replace first area with this * one which is smaller but still big enough. -diff --git a/man/lvcreate.8.in b/man/lvcreate.8.in -index f374950..d7355b9 100644 --- a/man/lvcreate.8.in +++ b/man/lvcreate.8.in -@@ -205,6 +205,9 @@ will create a persistent log that is itself mirrored. - - The optional argument --corelog is equivalent to --mirrorlog core. +@@ -284,6 +284,10 @@ will create a persistent log that is its + When the legacy "mirror" segment type is used, the optional argument + \fB\-\-corelog\fP is equivalent to \fB\-\-mirrorlog\fP \fIcore\fP. ++ +Every leg of the mirrored logical volume could be placed on the pvs with +same tag, see details(mirror_legs_require_separate_pvs) in lvm.conf. + .TP - .IR \fB\-n ", " \fB\-\-name " " LogicalVolume { Name | Path } - The name for the new logical volume. --- -1.7.10.4 - + .BR \-\-metadataprofile " " \fIProfileName + Uses and attaches the ProfileName configuration profile to the logical diff --git a/make_raid1_default.diff b/make_raid1_default.diff deleted file mode 100644 index d3662b4..0000000 --- a/make_raid1_default.diff +++ /dev/null @@ -1,19 +0,0 @@ -commit 7e1083c985fd130b240c2471643350cc5c0f05cf -Author: Jonathan Brassow -Date: Tue Aug 6 14:13:55 2013 -0500 - - RAID: Make "raid1" the default mirror segment type - -diff --git a/lib/config/defaults.h b/lib/config/defaults.h -index 5af0f00..59282c5 100644 ---- a/lib/config/defaults.h -+++ b/lib/config/defaults.h -@@ -51,7 +51,7 @@ - #define DEFAULT_METADATA_READ_ONLY 0 - #define DEFAULT_LVDISPLAY_SHOWS_FULL_DEVICE_PATH 0 - --#define DEFAULT_MIRROR_SEGTYPE "mirror" -+#define DEFAULT_MIRROR_SEGTYPE "raid1" - #define DEFAULT_MIRRORLOG "disk" - #define DEFAULT_MIRROR_LOG_FAULT_POLICY "allocate" - #define DEFAULT_MIRROR_IMAGE_FAULT_POLICY "remove" diff --git a/man_page_sectors.diff b/man_page_sectors.diff deleted file mode 100644 index 20b2214..0000000 --- a/man_page_sectors.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- - man/pvdisplay.8.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- LVM2.2.02.98.orig/man/pvdisplay.8.in -+++ LVM2.2.02.98/man/pvdisplay.8.in -@@ -64,7 +64,7 @@ The values are: - - * physical volume device name - * volume group name --* physical volume size in kilobytes -+* physical volume size in sectors - * internal physical volume number (obsolete) - * physical volume status - * physical volume (not) allocatable diff --git a/mirrored_log_fixed_when_double_fault_occurs.diff b/mirrored_log_fixed_when_double_fault_occurs.diff deleted file mode 100644 index 4ee325c..0000000 --- a/mirrored_log_fixed_when_double_fault_occurs.diff +++ /dev/null @@ -1,59 +0,0 @@ -commit 54c73b7723713f43413584d59ca0bdd42c1d8241 -Author: Jonathan Brassow -Date: Wed Nov 14 14:58:47 2012 -0600 - - mirror: Mirrored log should be fixed before mirror when double fault occurs - - This patch is intended to fix bug 825323 - FS turns read-only during a double - fault of a mirror leg and mirrored log's leg at the same time. It only - affects a 2-way mirror with a mirrored log. 3+-way mirrors and mirrors - without a mirrored log are not affected. - - The problem resulted from the fact that the top level mirror was not - using 'noflush' when suspending before its "down-convert". When a - mirror image fails, the bios are queue until a suspend is recieved. If - it is a 'noflush' suspend, the bios can be safely requeued in the DM - core. If 'noflush' is not used, the bios must be pushed through the - target and if a device is failed for a mirror, that means issuing an - error. When an error is received by a file system, it results in it - turning read-only (depending on the FS). - - Part of the problem was is due to the nature of the stacking involved in - using a mirror as a mirror's log. When an image in each fail, the top - level mirror stalls because it is waiting for a log flush. The other - stalls waiting for corrective action. When the repair command is issued, - the entire stacked arrangement is collapsed to a linear LV. The log - flush then fails (somewhat uncleanly) and the top-level mirror is suspended - without 'noflush' because it is a linear device. - - This patch allows the log to be repaired first, which in turn allows the - top-level mirror's log flush to complete cleanly. The top-level mirror - is then secondarily reduced to a linear device - at which time this mirror - is suspended properly with 'noflush'. - -diff --git a/tools/lvconvert.c b/tools/lvconvert.c -index f23fc4b..27d8181 100644 ---- a/tools/lvconvert.c -+++ b/tools/lvconvert.c -@@ -1341,10 +1341,6 @@ int mirror_remove_missing(struct cmd_context *cmd, - if (!(failed_pvs = _failed_pv_list(lv->vg))) - return_0; - -- /* No point in keeping a log if the result is not a mirror */ -- if (_failed_mirrors_count(lv) + 1 >= lv_mirror_count(lv)) -- log_count = 0; -- - if (force && _failed_mirrors_count(lv) == lv_mirror_count(lv)) { - log_error("No usable images left in %s.", lv->name); - return lv_remove_with_dependencies(cmd, lv, DONT_PROMPT, 0); -@@ -1363,8 +1359,8 @@ int mirror_remove_missing(struct cmd_context *cmd, - _is_partial_lv, NULL, 0)) - return 0; - -- if (!_lv_update_log_type(cmd, NULL, lv, failed_pvs, -- log_count)) -+ if (lv_is_mirrored(lv) && -+ !_lv_update_log_type(cmd, NULL, lv, failed_pvs, log_count)) - return 0; - - if (!_reload_lv(cmd, lv->vg, lv)) diff --git a/no-inc-audit.diff b/no-inc-audit.diff index 89a0054..fe5c7f8 100644 --- a/no-inc-audit.diff +++ b/no-inc-audit.diff @@ -1,22 +1,22 @@ -Index: lib/device/dev-io.c +Index: LVM2.2.02.111/lib/device/dev-io.c =================================================================== ---- lib/device/dev-io.c.orig 2009-05-20 19:09:49.000000000 +0800 -+++ lib/device/dev-io.c 2010-02-04 11:00:22.000000000 +0800 -@@ -31,6 +31,7 @@ +--- LVM2.2.02.111.orig/lib/device/dev-io.c ++++ LVM2.2.02.111/lib/device/dev-io.c +@@ -30,6 +30,7 @@ # define u64 uint64_t /* Missing without __KERNEL__ */ # undef WNOHANG /* Avoid redefinition */ # undef WUNTRACED /* Avoid redefinition */ -+# define _LINUX_AUDIT_H_ /* Avoid inclusion */ ++# define _LINUX_AUDIT_H_ /* Avoid inclusion */ # include /* For block ioctl definitions */ # define BLKSIZE_SHIFT SECTOR_SHIFT # ifndef BLKGETSIZE64 /* fs.h out-of-date */ -Index: lib/filters/filter.c +Index: LVM2.2.02.111/lib/filters/filter-type.c =================================================================== ---- lib/filters/filter.c.orig 2010-02-04 11:00:18.000000000 +0800 -+++ lib/filters/filter.c 2010-02-04 11:00:22.000000000 +0800 -@@ -14,6 +14,7 @@ +--- LVM2.2.02.111.orig/lib/filters/filter-type.c ++++ LVM2.2.02.111/lib/filters/filter-type.c +@@ -13,6 +13,7 @@ + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include +#define _LINUX_AUDIT_H_ #include diff --git a/no_buildroot_shared.diff b/no_buildroot_shared.diff deleted file mode 100644 index ab07360..0000000 --- a/no_buildroot_shared.diff +++ /dev/null @@ -1,13 +0,0 @@ -Index: tools/Makefile.in -=================================================================== ---- tools/Makefile.in.orig 2011-02-15 14:57:28.000000000 +0800 -+++ tools/Makefile.in 2011-02-15 14:57:32.000000000 +0800 -@@ -109,7 +109,7 @@ - EXPORTED_HEADER = $(srcdir)/lvm2cmd.h - EXPORTED_FN_PREFIX = lvm2 - --DEFS += -DLVM_SHARED_PATH=\"$(exec_prefix)/sbin/lvm\" -+DEFS += -DLVM_SHARED_PATH=\"/sbin/lvm\" - - CFLOW_LIST = lvmcmdlib.c lvm2cmd.c - CFLOW_LIST_TARGET = liblvm2cmd.cflow diff --git a/pipe_buff-definition.diff b/pipe_buff-definition.diff deleted file mode 100644 index 5d618ec..0000000 --- a/pipe_buff-definition.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- - daemons/clvmd/clvmd.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- LVM2.2.02.98.orig/daemons/clvmd/clvmd.c -+++ LVM2.2.02.98/daemons/clvmd/clvmd.c -@@ -53,6 +53,8 @@ - - #define ISLOCAL_CSID(c) (memcmp(c, our_csid, max_csid_len) == 0) - -+#include -+ - /* Head of the fd list. Also contains - the cluster_socket details */ - static struct local_client local_client_head; diff --git a/pvmove_support_clustered_vg.diff b/pvmove_support_clustered_vg.diff index 9911510..01bbb81 100644 --- a/pvmove_support_clustered_vg.diff +++ b/pvmove_support_clustered_vg.diff @@ -9,7 +9,7 @@ } +/* 0 on not running, 1 on running */ -+static int check_cmirrord() ++static int check_cmirrord(void) +{ + int fd; + int ret = 0; diff --git a/remove-fedora-systemd.patch b/remove-fedora-systemd.patch deleted file mode 100644 index 9e9b983..0000000 --- a/remove-fedora-systemd.patch +++ /dev/null @@ -1,54 +0,0 @@ -commit 360c569ce8f0bfe936d59ca91de2716958550524 -Author: Peter Rajnoha -Date: Tue Oct 30 20:36:49 2012 +0100 - - systemd: various updates and fixes - - Don't use lvmetad in lvm2-monitor.service ExecStop to avoid a systemd issue. - - a systemd design issue while processing dependencies - with socket-based activation that ends up with a hang - - https://bugzilla.redhat.com/show_bug.cgi?id=843587 - (also tracker bug https://bugzilla.redhat.com/show_bug.cgi?id=871527) - - not using lvmetad in this case is just a workaround, once the bug - above is resolved, we should enable the lvmetad in that specific case - - Remove dependency on fedora-storage-init.service in lvm2 systemd units. - - fedora-storage-init.service and fedora-storage-init-late.service is - going to be separated into respective units that belong to each block - device subsystem: - - mpath + mdraid activated via udev solely - - dmraid with its own dmraid-activation.service unit - - lvm2 with the lvm2-activation-generator to generate the - activation units runtime if lvmetad disabled - (global/use_lvmetad=0 set in lvm.conf) and activation done - via udev+lvmetad if lvmetad enabled (global/use_lvmetad=1 set - in lvm.conf) - - Depend on lvm2-lvmetad.socket in lvm2-monitor.service systemd unit. - - as lvm2-monitor uses lvmetad if lvmetad is enabled - -diff --git a/scripts/lvm2_monitoring_systemd_red_hat.service.in b/scripts/lvm2_monitoring_systemd_red_hat.service.in -index 6c4c55f..e6b4814 100644 ---- a/scripts/lvm2_monitoring_systemd_red_hat.service.in -+++ b/scripts/lvm2_monitoring_systemd_red_hat.service.in -@@ -1,8 +1,8 @@ - [Unit] - Description=Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling - Documentation=man:dmeventd(8) man:lvcreate(8) man:lvchange(8) man:vgchange(8) --Requires=dm-event.socket --After=dm-event.socket fedora-storage-init.service fedora-storage-init-late.service lvm2-activation.service lvm2-lvmetad.service -+Requires=dm-event.socket lvm2-lvmetad.socket -+After=dm-event.socket lvm2-lvmetad.socket lvm2-lvmetad.service - Before=local-fs.target - DefaultDependencies=no - Conflicts=shutdown.target -@@ -11,7 +11,8 @@ Conflicts=shutdown.target - Type=oneshot - Environment=LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1 - ExecStart=@sbindir@/lvm vgchange --monitor y --ExecStop=@sbindir@/lvm vgchange --monitor n -+# The lvmetad must be disabled here, it needs https://bugzilla.redhat.com/show_bug.cgi?id=843587 to be resolved first. -+ExecStop="@sbindir@/lvm vgchange --monitor n --config 'global{use_lvmetad=0}'" - RemainAfterExit=yes - - [Install] diff --git a/remove-quote-in-lvm2-monitor.patch b/remove-quote-in-lvm2-monitor.patch deleted file mode 100644 index c7b12dc..0000000 --- a/remove-quote-in-lvm2-monitor.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: LVM2.2.02.98/scripts/lvm2_monitoring_systemd_red_hat.service.in -=================================================================== ---- LVM2.2.02.98.orig/scripts/lvm2_monitoring_systemd_red_hat.service.in 2014-05-29 17:57:49.651975608 +0800 -+++ LVM2.2.02.98/scripts/lvm2_monitoring_systemd_red_hat.service.in 2014-05-29 17:59:51.691134245 +0800 -@@ -12,7 +12,7 @@ Type=oneshot - Environment=LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1 - ExecStart=@sbindir@/lvm vgchange --monitor y - # The lvmetad must be disabled here, it needs https://bugzilla.redhat.com/show_bug.cgi?id=843587 to be resolved first. --ExecStop="@sbindir@/lvm vgchange --monitor n --config 'global{use_lvmetad=0}'" -+ExecStop=@sbindir@/lvm vgchange --monitor n --config 'global{use_lvmetad=0}' - RemainAfterExit=yes - - [Install] diff --git a/support-drbd-filter.diff b/support-drbd-filter.diff deleted file mode 100644 index 4be11cf..0000000 --- a/support-drbd-filter.diff +++ /dev/null @@ -1,53 +0,0 @@ -This is still very primitive support of drbd in lvm2. -Can we use some /sys information for this ? ---- - lib/cache/lvmcache.c | 14 ++++++++++++++ - lib/filters/filter.c | 7 +++++++ - 2 files changed, 21 insertions(+) - ---- LVM2.2.02.98.orig/lib/cache/lvmcache.c -+++ LVM2.2.02.98/lib/cache/lvmcache.c -@@ -1489,6 +1489,14 @@ struct lvmcache_info *lvmcache_add(struc - dev_subsystem_name(existing->dev), - dev_name(existing->dev)); - return NULL; -+ } else if (MAJOR(existing->dev->dev) == drbd_major() && -+ MAJOR(dev->dev) != drbd_major()) { -+ log_very_verbose("Ignoring duplicate PV %s on " -+ "%s - using drbd %s", -+ pvid, dev_name(dev), -+ dev_name(existing->dev)); -+ return NULL; -+ - } else if (dm_is_dm_major(MAJOR(existing->dev->dev)) && - !dm_is_dm_major(MAJOR(dev->dev))) { - log_very_verbose("Ignoring duplicate PV %s on " -@@ -1509,6 +1517,12 @@ struct lvmcache_info *lvmcache_add(struc - "using dm %s", pvid, - dev_name(existing->dev), - dev_name(dev)); -+ else if (MAJOR(existing->dev->dev) != drbd_major() && -+ MAJOR(dev->dev) == drbd_major()) -+ log_very_verbose("Duplicate PV %s on %s - " -+ "using drbd %s", pvid, -+ dev_name(existing->dev), -+ dev_name(dev)); - /* FIXME If both dm, check dependencies */ - //else if (dm_is_dm_major(MAJOR(existing->dev->dev)) && - //dm_is_dm_major(MAJOR(dev->dev))) ---- LVM2.2.02.98.orig/lib/filters/filter.c -+++ LVM2.2.02.98/lib/filters/filter.c -@@ -60,6 +60,13 @@ int md_major(void) - return _md_major; - } - -+/* FIXME: Should we consider filter out non-primary -+ drbd resource ?? */ -+int drbd_major(void) -+{ -+ return _drbd_major; -+} -+ - int blkext_major(void) - { - return _blkext_major; diff --git a/suppress_locking_failer_message.patch b/suppress_locking_failer_message.patch deleted file mode 100644 index ac9c9af..0000000 --- a/suppress_locking_failer_message.patch +++ /dev/null @@ -1,15 +0,0 @@ -Index: LVM2.2.02.98/lib/locking/locking.c -=================================================================== ---- LVM2.2.02.98.orig/lib/locking/locking.c -+++ LVM2.2.02.98/lib/locking/locking.c -@@ -221,8 +221,8 @@ static void _update_vg_lock_count(const - */ - int init_locking(int type, struct cmd_context *cmd, int suppress_messages) - { -- if (getenv("LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES")) -- suppress_messages = 1; -+ -+ suppress_messages = 1; - - if (type < 0) - type = find_config_tree_int(cmd, "global/locking_type", 1); diff --git a/sys_mount_instead_linux_fs.diff b/sys_mount_instead_linux_fs.diff index 1e00e00..436cdc4 100644 --- a/sys_mount_instead_linux_fs.diff +++ b/sys_mount_instead_linux_fs.diff @@ -1,22 +1,22 @@ -Index: lib/device/dev-io.c +Index: LVM2.2.02.111/lib/device/dev-io.c =================================================================== ---- lib/device/dev-io.c.orig 2009-04-27 16:15:42.000000000 +0800 -+++ lib/device/dev-io.c 2009-04-27 16:15:49.000000000 +0800 -@@ -32,7 +32,7 @@ +--- LVM2.2.02.111.orig/lib/device/dev-io.c ++++ LVM2.2.02.111/lib/device/dev-io.c +@@ -31,7 +31,7 @@ # undef WNOHANG /* Avoid redefinition */ # undef WUNTRACED /* Avoid redefinition */ - # define _LINUX_AUDIT_H_ /* Avoid inclusion */ + # define _LINUX_AUDIT_H_ /* Avoid inclusion */ -# include /* For block ioctl definitions */ -+# include /* For block ioctl definitions */ ++# include /* For block ioctl definitions */ # define BLKSIZE_SHIFT SECTOR_SHIFT # ifndef BLKGETSIZE64 /* fs.h out-of-date */ # define BLKGETSIZE64 _IOR(0x12, 114, size_t) -Index: lib/filters/filter.c +Index: LVM2.2.02.111/lib/filters/filter-type.c =================================================================== ---- lib/filters/filter.c.orig 2009-04-27 16:15:42.000000000 +0800 -+++ lib/filters/filter.c 2009-04-27 16:15:49.000000000 +0800 -@@ -15,7 +15,7 @@ - +--- LVM2.2.02.111.orig/lib/filters/filter-type.c ++++ LVM2.2.02.111/lib/filters/filter-type.c +@@ -14,7 +14,7 @@ + */ #include #define _LINUX_AUDIT_H_ -#include diff --git a/systemd-lvm2-activation-generator-report-only-error.patch b/systemd-lvm2-activation-generator-report-only-error.patch deleted file mode 100644 index 3c0ddb8..0000000 --- a/systemd-lvm2-activation-generator-report-only-error.patch +++ /dev/null @@ -1,25 +0,0 @@ -Index: LVM2.2.02.98/scripts/lvm2_activation_generator_systemd_red_hat.c -=================================================================== ---- LVM2.2.02.98.orig/scripts/lvm2_activation_generator_systemd_red_hat.c 2014-04-14 14:25:29.280756835 +0800 -+++ LVM2.2.02.98/scripts/lvm2_activation_generator_systemd_red_hat.c 2014-04-14 14:27:19.894797719 +0800 -@@ -154,17 +154,16 @@ int main(int argc, char *argv[]) - } - - /* If lvmetad used, rely on autoactivation instead of direct activation. */ -- if (lvm_uses_lvmetad()) { -- kmsg("LVM: Logical Volume autoactivation enabled.\n"); -+ if (lvm_uses_lvmetad()) - goto out; -- } - - dir = argc > 1 ? argv[1] : DEFAULT_UNIT_DIR; - - if (!generate_unit(dir, 1) || !generate_unit(dir, 0)) - r = EXIT_FAILURE; - out: -- kmsg("LVM: Activation generator %s.\n", r ? "failed" : "successfully completed"); -+ if (r) -+ kmsg("LVM: Activation generator failed.\n"); - if (kmsg_fd != -1) - (void) close(kmsg_fd); - return r; diff --git a/systemd-use-umask-022-for-generated-systemd-units-by.patch b/systemd-use-umask-022-for-generated-systemd-units-by.patch deleted file mode 100644 index 4de9313..0000000 --- a/systemd-use-umask-022-for-generated-systemd-units-by.patch +++ /dev/null @@ -1,27 +0,0 @@ -Index: LVM2.2.02.98/scripts/lvm2_activation_generator_systemd_red_hat.c -=================================================================== ---- LVM2.2.02.98.orig/scripts/lvm2_activation_generator_systemd_red_hat.c -+++ LVM2.2.02.98/scripts/lvm2_activation_generator_systemd_red_hat.c -@@ -145,6 +145,7 @@ int main(int argc, char *argv[]) - { - const char *dir; - int r = EXIT_SUCCESS; -+ mode_t old_mask; - - kmsg_fd = open(KMSG_DEV_PATH, O_WRONLY|O_NOCTTY); - -@@ -158,9 +159,13 @@ int main(int argc, char *argv[]) - goto out; - - dir = argc > 1 ? argv[1] : DEFAULT_UNIT_DIR; -- -+ -+ /* mark lvm2-activation.*.service as world-accessible */ -+ old_mask = umask(0022); - if (!generate_unit(dir, 1) || !generate_unit(dir, 0)) - r = EXIT_FAILURE; -+ umask(old_mask); -+ - out: - if (r) - kmsg("LVM: Activation generator failed.\n"); diff --git a/thin-provisioning-tools-v0.4.1.tar.gz b/thin-provisioning-tools-v0.4.1.tar.gz new file mode 100644 index 0000000..d5ea15d --- /dev/null +++ b/thin-provisioning-tools-v0.4.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:59c8a787df8d4828bf9ca1b6310584f2b7723068901e20aa609015ce85df1d46 +size 186979 diff --git a/udev-Check-for-DM_NR_VALID_PATHS.patch b/udev-Check-for-DM_NR_VALID_PATHS.patch index 1d168dd..b044693 100644 --- a/udev-Check-for-DM_NR_VALID_PATHS.patch +++ b/udev-Check-for-DM_NR_VALID_PATHS.patch @@ -18,45 +18,44 @@ Signed-off-by: Hannes Reinecke udev/69-dm-lvm-metad.rules.in | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) -diff --git a/udev/10-dm.rules.in b/udev/10-dm.rules.in -index 29af467..f108941 100644 ---- a/udev/10-dm.rules.in -+++ b/udev/10-dm.rules.in -@@ -111,7 +111,6 @@ ENV{DM_UDEV_DISABLE_DM_RULES_FLAG}!="1", ENV{DM_NAME}=="?*", SYMLINK+="(DM_DIR)/ +Index: LVM2.2.02.111/udev/10-dm.rules.in +=================================================================== +--- LVM2.2.02.111.orig/udev/10-dm.rules.in ++++ LVM2.2.02.111/udev/10-dm.rules.in +@@ -126,7 +126,6 @@ ENV{DM_UDEV_DISABLE_DM_RULES_FLAG}!="1", # We have to ignore further rule application for inappropriate events # and devices. But still send the notification if cookie exists. -ENV{DM_UUID}=="mpath-?*", ENV{DM_ACTION}=="PATH_FAILED", GOTO="dm_disable" - ENV{DM_UUID}=="CRYPT-TEMP-?*", GOTO="dm_disable" - ENV{DM_UUID}!="?*", ENV{DM_NAME}=="temporary-cryptsetup-?*", GOTO="dm_disable" -diff --git a/udev/13-dm-disk.rules.in b/udev/13-dm-disk.rules.in -index 1920260..d117a94 100644 ---- a/udev/13-dm-disk.rules.in -+++ b/udev/13-dm-disk.rules.in -@@ -18,8 +18,10 @@ SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}" - ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}" + # Avoid processing and scanning a DM device in the other (foreign) + # rules if it is in suspended state. However, we still keep 'disk' +Index: LVM2.2.02.111/udev/13-dm-disk.rules.in +=================================================================== +--- LVM2.2.02.111.orig/udev/13-dm-disk.rules.in ++++ LVM2.2.02.111/udev/13-dm-disk.rules.in +@@ -18,10 +18,12 @@ SYMLINK+="disk/by-id/dm-name-$env{DM_NAM + ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}", OPTIONS+="string_escape=replace" ENV{DM_SUSPENDED}=="1", GOTO="dm_end" +ENV{DM_NR_VALID_PATHS}=="0", GOTO="dm_blkid_end" + ENV{DM_NOSCAN}=="1", GOTO="dm_watch" + ENV{DM_TARGET_TYPES}=="|*error*", GOTO="dm_end" (BLKID_RULE) +LABEL="dm_blkid_end" - ENV{DM_UDEV_LOW_PRIORITY_FLAG}=="1", OPTIONS="link_priority=-100" - ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" - ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" -diff --git a/udev/69-dm-lvm-metad.rules.in b/udev/69-dm-lvm-metad.rules.in -index 706c03b..0b0ebbf 100644 ---- a/udev/69-dm-lvm-metad.rules.in -+++ b/udev/69-dm-lvm-metad.rules.in -@@ -19,6 +19,7 @@ SUBSYSTEM!="block", GOTO="lvm_end" + ENV{DM_UDEV_LOW_PRIORITY_FLAG}=="1", OPTIONS+="link_priority=-100" + OPTIONS+="watch" + ENV{DM_TARGET_TYPES}=="*snapshot-origin*", OPTIONS+="link_priority=-90" +Index: LVM2.2.02.111/udev/69-dm-lvm-metad.rules.in +=================================================================== +--- LVM2.2.02.111.orig/udev/69-dm-lvm-metad.rules.in ++++ LVM2.2.02.111/udev/69-dm-lvm-metad.rules.in +@@ -47,6 +47,7 @@ ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="dis - # Device-mapper devices are processed only on change event or on supported synthesized event. - KERNEL=="dm-[0-9]*", ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="lvm_end" + # DM device: + KERNEL!="dm-[0-9]*", GOTO="next" +KERNEL=="dm-[0-9]*", ENV{DM_NR_VALID_PATHS}=="0", GOTO="lvm_end" + ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}=="1", ENV{DM_ACTIVATION}=="1", GOTO="lvm_scan" + GOTO="lvm_end" - # Only process devices already marked as a PV - this requires blkid to be called before. - ENV{ID_FS_TYPE}=="LVM2_member|LVM1_member", RUN+="(LVM_EXEC)/lvm pvscan --cache --activate ay --major $major --minor $minor" --- -1.8.4.5 - diff --git a/udev_rules-update.diff b/udev_rules-update.diff new file mode 100644 index 0000000..c69be95 --- /dev/null +++ b/udev_rules-update.diff @@ -0,0 +1,40 @@ +Index: LVM2.2.02.110/udev/10-dm.rules.in +=================================================================== +--- LVM2.2.02.110.orig/udev/10-dm.rules.in ++++ LVM2.2.02.110/udev/10-dm.rules.in +@@ -101,6 +101,10 @@ TEST=="dm", ENV{DM_NAME}="$attr{dm/name} + TEST!="dm", IMPORT{program}="(DM_EXEC)/dmsetup info -j %M -m %m -c --nameprefixes --noheadings --rows -o name,uuid,suspended" + ENV{DM_SUSPENDED}!="?*", IMPORT{program}="(DM_EXEC)/dmsetup info -j %M -m %m -c --nameprefixes --noheadings --rows -o suspended" + ++# dmsetup export is a SUSE extension to dmsetup ++# it is required by some other udev rules in SUSE distro. ++IMPORT{program}="(DM_EXEC)/dmsetup export -j %M -m %m" ++ + # dmsetup tool provides suspended state information in textual + # form with values "Suspended"/"Active". We translate it to + # 0/1 respectively to be consistent with sysfs values. +Index: LVM2.2.02.110/udev/13-dm-disk.rules.in +=================================================================== +--- LVM2.2.02.110.orig/udev/13-dm-disk.rules.in ++++ LVM2.2.02.110/udev/13-dm-disk.rules.in +@@ -14,14 +14,17 @@ ACTION!="add|change", GOTO="dm_end" + ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_end" + ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}=="1", GOTO="dm_end" + +-SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}" +-ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}" ++SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}", OPTIONS+="string_escape=replace" ++ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}", OPTIONS+="string_escape=replace" + + ENV{DM_SUSPENDED}=="1", GOTO="dm_end" + ENV{DM_NOSCAN}=="1", GOTO="dm_watch" ++ENV{DM_TARGET_TYPES}=="|*error*", GOTO="dm_end" + + (BLKID_RULE) +-ENV{DM_UDEV_LOW_PRIORITY_FLAG}=="1", OPTIONS="link_priority=-100" ++ENV{DM_UDEV_LOW_PRIORITY_FLAG}=="1", OPTIONS+="link_priority=-100" ++OPTIONS+="watch" ++ENV{DM_TARGET_TYPES}=="*snapshot-origin*", OPTIONS+="link_priority=-90" + ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" + ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" + diff --git a/use-mirrortype-asdefault-whenclvmdrunning.patch b/use-mirrortype-asdefault-whenclvmdrunning.patch index 3f6d078..942ed60 100644 --- a/use-mirrortype-asdefault-whenclvmdrunning.patch +++ b/use-mirrortype-asdefault-whenclvmdrunning.patch @@ -1,12 +1,14 @@ -Index: LVM2.2.02.98/tools/lvcreate.c -=================================================================== ---- LVM2.2.02.98.orig/tools/lvcreate.c 2014-04-14 14:25:22.291748711 +0800 -+++ LVM2.2.02.98/tools/lvcreate.c 2014-04-24 15:40:49.104019108 +0800 -@@ -670,6 +670,28 @@ static int _read_activation_params(struc +--- + tools/lvcreate.c | 28 ++++++++++++++++++++++++++-- + 1 file changed, 26 insertions(+), 2 deletions(-) + +--- a/tools/lvcreate.c ++++ b/tools/lvcreate.c +@@ -834,6 +834,28 @@ static int _read_activation_params(struc return 1; } -+static int clvmd_daemon_is_running() ++static int clvmd_daemon_is_running(void) +{ + int fd; + struct flock lock; @@ -31,24 +33,22 @@ Index: LVM2.2.02.98/tools/lvcreate.c static int _lvcreate_params(struct lvcreate_params *lp, struct lvcreate_cmdline_params *lcp, struct cmd_context *cmd, -@@ -696,15 +718,16 @@ static int _lvcreate_params(struct lvcre - } +@@ -860,14 +882,16 @@ static int _lvcreate_params(struct lvcre - // FIXME -m0 implies *striped* -- -- /* Set default segtype */ -- if (arg_count(cmd, mirrors_ARG)) -+ /* Set default segtype */ -+ if (arg_count(cmd, mirrors_ARG)) { - /* - * FIXME: Add default setting for when -i and -m arguments - * are both given. We should default to "raid10". - */ - segtype_str = find_config_tree_str(cmd, "global/mirror_segtype_default", DEFAULT_MIRROR_SEGTYPE); + /* Set default segtype - remember, '-m 0' implies stripe. */ + if (arg_count(cmd, mirrors_ARG) && +- arg_uint_value(cmd, mirrors_ARG, 0)) ++ arg_uint_value(cmd, mirrors_ARG, 0)) { + if (arg_uint_value(cmd, arg_count(cmd, stripes_long_ARG) ? + stripes_long_ARG : stripes_ARG, 1) > 1) { + segtype_str = find_config_tree_str(cmd, global_raid10_segtype_default_CFG, NULL);; + } else { + segtype_str = find_config_tree_str(cmd, global_mirror_segtype_default_CFG, NULL); + } - else if (arg_count(cmd, thin_ARG) || arg_count(cmd, thinpool_ARG)) + if(clvmd_daemon_is_running()) + segtype_str = "mirror"; + } else if (arg_count(cmd, thin_ARG) || arg_count(cmd, thinpool_ARG)) segtype_str = "thin"; - else - segtype_str = "striped"; + else if (arg_count(cmd, cache_ARG) || arg_count(cmd, cachepool_ARG)) + segtype_str = "cache"; diff --git a/version-plugins-in-libdir b/version-plugins-in-libdir new file mode 100644 index 0000000..c39a3d2 --- /dev/null +++ b/version-plugins-in-libdir @@ -0,0 +1,22 @@ +From: Jeff Mahoney +Subject: build: Install links in libdir with versions + +Plugins in $(libdir)/device-mapper should probably be versioned but +when they're linked into $(libdir) directly, they must be versioned. + +Signed-off-by: Jeff Mahoney +--- + make.tmpl.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/make.tmpl.in ++++ b/make.tmpl.in +@@ -394,7 +394,7 @@ install_lib_shared: $(LIB_SHARED) + # when the code is fixed links could be removed. + install_dm_plugin: $(LIB_SHARED) + $(INSTALL_PROGRAM) -D $< $(libdir)/device-mapper/$(