[v2,07/17] action scripts: set spfs environment in run_scripts

Submitted by Stanislav Kinsburskiy on May 19, 2016, 9:23 a.m.

Details

Message ID 20160519092332.52641.49024.stgit@skinsbursky-vz7-gold.qa.sw.ru
State Rejected
Series "NFS migration support"
Headers show

Commit Message

Stanislav Kinsburskiy May 19, 2016, 9:23 a.m.
This environment is required to switch spfs mount points into Stub mode, once
files reopen is completed.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
---
 criu/action-scripts.c |    7 +++++++
 1 file changed, 7 insertions(+)

Patch hide | download patch | download mbox

diff --git a/criu/action-scripts.c b/criu/action-scripts.c
index ee59210..500e239 100644
--- a/criu/action-scripts.c
+++ b/criu/action-scripts.c
@@ -11,6 +11,7 @@ 
 #include "cr-service.h"
 #include "action-scripts.h"
 #include "pstree.h"
+#include "spfs.h"
 
 static const char *action_names[ACT_MAX] = {
 	[ ACT_PRE_DUMP ]	= "pre-dump",
@@ -48,6 +49,7 @@  static int run_shell_scripts(const char *action)
 
 #define ENV_IMGDIR	0x1
 #define ENV_ROOTPID	0x2
+#define ENV_SPFS	0x3
 
 	if (setenv("CRTOOLS_SCRIPT_ACTION", action, 1)) {
 		pr_perror("Can't set CRTOOLS_SCRIPT_ACTION=%s", action);
@@ -78,6 +80,11 @@  static int run_shell_scripts(const char *action)
 		}
 	}
 
+	if (!(env_set & ENV_IMGDIR)) {
+		if (spfs_set_env())
+			return -1;
+	}
+
 	list_for_each_entry(script, &scripts, node) {
 		pr_debug("\t[%s]\n", script->path);
 		ret |= system(script->path);