From efbb44cf4bebd85bf031501e99f16abb5ee1b441 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Tue, 15 Sep 2020 10:33:37 +0200 Subject: [PATCH] all: earlier rot destruction --- kernel/sy_old/mars_main.c | 11 +++++++++++ kernel/sy_old/sy_generic.c | 13 +++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/kernel/sy_old/mars_main.c b/kernel/sy_old/mars_main.c index b11a4f73..a7179921 100644 --- a/kernel/sy_old/mars_main.c +++ b/kernel/sy_old/mars_main.c @@ -7001,6 +7001,17 @@ done: mars_remote_trigger(MARS_TRIGGER_TO_REMOTE); brick_msleep(1000); + down_write(&rot_sem); + while (!list_empty(&rot_anchor)) { + struct mars_rotate *rot; + + rot = container_of(rot_anchor.next, struct mars_rotate, rot_head); + up_write(&rot_sem); + rot_destruct(rot); + down_write(&rot_sem); + } + up_write(&rot_sem); + mars_free_dent_all(mars_global, &mars_global->dent_anchor); mars_kill_brick_all(mars_global, &mars_global->brick_anchor, false); diff --git a/kernel/sy_old/sy_generic.c b/kernel/sy_old/sy_generic.c index 76c3e4c2..a13e5067 100644 --- a/kernel/sy_old/sy_generic.c +++ b/kernel/sy_old/sy_generic.c @@ -2402,6 +2402,13 @@ void mars_free_dent(struct mars_global *global, struct mars_dent *dent) free_mars_global(dent->d_subtree); } + if (dent->d_private) { + if (dent->d_private_destruct) { + dent->d_private_destruct(dent->d_private); + } + brick_mem_free(dent->d_private); + } + for (i = 0; i < MARS_ARGV_MAX; i++) { brick_string_free(dent->d_argv[i]); } @@ -2413,12 +2420,6 @@ void mars_free_dent(struct mars_global *global, struct mars_dent *dent) brick_string_free(dent->new_link); if (dent->d_parent) dent->d_parent->d_child_count--; - if (dent->d_private) { - if (dent->d_private_destruct) { - dent->d_private_destruct(dent->d_private); - } - brick_mem_free(dent->d_private); - } brick_mem_free(dent); } EXPORT_SYMBOL_GPL(mars_free_dent);