diff options
author | Sverker Eriksson <[email protected]> | 2018-09-11 16:56:29 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2018-09-11 16:56:29 +0200 |
commit | 49504906b4a16b69e52beb09e92f68c6ccd51753 (patch) | |
tree | 35ef0bcac236ce8ce6fcbc7bdcbc07764153b106 /erts/emulator/beam/dist.c | |
parent | 30e5321740b96b3a8984611b6f821692716d0555 (diff) | |
download | otp-49504906b4a16b69e52beb09e92f68c6ccd51753.tar.gz otp-49504906b4a16b69e52beb09e92f68c6ccd51753.tar.bz2 otp-49504906b4a16b69e52beb09e92f68c6ccd51753.zip |
erts: Fix "Prevent inconsistent node lists" fix
done in a31216200bdee2c04b3fb3ae5e26607674715c8a
that could cause a new pending connection to be incorrectly aborted.
Diffstat (limited to 'erts/emulator/beam/dist.c')
-rw-r--r-- | erts/emulator/beam/dist.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/erts/emulator/beam/dist.c b/erts/emulator/beam/dist.c index 16c4d689a5..1e822d5c7b 100644 --- a/erts/emulator/beam/dist.c +++ b/erts/emulator/beam/dist.c @@ -3563,20 +3563,18 @@ BIF_RETTYPE erts_internal_new_connection_1(BIF_ALIST_1) BIF_RET(TUPLE2(hp, make_small(conn_id), dhandle)); } -static Sint abort_connection(DistEntry* dep, Uint32 conn_id) +Sint erts_abort_connection_rwunlock(DistEntry* dep) { - erts_de_rwlock(dep); + Sint reds = 0; + ERTS_LC_ASSERT(erts_lc_is_de_rwlocked(dep)); - if (dep->connection_id != conn_id) - ; - else if (dep->state == ERTS_DE_STATE_CONNECTED) { + if (dep->state == ERTS_DE_STATE_CONNECTED) { kill_connection(dep); } else if (dep->state == ERTS_DE_STATE_PENDING) { ErtsAtomCache *cache; ErtsDistOutputBuf *obuf; ErtsProcList *resume_procs; - Sint reds = 0; ErtsMonLnkDist *mld; ASSERT(is_nil(dep->cid)); @@ -3621,17 +3619,18 @@ static Sint abort_connection(DistEntry* dep, Uint32 conn_id) erts_de_rwlock(dep); ASSERT(dep->state == ERTS_DE_STATE_EXITING); dep->state = ERTS_DE_STATE_IDLE; - erts_de_rwunlock(dep); - return reds; } erts_de_rwunlock(dep); - return 0; + return reds; } -Sint -erts_abort_connection(DistEntry *dep, Uint32 conn_id) +static Sint abort_connection(DistEntry *dep, Uint32 conn_id) { - return abort_connection(dep, conn_id); + erts_de_rwlock(dep); + if (dep->connection_id == conn_id) + return erts_abort_connection_rwunlock(dep); + erts_de_rwunlock(dep); + return 0; } BIF_RETTYPE erts_internal_abort_connection_2(BIF_ALIST_2) |