Fairly nasty copy-and-paste based approach to making this more transactional. (Again, this time branched from stable correctly.)
Merge in stable
Use mnesia:async_dirty/1 to reduce copypasta.
Eliminate list_tx variants since async_dirty is ignored in a tx.
Table locking -> O(n)
Merged bug25846 into stable