aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mnesia/src/mnesia_locker.erl
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2011-12-07 10:09:28 +0100
committerDan Gudmundsson <[email protected]>2011-12-07 10:09:28 +0100
commitfe9e57f765c428e7e9b94e24250d83474e77f09f (patch)
treef0817fe29e73a14f4ba489c93c1d3f9de438dba8 /lib/mnesia/src/mnesia_locker.erl
parent8bce2d5a342bda12aad6607312e3796a37d7c8eb (diff)
downloadotp-fe9e57f765c428e7e9b94e24250d83474e77f09f.tar.gz
otp-fe9e57f765c428e7e9b94e24250d83474e77f09f.tar.bz2
otp-fe9e57f765c428e7e9b94e24250d83474e77f09f.zip
[mnesia] Read record from correct node
Read from where_to_read otherwise bad data may read during move_table, where where_to_write is updated before where_to_read and the table is available.
Diffstat (limited to 'lib/mnesia/src/mnesia_locker.erl')
-rw-r--r--lib/mnesia/src/mnesia_locker.erl3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/mnesia/src/mnesia_locker.erl b/lib/mnesia/src/mnesia_locker.erl
index 5581c6c4a8..de4811f8e4 100644
--- a/lib/mnesia/src/mnesia_locker.erl
+++ b/lib/mnesia/src/mnesia_locker.erl
@@ -657,7 +657,8 @@ rwlock(Tid, Store, Oid) ->
Lock = write,
case need_lock(Store, Tab, Key, Lock) of
yes ->
- {Ns, Majority} = w_nodes(Tab),
+ {Ns0, Majority} = w_nodes(Tab),
+ Ns = [Node|lists:delete(Node,Ns0)],
check_majority(Majority, Tab, Ns),
Res = get_rwlocks_on_nodes(Ns, make_ref(), Store, Tid, Oid),
?ets_insert(Store, {{locks, Tab, Key}, Lock}),