Skip to contentSkip to conversation

master - toollib: skip processing the sanlock LV unless named or all

PATCH David Teigland 1 participant 1 message Jul 8, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=143a9d7ee690c68269572a44f4f1e396916c9b57
Commit:        143a9d7ee690c68269572a44f4f1e396916c9b57
Parent:        6e1f421a6d3a515a9720514bbcceb6789f96dd44
Author:        David Teigland <[email protected]>
AuthorDate:    Tue Jul 7 16:04:18 2015 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Wed Jul 8 10:27:21 2015 -0500

toollib: skip processing the sanlock LV unless named or all

This prevents 'lvremove vgname' from attempting to remove the hidden sanlock LV. Only vgremove should remove the hidden sanlock LV holding the sanlock locks.

---
 tools/toollib.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
tools/toollib.c +14 -1
index 8c301bb..b0b2b01 100644
@@ -2135,13 +2135,26 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
 		}
 
 		/*
-		 * Only let hidden LVs through it --all was used or the LVs 
+		 * Only let hidden LVs through if --all was used or the LVs 
 		 * were specifically named on the command line.
 		 */
 		if (!lvargs_supplied && !lv_is_visible(lvl->lv) && !arg_count(cmd, all_ARG))
 			continue;
 
 		/*
+		 * Only let sanlock LV through if --all was used or if
+		 * it is named on the command line.
+		 */
+		if (lv_is_lockd_sanlock_lv(lvl->lv)) {
+			if (arg_count(cmd, all_ARG) ||
+			    (lvargs_supplied && str_list_match_item(arg_lvnames, lvl->lv->name))) {
+				log_very_verbose("Processing lockd_sanlock_lv %s/%s.", vg->name, lvl->lv->name);
+			} else {
+				continue;
+			}
+		}
+
+		/*
 		 * process the LV if one of the following:
 		 * - process_all is set
 		 * - LV name matches a supplied LV name