Before this commit, deadlocks were possible (and detected), because some functions took row_versions lock first, and then individual transaction locks, while other functions took the locks in opposite order.