[CRIU] [PATCH 01/11] crtools: Add --file-locks option

Qiang Huang h.huangqiang at huawei.com
Thu Jan 17 03:09:27 EST 2013


Add --file-locks/-l option to support handling file locks, for safety,
only used for container.

Originally-signed-off-by: Zheng Gu <cengku.gu at huawei.com>
Signed-off-by: Qiang Huang <h.huangqiang at huawei.com>
---
 crtools.c         |    7 ++++++-
 include/crtools.h |    1 +
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/crtools.c b/crtools.c
index b4f4b53..fd75716 100644
--- a/crtools.c
+++ b/crtools.c
@@ -60,7 +60,7 @@ int main(int argc, char *argv[])
 	int log_inited = 0;
 	int log_level = 0;
 
-	static const char short_opts[] = "dsf:t:hcD:o:n:vxVr:j";
+	static const char short_opts[] = "dsf:t:hcD:o:n:vxVr:jl";
 
 	BUILD_BUG_ON(PAGE_SIZE != PAGE_IMAGE_SIZE);
 
@@ -100,6 +100,7 @@ int main(int argc, char *argv[])
 			{ "action-script", required_argument, 0, 49},
 			{ LREMAP_PARAM, no_argument, 0, 41},
 			{ "shell-job", no_argument, 0, 'j'},
+			{ "file-locks", no_argument, 0, 'l'},
 			{ },
 		};
 
@@ -221,6 +222,9 @@ int main(int argc, char *argv[])
 		case 'j':
 			opts.shell_job = true;
 			break;
+		case 'l':
+			opts.handle_file_locks = true;
+			break;
 		case 'V':
 			pr_msg("Version: %d.%d\n", CRIU_VERSION_MAJOR, CRIU_VERSION_MINOR);
 			return 0;
@@ -330,6 +334,7 @@ usage:
 	pr_msg("			* network-lock - lock network in a target network namespace\n");
 	pr_msg("			* network-unlock - unlock network in a target network namespace\n");
 	pr_msg("  -j|--shell-job        allow to dump and restore shell jobs\n");
+	pr_msg("  -l|--file_locks	handle file locks, for safety, only used for container\n");
 
 	pr_msg("\n* Logging:\n");
 	pr_msg("  -o|--log-file [NAME]  log file name (relative path is relative to --images-dir)\n");
diff --git a/include/crtools.h b/include/crtools.h
index 326f0df..a01f52e 100644
--- a/include/crtools.h
+++ b/include/crtools.h
@@ -93,6 +93,7 @@ struct cr_options {
 	bool			restore_detach;
 	bool			ext_unix_sk;
 	bool			shell_job;
+	bool			handle_file_locks;
 	bool			tcp_established_ok;
 	bool			evasive_devices;
 	bool			link_remap_ok;
-- 
1.7.1




More information about the CRIU mailing list