Commit d58aafc4 authored by Pavel Emelyanov's avatar Pavel Emelyanov

dump: Don't allocate dfds in case we dump shared fdtable

After patches, that dump locks w/o dfds array, we can even
not allocate one when we don't need it.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 2c765509
...@@ -1516,14 +1516,16 @@ static int dump_one_task(struct pstree_item *item) ...@@ -1516,14 +1516,16 @@ static int dump_one_task(struct pstree_item *item)
goto err; goto err;
} }
dfds = xmalloc(sizeof(*dfds)); if (!shared_fdtable(item)) {
if (!dfds) dfds = xmalloc(sizeof(*dfds));
goto err; if (!dfds)
goto err;
ret = collect_fds(pid, dfds); ret = collect_fds(pid, dfds);
if (ret) { if (ret) {
pr_err("Collect fds (pid: %d) failed with %d\n", pid, ret); pr_err("Collect fds (pid: %d) failed with %d\n", pid, ret);
goto err; goto err;
}
} }
ret = parse_posix_timers(pid, &proc_args); ret = parse_posix_timers(pid, &proc_args);
...@@ -1597,7 +1599,7 @@ static int dump_one_task(struct pstree_item *item) ...@@ -1597,7 +1599,7 @@ static int dump_one_task(struct pstree_item *item)
goto err_cure; goto err_cure;
} }
if (!shared_fdtable(item)) { if (dfds) {
ret = dump_task_files_seized(parasite_ctl, item, dfds); ret = dump_task_files_seized(parasite_ctl, item, dfds);
if (ret) { if (ret) {
pr_err("Dump files (pid: %d) failed with %d\n", pid, ret); pr_err("Dump files (pid: %d) failed with %d\n", pid, ret);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment