diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2010-05-19 17:37:02 +0200 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2010-05-21 21:12:00 +0200 |
commit | 4604d6366859f781ad16c07a6c65b16fc96e26c5 (patch) | |
tree | 85cf6c3c004c6ab7015d247c69eda699df2dfa2a /drivers | |
parent | 31a31dccdd308d5ec7f9a1197a7875a246a348dc (diff) | |
download | linux-4604d6366859f781ad16c07a6c65b16fc96e26c5.tar.bz2 |
drbd: Ensure to not trigger late-new-UUID creation multiple times
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 7e057b074bbd..a949fc45f7ef 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c @@ -1217,7 +1217,8 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, mdev->p_uuid = NULL; if (get_ldev(mdev)) { if ((ns.role == R_PRIMARY || ns.peer == R_PRIMARY) && - mdev->ldev->md.uuid[UI_BITMAP] == 0 && ns.disk >= D_UP_TO_DATE) + mdev->ldev->md.uuid[UI_BITMAP] == 0 && ns.disk >= D_UP_TO_DATE && + !atomic_read(&mdev->new_c_uuid)) atomic_set(&mdev->new_c_uuid, 2); put_ldev(mdev); } @@ -1225,7 +1226,8 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, if (ns.pdsk < D_INCONSISTENT && get_ldev(mdev)) { /* Diskless peer becomes primary or got connected do diskless, primary peer. */ - if (ns.peer == R_PRIMARY && mdev->ldev->md.uuid[UI_BITMAP] == 0) + if (ns.peer == R_PRIMARY && mdev->ldev->md.uuid[UI_BITMAP] == 0 && + !atomic_read(&mdev->new_c_uuid)) atomic_set(&mdev->new_c_uuid, 2); /* D_DISKLESS Peer becomes secondary */ @@ -1353,12 +1355,14 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, static int w_new_current_uuid(struct drbd_conf *mdev, struct drbd_work *w, int cancel) { if (get_ldev(mdev)) { - drbd_uuid_new_current(mdev); - if (get_net_conf(mdev)) { - drbd_send_uuids(mdev); - put_net_conf(mdev); + if (mdev->ldev->md.uuid[UI_BITMAP] == 0) { + drbd_uuid_new_current(mdev); + if (get_net_conf(mdev)) { + drbd_send_uuids(mdev); + put_net_conf(mdev); + } + drbd_md_sync(mdev); } - drbd_md_sync(mdev); put_ldev(mdev); } atomic_dec(&mdev->new_c_uuid); |