[CRIU] [PATCH] dump: Don't allocate dfds in case we dump shared fdtable
Pavel Emelyanov
xemul at parallels.com
Wed Aug 27 02:10:13 PDT 2014
After patches, that dump locks w/o dfds array, we can even
not allocate one when we don't need it.
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
cr-dump.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/cr-dump.c b/cr-dump.c
index 8abb142..4b9fc9f 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -1516,14 +1516,16 @@ static int dump_one_task(struct pstree_item *item)
goto err;
}
- dfds = xmalloc(sizeof(*dfds));
- if (!dfds)
- goto err;
+ if (!shared_fdtable(item)) {
+ dfds = xmalloc(sizeof(*dfds));
+ if (!dfds)
+ goto err;
- ret = collect_fds(pid, dfds);
- if (ret) {
- pr_err("Collect fds (pid: %d) failed with %d\n", pid, ret);
- goto err;
+ ret = collect_fds(pid, dfds);
+ if (ret) {
+ pr_err("Collect fds (pid: %d) failed with %d\n", pid, ret);
+ goto err;
+ }
}
ret = parse_posix_timers(pid, &proc_args);
@@ -1597,7 +1599,7 @@ static int dump_one_task(struct pstree_item *item)
goto err_cure;
}
- if (!shared_fdtable(item)) {
+ if (dfds) {
ret = dump_task_files_seized(parasite_ctl, item, dfds);
if (ret) {
pr_err("Dump files (pid: %d) failed with %d\n", pid, ret);
--
1.8.4.2
More information about the CRIU
mailing list