diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2010-05-19 11:37:02 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2010-05-21 15:12:00 -0400 |
commit | 4604d6366859f781ad16c07a6c65b16fc96e26c5 (patch) | |
tree | 85cf6c3c004c6ab7015d247c69eda699df2dfa2a /drivers/block/drbd | |
parent | 31a31dccdd308d5ec7f9a1197a7875a246a348dc (diff) |
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/block/drbd')
-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, | |||
1217 | mdev->p_uuid = NULL; | 1217 | mdev->p_uuid = NULL; |
1218 | if (get_ldev(mdev)) { | 1218 | if (get_ldev(mdev)) { |
1219 | if ((ns.role == R_PRIMARY || ns.peer == R_PRIMARY) && | 1219 | if ((ns.role == R_PRIMARY || ns.peer == R_PRIMARY) && |
1220 | mdev->ldev->md.uuid[UI_BITMAP] == 0 && ns.disk >= D_UP_TO_DATE) | 1220 | mdev->ldev->md.uuid[UI_BITMAP] == 0 && ns.disk >= D_UP_TO_DATE && |
1221 | !atomic_read(&mdev->new_c_uuid)) | ||
1221 | atomic_set(&mdev->new_c_uuid, 2); | 1222 | atomic_set(&mdev->new_c_uuid, 2); |
1222 | put_ldev(mdev); | 1223 | put_ldev(mdev); |
1223 | } | 1224 | } |
@@ -1225,7 +1226,8 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, | |||
1225 | 1226 | ||
1226 | if (ns.pdsk < D_INCONSISTENT && get_ldev(mdev)) { | 1227 | if (ns.pdsk < D_INCONSISTENT && get_ldev(mdev)) { |
1227 | /* Diskless peer becomes primary or got connected do diskless, primary peer. */ | 1228 | /* Diskless peer becomes primary or got connected do diskless, primary peer. */ |
1228 | if (ns.peer == R_PRIMARY && mdev->ldev->md.uuid[UI_BITMAP] == 0) | 1229 | if (ns.peer == R_PRIMARY && mdev->ldev->md.uuid[UI_BITMAP] == 0 && |
1230 | !atomic_read(&mdev->new_c_uuid)) | ||
1229 | atomic_set(&mdev->new_c_uuid, 2); | 1231 | atomic_set(&mdev->new_c_uuid, 2); |
1230 | 1232 | ||
1231 | /* D_DISKLESS Peer becomes secondary */ | 1233 | /* D_DISKLESS Peer becomes secondary */ |
@@ -1353,12 +1355,14 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, | |||
1353 | static int w_new_current_uuid(struct drbd_conf *mdev, struct drbd_work *w, int cancel) | 1355 | static int w_new_current_uuid(struct drbd_conf *mdev, struct drbd_work *w, int cancel) |
1354 | { | 1356 | { |
1355 | if (get_ldev(mdev)) { | 1357 | if (get_ldev(mdev)) { |
1356 | drbd_uuid_new_current(mdev); | 1358 | if (mdev->ldev->md.uuid[UI_BITMAP] == 0) { |
1357 | if (get_net_conf(mdev)) { | 1359 | drbd_uuid_new_current(mdev); |
1358 | drbd_send_uuids(mdev); | 1360 | if (get_net_conf(mdev)) { |
1359 | put_net_conf(mdev); | 1361 | drbd_send_uuids(mdev); |
1362 | put_net_conf(mdev); | ||
1363 | } | ||
1364 | drbd_md_sync(mdev); | ||
1360 | } | 1365 | } |
1361 | drbd_md_sync(mdev); | ||
1362 | put_ldev(mdev); | 1366 | put_ldev(mdev); |
1363 | } | 1367 | } |
1364 | atomic_dec(&mdev->new_c_uuid); | 1368 | atomic_dec(&mdev->new_c_uuid); |