Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 346295
b: refs/heads/master
c: 13c76ab
h: refs/heads/master
i:
  346293: dbcf24b
  346291: 2a07ef7
  346287: 6bfadae
v: v3
  • Loading branch information
Philipp Reisner committed Dec 6, 2012
1 parent 96c6bea commit 7f48035
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 691631c0652bc47e6d20b0d981e23a9025fd794e
refs/heads/master: 13c76aba7846647f86d479293ae0a0adc1ca840a
10 changes: 10 additions & 0 deletions trunk/drivers/block/drbd/drbd_receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,16 @@ static int conn_connect(struct drbd_tconn *tconn)
rcu_read_lock();
idr_for_each_entry(&tconn->volumes, mdev, vnr) {
kref_get(&mdev->kref);
/* Prevent a race between resync-handshake and
* being promoted to Primary.
*
* Grab and release the state mutex, so we know that any current
* drbd_set_role() is finished, and any incoming drbd_set_role
* will see the STATE_SENT flag, and wait for it to be cleared.
*/
mutex_lock(mdev->state_mutex);
mutex_unlock(mdev->state_mutex);

rcu_read_unlock();

if (discard_my_data)
Expand Down

0 comments on commit 7f48035

Please sign in to comment.