[CRIU] [PATCH] Fix use of fallocate on systems that do not export FALLOC_FL_KEEP_SIZE and FALLOC_FL_PUNCH_HOLE in fcntl.h
Pawel Stradomski
pstradomski at google.com
Tue Jul 24 14:10:32 MSK 2018
Signed-off-by: Pawel Stradomski <pstradomski at google.com>
---
criu/pie/restorer.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c
index 3f1a8a6b..c5aee895 100644
--- a/criu/pie/restorer.c
+++ b/criu/pie/restorer.c
@@ -50,6 +50,15 @@
#define PR_SET_PDEATHSIG 1
#endif
+#ifndef FALLOC_FL_KEEP_SIZE
+#define FALLOC_FL_KEEP_SIZE 0x01
+#endif
+
+#ifndef FALLOC_FL_PUNCH_HOLE
+#define FALLOC_FL_PUNCH_HOLE 0x02
+#endif
+
+
#define sys_prctl_safe(opcode, val1, val2, val3) \
({ \
long __ret = sys_prctl(opcode, val1, val2, val3, 0); \
@@ -1379,7 +1388,6 @@ long __export_restore_task(struct task_restore_args *args)
/* TODO: Check if auto-dedup is enabled instead of trusting fallocate to fail
* if the file is not opened for writing. */
if (r > 0) {
- pr_debug(" `fallocate %d %ld %ld\n", args->vma_ios_fd, rio->off, r);
sys_fallocate(args->vma_ios_fd, FALLOC_FL_KEEP_SIZE|FALLOC_FL_PUNCH_HOLE,
rio->off, r);
}
--
2.18.0.233.g985f88cf7e-goog
More information about the CRIU
mailing list