[lvm-devel] master - pvremove: skip lvmlockd locks for forced clearing

David Teigland teigland at sourceware.org
Thu May 31 14:14:49 UTC 2018


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3759a1f62bf314fbe2f25b2365c1aebca8071e31
Commit:        3759a1f62bf314fbe2f25b2365c1aebca8071e31
Parent:        5c5e449dc5f955481f9409ff0e7ed39cf7b2e87d
Author:        David Teigland <teigland at redhat.com>
AuthorDate:    Fri May 25 15:57:17 2018 -0500
Committer:     David Teigland <teigland at redhat.com>
CommitterDate: Wed May 30 09:25:45 2018 -0500

pvremove: skip lvmlockd locks for forced clearing

pvremove -ff to force clear a PV shouldn't care if
lvmlockd locks fail.
---
 tools/pvremove.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/tools/pvremove.c b/tools/pvremove.c
index 28c7b83..06a7e73 100644
--- a/tools/pvremove.c
+++ b/tools/pvremove.c
@@ -39,10 +39,19 @@ int pvremove(struct cmd_context *cmd, int argc, char **argv)
 	 * (disable afterward to prevent process_each_pv from doing
 	 * a shared global lock since it's already acquired it ex.)
 	 */
-	if (!lockd_gl(cmd, "ex", 0))
-		return_ECMD_FAILED;
+	if (!lockd_gl(cmd, "ex", 0)) {
+		/* Let pvremove -ff skip locks */
+		if (pp.force == DONT_PROMPT_OVERRIDE)
+			log_warn("WARNING: skipping global lock in lvmlockd for force.");
+		else
+			return_ECMD_FAILED;
+	}
 	cmd->lockd_gl_disable = 1;
 
+	/* When forcibly clearing a PV we don't care about a VG lock. */
+	if (pp.force == DONT_PROMPT_OVERRIDE)
+		cmd->lockd_vg_disable = 1;
+
 	if (!(handle = init_processing_handle(cmd, NULL))) {
 		log_error("Failed to initialize processing handle.");
 		return ECMD_FAILED;




More information about the lvm-devel mailing list