From 6c56b53850c54417a9facd354100c34eed3e8e4e Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Fri, 1 Sep 2017 14:46:54 +0200 Subject: [PATCH] infra: fix deadlock on leave-cluster & friends root@m1:~# cat /proc/2661/stack [] kthread_stop+0x7f/0x10d [] _kill_peer.isra.7+0xf9/0x1ea [mars] [] peer_destruct+0xe/0x10 [mars] [] mars_free_dent+0x188/0x1b4 [mars] [] mars_dent_work+0x3c4/0x563 [mars] [] _main_thread+0x2b2/0x88d [mars] [] kthread+0xb5/0xbd [] ret_from_fork+0x49/0x80 [] 0xffffffffffffffff root@m1:~# cat /proc/4473/stack [] call_rwsem_down_read_failed+0x14/0x30 [] mars_find_dent+0x19/0x3d [mars] [] _mars_translate_hostname+0x86/0x126 [mars] [] peer_thread+0x46f/0xdc0 [mars] [] kthread+0xb5/0xbd [] ret_from_fork+0x49/0x80 [] 0xffffffffffffffff --- kernel/sy_old/sy_net.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/kernel/sy_old/sy_net.c b/kernel/sy_old/sy_net.c index ea8736a2..301dbb5d 100644 --- a/kernel/sy_old/sy_net.c +++ b/kernel/sy_old/sy_net.c @@ -36,14 +36,9 @@ static char *_mars_translate_hostname(const char *name) { - struct mars_global *global = mars_global; char *res = brick_strdup(name); - struct mars_dent *test; char *tmp; - - if (unlikely(!global)) { - goto done; - } + char *trans; for (tmp = res; *tmp; tmp++) { if (*tmp == ':') { @@ -57,16 +52,15 @@ char *_mars_translate_hostname(const char *name) goto done; } - test = mars_find_dent(global, tmp); - if (test && test->new_link) { - MARS_DBG("'%s' => '%s'\n", tmp, test->new_link); + trans = mars_readlink(tmp); + if (trans && trans[0]) { + MARS_DBG("'%s' => '%s'\n", tmp, trans); brick_string_free(res); - res = brick_strdup(test->new_link); + res = trans; } else { MARS_DBG("no translation for '%s'\n", tmp); } brick_string_free(tmp); - done: return res; }