File pvscan-restore-polling-in-autoactivation-handler.patch of Package lvm2.3893

From 823c7b090e15c5460369198da3fa07a2ae7e7142 Mon Sep 17 00:00:00 2001
From: Liuhua Wang <lwang@suse.com>
Date: Thu, 28 Apr 2016 19:41:36 +0800
Subject: [PATCH] pvscan: restore polling in autoactivation handler

This commit fixes regression in auto-activation code introduced in
commit: c26d81d6e6939906729d91fae83cd8bbdd743bb7.

Commit:40701af9696a302c904fad30951385eb5a5adb85
References: bsc#970943
---
 tools/pvscan.c   | 9 +++++++++
 tools/tools.h    | 2 ++
 tools/vgchange.c | 4 ++--
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/tools/pvscan.c b/tools/pvscan.c
index 2c997b7..8177576 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -154,6 +154,15 @@ static int _auto_activation_handler(struct cmd_context *cmd,
 		goto out;
 	}
 
+	/*
+	 * After sucessfull activation we need to initialise polling
+	 * for all activated LVs in a VG. Possible enhancement would
+	 * be adding --poll y|n cmdline option for pvscan and call
+	 * init_background_polling routine in autoactivation handler.
+	 */
+	if (!(vgchange_background_polling(vg->cmd, vg)))
+		goto_out;
+
 	r = 1;
 
 out:
diff --git a/tools/tools.h b/tools/tools.h
index e959d80..b292e95 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -187,4 +187,6 @@ int mirror_remove_missing(struct cmd_context *cmd,
 int vgchange_activate(struct cmd_context *cmd, struct volume_group *vg,
 		       activation_change_t activate);
 
+int vgchange_background_polling(struct cmd_context *cmd, struct volume_group *vg);
+
 #endif
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 1665d3e..9fde76e 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -169,7 +169,7 @@ static int _vgchange_monitoring(struct cmd_context *cmd, struct volume_group *vg
 	return r;
 }
 
-static int _vgchange_background_polling(struct cmd_context *cmd, struct volume_group *vg)
+int vgchange_background_polling(struct cmd_context *cmd, struct volume_group *vg)
 {
 	int polled;
 
@@ -691,7 +691,7 @@ static int vgchange_single(struct cmd_context *cmd, const char *vg_name,
 
 	if (!arg_count(cmd, refresh_ARG) &&
 	    background_polling())
-		if (!_vgchange_background_polling(cmd, vg))
+		if (!vgchange_background_polling(cmd, vg))
 			return_ECMD_FAILED;
 
         return ret;
-- 
1.8.4.5
openSUSE Build Service is sponsored by