summaryrefslogtreecommitdiffstats
path: root/0148-RHBZ-1292599-verify-before-remove.patch
diff options
context:
space:
mode:
authorBenjamin Marzinski <bmarzins@redhat.com>2016-04-21 21:27:49 -0500
committerBenjamin Marzinski <bmarzins@redhat.com>2016-04-21 21:27:49 -0500
commit6738b34a0b0aabf1bc8c15d540bafa29ca99c58f (patch)
treecf5a37898b4bacc7fefcc08db661338bfdb9ffec /0148-RHBZ-1292599-verify-before-remove.patch
parentfef216999bec3651f01b934a3ece5a69f6eca598 (diff)
downloaddevice-mapper-multipath-6738b34a0b0aabf1bc8c15d540bafa29ca99c58f.tar.gz
device-mapper-multipath-6738b34a0b0aabf1bc8c15d540bafa29ca99c58f.tar.xz
device-mapper-multipath-6738b34a0b0aabf1bc8c15d540bafa29ca99c58f.zip
device-mapper-multipath-0.4.9-82
- Modify 0005-RH-add-mpathconf.patch * changed warning message - Modify 0102-RHBZ-1160478-mpathconf-template.patch * updated man page - Modify 0104-RHBZ-631009-deferred-remove.patch * refactor code and minor fix - Refresh 0107-RHBZ-1169935-no-new-devs.patch - Refresh 0112-RHBZ-1194917-add-config_dir-option.patch - Refresh 0126-RHBZ-1211383-alias-collision.patch - Add 0133-RHBZ-1296979-fix-define.patch * look for the correct libudev function to set define - Add 0134-RHBZ-1241528-check-mpath-prefix.patch * only touch devices with a "mpath-" dm uuid prefix - Add 0135-RHBZ-1299600-path-dev-uevents.patch * trigger path uevent the first time a path is claimed by multipath - Add 0136-RHBZ-1304687-wait-for-map-add.patch * wait for the device to finish being added before reloading it. - Add 0137-RHBZ-1280524-clear-chkr-msg.patch - Add 0138-RHBZ-1288660-fix-mpathconf-allow.patch * don't remove existing lines from blacklist_exceptions section - Add 0139-RHBZ-1273173-queue-no-daemon-doc.patch - Add 0140-RHBZ-1299647-fix-help.patch - Add 0141-RHBZ-1303953-mpathpersist-typo.patch - Add 0142-RHBZ-1283750-kpartx-fix.patch * only remove devices if their uuid says that they are the correct partition device - Add 0143-RHBZ-1299648-kpartx-sync.patch * default to using udev sync mode - Add 0144-RHBZ-1299652-alua-pref-arg.patch * allow "exclusive_pref_bit" argument to alua prioritizer - Add 0145-UP-resize-help-msg.patch - Add 0146-UPBZ-1299651-raw-output.patch * allow raw format mutipathd show commands, that remove headers and padding - Add 0147-RHBZ-1272620-fail-rm-msg.patch - Add 0148-RHBZ-1292599-verify-before-remove.patch * verify that all partitions are unused before attempting to remove a device - Add 0149-RHBZ-1292599-restore-removed-parts.patch * don't disable kpartx when restoring the first path of a device. - Add 0150-RHBZ-1253913-fix-startup-msg.patch * wait for multipathd daemon to write pidfile before returning - Add 0151-RHBZ-1297456-weighted-fix.patch * add wwn keyword to weighted prioritizer for persistent naming - Add 0152-RHBZ-1269293-fix-blk-unit-file.patch * use "Wants" instead of "Requires" - Add 0153-RH-fix-i686-size-bug.patch * use 64-bit keycodes for multipathd client commands - Add 0154-UPBZ-1291406-disable-reinstate.patch * don't automatically reinstate ghost paths for implicit alua devices - Add 0155-UPBZ-1300415-PURE-config.patch * Add default config for PURE FlashArray - Add 0156-UPBZ-1313324-dont-fail-discovery.patch * don't fail discovery because individual paths failed. - Add 0157-RHBZ-1319853-multipath-c-error-msg.patch * better error reporting for multipath -c - Add 0158-RHBZ-1318581-timestamp-doc-fix.patch * add documentation for -T - Add 0159-UPBZ-1255885-udev-waits.patch * make multipath and kpartx wait after for udev after each command
Diffstat (limited to '0148-RHBZ-1292599-verify-before-remove.patch')
-rw-r--r--0148-RHBZ-1292599-verify-before-remove.patch142
1 files changed, 142 insertions, 0 deletions
diff --git a/0148-RHBZ-1292599-verify-before-remove.patch b/0148-RHBZ-1292599-verify-before-remove.patch
new file mode 100644
index 0000000..3e33b89
--- /dev/null
+++ b/0148-RHBZ-1292599-verify-before-remove.patch
@@ -0,0 +1,142 @@
+---
+ libmultipath/devmapper.c | 45 +++++++++++++++++++++++++++++++++++++--------
+ libmultipath/devmapper.h | 2 +-
+ 2 files changed, 38 insertions(+), 9 deletions(-)
+
+Index: multipath-tools-130222/libmultipath/devmapper.c
+===================================================================
+--- multipath-tools-130222.orig/libmultipath/devmapper.c
++++ multipath-tools-130222/libmultipath/devmapper.c
+@@ -33,6 +33,9 @@
+ #define UUID_PREFIX_LEN 6
+
+ static int dm_cancel_remove_partmaps(const char * mapname);
++static int do_foreach_partmaps (const char * mapname,
++ int (*partmap_func)(const char *, void *),
++ void *data);
+
+ #ifndef LIBDM_API_COOKIE
+ static inline int dm_task_set_cookie(struct dm_task *dmt, uint32_t *c, int a)
+@@ -709,6 +712,26 @@ out:
+ return r;
+ }
+
++static int
++partmap_in_use(const char *name, void *data)
++{
++ int part_count, *ret_count = (int *)data;
++ int open_count = dm_get_opencount(name);
++
++ if (ret_count)
++ (*ret_count)++;
++ part_count = 0;
++ if (open_count) {
++ if (do_foreach_partmaps(name, partmap_in_use, &part_count))
++ return 1;
++ if (open_count != part_count) {
++ condlog(2, "%s: map in use", name);
++ return 1;
++ }
++ }
++ return 0;
++}
++
+ extern int
+ _dm_flush_map (const char * mapname, int need_sync, int deferred_remove)
+ {
+@@ -717,6 +740,11 @@ _dm_flush_map (const char * mapname, int
+ if (!dm_is_mpath(mapname))
+ return 0; /* nothing to do */
+
++ /* If you aren't doing a deferred remove, make sure that no
++ * devices are in use */
++ if (!do_deferred(deferred_remove) && partmap_in_use(mapname, NULL))
++ return 1;
++
+ if (dm_remove_partmaps(mapname, need_sync, deferred_remove))
+ return 1;
+
+@@ -825,7 +853,7 @@ dm_flush_maps (void)
+ }
+
+ int
+-dm_message(char * mapname, char * message)
++dm_message(const char * mapname, char * message)
+ {
+ int r = 1;
+ struct dm_task *dmt;
+@@ -1076,7 +1104,8 @@ bad:
+ }
+
+ static int
+-do_foreach_partmaps (const char * mapname, int (*partmap_func)(char *, void *),
++do_foreach_partmaps (const char * mapname,
++ int (*partmap_func)(const char *, void *),
+ void *data)
+ {
+ struct dm_task *dmt;
+@@ -1149,7 +1178,7 @@ struct remove_data {
+ };
+
+ static int
+-remove_partmap(char *name, void *data)
++remove_partmap(const char *name, void *data)
+ {
+ struct remove_data *rd = (struct remove_data *)data;
+
+@@ -1176,7 +1205,7 @@ dm_remove_partmaps (const char * mapname
+ #ifdef LIBDM_API_DEFERRED
+
+ static int
+-cancel_remove_partmap (char *name, void *unused)
++cancel_remove_partmap (const char *name, void *unused)
+ {
+ if (dm_get_opencount(name))
+ dm_cancel_remove_partmaps(name);
+@@ -1296,13 +1325,13 @@ out:
+ }
+
+ struct rename_data {
+- char *old;
++ const char *old;
+ char *new;
+ char *delim;
+ };
+
+ static int
+-rename_partmap (char *name, void *data)
++rename_partmap (const char *name, void *data)
+ {
+ char buff[PARAMS_SIZE];
+ int offset;
+@@ -1319,7 +1348,7 @@ rename_partmap (char *name, void *data)
+ }
+
+ int
+-dm_rename_partmaps (char * old, char * new)
++dm_rename_partmaps (const char * old, char * new)
+ {
+ struct rename_data rd;
+
+@@ -1333,7 +1362,7 @@ dm_rename_partmaps (char * old, char * n
+ }
+
+ int
+-dm_rename (char * old, char * new)
++dm_rename (const char * old, char * new)
+ {
+ int r = 0;
+ struct dm_task *dmt;
+Index: multipath-tools-130222/libmultipath/devmapper.h
+===================================================================
+--- multipath-tools-130222.orig/libmultipath/devmapper.h
++++ multipath-tools-130222/libmultipath/devmapper.h
+@@ -47,7 +47,7 @@ int dm_remove_partmaps (const char * map
+ int deferred_remove);
+ int dm_get_uuid(char *name, char *uuid);
+ int dm_get_info (char * mapname, struct dm_info ** dmi);
+-int dm_rename (char * old, char * new);
++int dm_rename (const char * old, char * new);
+ int dm_reassign(const char * mapname);
+ int dm_reassign_table(const char *name, char *old, char *new);
+ int dm_setgeometry(struct multipath *mpp);