infra: fix deadlock on leave-cluster & friends

root@m1:~# cat /proc/2661/stack
[<ffffffff810591cc>] kthread_stop+0x7f/0x10d
[<ffffffffa01660a5>] _kill_peer.isra.7+0xf9/0x1ea [mars]
[<ffffffffa01661f2>] peer_destruct+0xe/0x10 [mars]
[<ffffffffa015c66a>] mars_free_dent+0x188/0x1b4 [mars]
[<ffffffffa015ca5a>] mars_dent_work+0x3c4/0x563 [mars]
[<ffffffffa01652d7>] _main_thread+0x2b2/0x88d [mars]
[<ffffffff81059145>] kthread+0xb5/0xbd
[<ffffffff81660a19>] ret_from_fork+0x49/0x80
[<ffffffffffffffff>] 0xffffffffffffffff

root@m1:~# cat /proc/4473/stack
[<ffffffff81342154>] call_rwsem_down_read_failed+0x14/0x30
[<ffffffffa015a554>] mars_find_dent+0x19/0x3d [mars]
[<ffffffffa015dadc>] _mars_translate_hostname+0x86/0x126 [mars]
[<ffffffffa0166663>] peer_thread+0x46f/0xdc0 [mars]
[<ffffffff81059145>] kthread+0xb5/0xbd
[<ffffffff81660a19>] ret_from_fork+0x49/0x80
[<ffffffffffffffff>] 0xffffffffffffffff
This commit is contained in:
Thomas Schoebel-Theuer 2017-09-01 14:46:54 +02:00
parent 611cb1e7f7
commit 6c56b53850
1 changed files with 5 additions and 11 deletions

View File

@ -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;
}