diff options
Diffstat (limited to 'drivers/block/drbd/drbd_nl.c')
-rw-r--r-- | drivers/block/drbd/drbd_nl.c | 90 |
1 files changed, 46 insertions, 44 deletions
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index 1b5b7ea7f7cc..a8c9c86e29f5 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c | |||
@@ -246,10 +246,10 @@ static int drbd_adm_prepare(struct sk_buff *skb, struct genl_info *info, | |||
246 | 246 | ||
247 | /* some more paranoia, if the request was over-determined */ | 247 | /* some more paranoia, if the request was over-determined */ |
248 | if (adm_ctx.device && adm_ctx.connection && | 248 | if (adm_ctx.device && adm_ctx.connection && |
249 | adm_ctx.device->connection != adm_ctx.connection) { | 249 | first_peer_device(adm_ctx.device)->connection != adm_ctx.connection) { |
250 | pr_warning("request: minor=%u, resource=%s; but that minor belongs to connection %s\n", | 250 | pr_warning("request: minor=%u, resource=%s; but that minor belongs to connection %s\n", |
251 | adm_ctx.minor, adm_ctx.resource_name, | 251 | adm_ctx.minor, adm_ctx.resource_name, |
252 | adm_ctx.device->connection->name); | 252 | first_peer_device(adm_ctx.device)->connection->name); |
253 | drbd_msg_put_info("minor exists in different resource"); | 253 | drbd_msg_put_info("minor exists in different resource"); |
254 | return ERR_INVALID_REQUEST; | 254 | return ERR_INVALID_REQUEST; |
255 | } | 255 | } |
@@ -258,7 +258,7 @@ static int drbd_adm_prepare(struct sk_buff *skb, struct genl_info *info, | |||
258 | adm_ctx.volume != adm_ctx.device->vnr) { | 258 | adm_ctx.volume != adm_ctx.device->vnr) { |
259 | pr_warning("request: minor=%u, volume=%u; but that minor is volume %u in %s\n", | 259 | pr_warning("request: minor=%u, volume=%u; but that minor is volume %u in %s\n", |
260 | adm_ctx.minor, adm_ctx.volume, | 260 | adm_ctx.minor, adm_ctx.volume, |
261 | adm_ctx.device->vnr, adm_ctx.device->connection->name); | 261 | adm_ctx.device->vnr, first_peer_device(adm_ctx.device)->connection->name); |
262 | drbd_msg_put_info("minor exists as different volume"); | 262 | drbd_msg_put_info("minor exists as different volume"); |
263 | return ERR_INVALID_REQUEST; | 263 | return ERR_INVALID_REQUEST; |
264 | } | 264 | } |
@@ -323,7 +323,7 @@ int drbd_khelper(struct drbd_device *device, char *cmd) | |||
323 | NULL }; | 323 | NULL }; |
324 | char mb[12]; | 324 | char mb[12]; |
325 | char *argv[] = {usermode_helper, cmd, mb, NULL }; | 325 | char *argv[] = {usermode_helper, cmd, mb, NULL }; |
326 | struct drbd_connection *connection = device->connection; | 326 | struct drbd_connection *connection = first_peer_device(device)->connection; |
327 | struct sib_info sib; | 327 | struct sib_info sib; |
328 | int ret; | 328 | int ret; |
329 | 329 | ||
@@ -544,7 +544,7 @@ drbd_set_role(struct drbd_device *device, enum drbd_role new_role, int force) | |||
544 | union drbd_state mask, val; | 544 | union drbd_state mask, val; |
545 | 545 | ||
546 | if (new_role == R_PRIMARY) | 546 | if (new_role == R_PRIMARY) |
547 | request_ping(device->connection); /* Detect a dead peer ASAP */ | 547 | request_ping(first_peer_device(device)->connection); /* Detect a dead peer ASAP */ |
548 | 548 | ||
549 | mutex_lock(device->state_mutex); | 549 | mutex_lock(device->state_mutex); |
550 | 550 | ||
@@ -575,7 +575,7 @@ drbd_set_role(struct drbd_device *device, enum drbd_role new_role, int force) | |||
575 | device->state.disk == D_CONSISTENT && mask.pdsk == 0) { | 575 | device->state.disk == D_CONSISTENT && mask.pdsk == 0) { |
576 | D_ASSERT(device->state.pdsk == D_UNKNOWN); | 576 | D_ASSERT(device->state.pdsk == D_UNKNOWN); |
577 | 577 | ||
578 | if (conn_try_outdate_peer(device->connection)) { | 578 | if (conn_try_outdate_peer(first_peer_device(device)->connection)) { |
579 | val.disk = D_UP_TO_DATE; | 579 | val.disk = D_UP_TO_DATE; |
580 | mask.disk = D_MASK; | 580 | mask.disk = D_MASK; |
581 | } | 581 | } |
@@ -585,7 +585,7 @@ drbd_set_role(struct drbd_device *device, enum drbd_role new_role, int force) | |||
585 | if (rv == SS_NOTHING_TO_DO) | 585 | if (rv == SS_NOTHING_TO_DO) |
586 | goto out; | 586 | goto out; |
587 | if (rv == SS_PRIMARY_NOP && mask.pdsk == 0) { | 587 | if (rv == SS_PRIMARY_NOP && mask.pdsk == 0) { |
588 | if (!conn_try_outdate_peer(device->connection) && force) { | 588 | if (!conn_try_outdate_peer(first_peer_device(device)->connection) && force) { |
589 | dev_warn(DEV, "Forced into split brain situation!\n"); | 589 | dev_warn(DEV, "Forced into split brain situation!\n"); |
590 | mask.pdsk = D_MASK; | 590 | mask.pdsk = D_MASK; |
591 | val.pdsk = D_OUTDATED; | 591 | val.pdsk = D_OUTDATED; |
@@ -598,7 +598,7 @@ drbd_set_role(struct drbd_device *device, enum drbd_role new_role, int force) | |||
598 | retry at most once more in this case. */ | 598 | retry at most once more in this case. */ |
599 | int timeo; | 599 | int timeo; |
600 | rcu_read_lock(); | 600 | rcu_read_lock(); |
601 | nc = rcu_dereference(device->connection->net_conf); | 601 | nc = rcu_dereference(first_peer_device(device)->connection->net_conf); |
602 | timeo = nc ? (nc->ping_timeo + 1) * HZ / 10 : 1; | 602 | timeo = nc ? (nc->ping_timeo + 1) * HZ / 10 : 1; |
603 | rcu_read_unlock(); | 603 | rcu_read_unlock(); |
604 | schedule_timeout_interruptible(timeo); | 604 | schedule_timeout_interruptible(timeo); |
@@ -633,11 +633,11 @@ drbd_set_role(struct drbd_device *device, enum drbd_role new_role, int force) | |||
633 | put_ldev(device); | 633 | put_ldev(device); |
634 | } | 634 | } |
635 | } else { | 635 | } else { |
636 | mutex_lock(&device->connection->conf_update); | 636 | mutex_lock(&first_peer_device(device)->connection->conf_update); |
637 | nc = device->connection->net_conf; | 637 | nc = first_peer_device(device)->connection->net_conf; |
638 | if (nc) | 638 | if (nc) |
639 | nc->discard_my_data = 0; /* without copy; single bit op is atomic */ | 639 | nc->discard_my_data = 0; /* without copy; single bit op is atomic */ |
640 | mutex_unlock(&device->connection->conf_update); | 640 | mutex_unlock(&first_peer_device(device)->connection->conf_update); |
641 | 641 | ||
642 | set_disk_ro(device->vdisk, false); | 642 | set_disk_ro(device->vdisk, false); |
643 | if (get_ldev(device)) { | 643 | if (get_ldev(device)) { |
@@ -1134,12 +1134,12 @@ void drbd_reconsider_max_bio_size(struct drbd_device *device) | |||
1134 | Because new from 8.3.8 onwards the peer can use multiple | 1134 | Because new from 8.3.8 onwards the peer can use multiple |
1135 | BIOs for a single peer_request */ | 1135 | BIOs for a single peer_request */ |
1136 | if (device->state.conn >= C_WF_REPORT_PARAMS) { | 1136 | if (device->state.conn >= C_WF_REPORT_PARAMS) { |
1137 | if (device->connection->agreed_pro_version < 94) | 1137 | if (first_peer_device(device)->connection->agreed_pro_version < 94) |
1138 | peer = min(device->peer_max_bio_size, DRBD_MAX_SIZE_H80_PACKET); | 1138 | peer = min(device->peer_max_bio_size, DRBD_MAX_SIZE_H80_PACKET); |
1139 | /* Correct old drbd (up to 8.3.7) if it believes it can do more than 32KiB */ | 1139 | /* Correct old drbd (up to 8.3.7) if it believes it can do more than 32KiB */ |
1140 | else if (device->connection->agreed_pro_version == 94) | 1140 | else if (first_peer_device(device)->connection->agreed_pro_version == 94) |
1141 | peer = DRBD_MAX_SIZE_H80_PACKET; | 1141 | peer = DRBD_MAX_SIZE_H80_PACKET; |
1142 | else if (device->connection->agreed_pro_version < 100) | 1142 | else if (first_peer_device(device)->connection->agreed_pro_version < 100) |
1143 | peer = DRBD_MAX_BIO_SIZE_P95; /* drbd 8.3.8 onwards, before 8.4.0 */ | 1143 | peer = DRBD_MAX_BIO_SIZE_P95; /* drbd 8.3.8 onwards, before 8.4.0 */ |
1144 | else | 1144 | else |
1145 | peer = DRBD_MAX_BIO_SIZE; | 1145 | peer = DRBD_MAX_BIO_SIZE; |
@@ -1190,10 +1190,10 @@ static void drbd_suspend_al(struct drbd_device *device) | |||
1190 | } | 1190 | } |
1191 | 1191 | ||
1192 | drbd_al_shrink(device); | 1192 | drbd_al_shrink(device); |
1193 | spin_lock_irq(&device->connection->req_lock); | 1193 | spin_lock_irq(&first_peer_device(device)->connection->req_lock); |
1194 | if (device->state.conn < C_CONNECTED) | 1194 | if (device->state.conn < C_CONNECTED) |
1195 | s = !test_and_set_bit(AL_SUSPENDED, &device->flags); | 1195 | s = !test_and_set_bit(AL_SUSPENDED, &device->flags); |
1196 | spin_unlock_irq(&device->connection->req_lock); | 1196 | spin_unlock_irq(&first_peer_device(device)->connection->req_lock); |
1197 | lc_unlock(device->act_log); | 1197 | lc_unlock(device->act_log); |
1198 | 1198 | ||
1199 | if (s) | 1199 | if (s) |
@@ -1264,7 +1264,7 @@ int drbd_adm_disk_opts(struct sk_buff *skb, struct genl_info *info) | |||
1264 | goto fail; | 1264 | goto fail; |
1265 | } | 1265 | } |
1266 | 1266 | ||
1267 | mutex_lock(&device->connection->conf_update); | 1267 | mutex_lock(&first_peer_device(device)->connection->conf_update); |
1268 | old_disk_conf = device->ldev->disk_conf; | 1268 | old_disk_conf = device->ldev->disk_conf; |
1269 | *new_disk_conf = *old_disk_conf; | 1269 | *new_disk_conf = *old_disk_conf; |
1270 | if (should_set_defaults(info)) | 1270 | if (should_set_defaults(info)) |
@@ -1327,7 +1327,7 @@ int drbd_adm_disk_opts(struct sk_buff *skb, struct genl_info *info) | |||
1327 | rcu_assign_pointer(device->rs_plan_s, new_plan); | 1327 | rcu_assign_pointer(device->rs_plan_s, new_plan); |
1328 | } | 1328 | } |
1329 | 1329 | ||
1330 | mutex_unlock(&device->connection->conf_update); | 1330 | mutex_unlock(&first_peer_device(device)->connection->conf_update); |
1331 | 1331 | ||
1332 | if (new_disk_conf->al_updates) | 1332 | if (new_disk_conf->al_updates) |
1333 | device->ldev->md.flags &= ~MDF_AL_DISABLED; | 1333 | device->ldev->md.flags &= ~MDF_AL_DISABLED; |
@@ -1339,7 +1339,7 @@ int drbd_adm_disk_opts(struct sk_buff *skb, struct genl_info *info) | |||
1339 | else | 1339 | else |
1340 | set_bit(MD_NO_FUA, &device->flags); | 1340 | set_bit(MD_NO_FUA, &device->flags); |
1341 | 1341 | ||
1342 | drbd_bump_write_ordering(device->connection, WO_bdev_flush); | 1342 | drbd_bump_write_ordering(first_peer_device(device)->connection, WO_bdev_flush); |
1343 | 1343 | ||
1344 | drbd_md_sync(device); | 1344 | drbd_md_sync(device); |
1345 | 1345 | ||
@@ -1353,7 +1353,7 @@ int drbd_adm_disk_opts(struct sk_buff *skb, struct genl_info *info) | |||
1353 | goto success; | 1353 | goto success; |
1354 | 1354 | ||
1355 | fail_unlock: | 1355 | fail_unlock: |
1356 | mutex_unlock(&device->connection->conf_update); | 1356 | mutex_unlock(&first_peer_device(device)->connection->conf_update); |
1357 | fail: | 1357 | fail: |
1358 | kfree(new_disk_conf); | 1358 | kfree(new_disk_conf); |
1359 | kfree(new_plan); | 1359 | kfree(new_plan); |
@@ -1388,7 +1388,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) | |||
1388 | goto finish; | 1388 | goto finish; |
1389 | 1389 | ||
1390 | device = adm_ctx.device; | 1390 | device = adm_ctx.device; |
1391 | conn_reconfig_start(device->connection); | 1391 | conn_reconfig_start(first_peer_device(device)->connection); |
1392 | 1392 | ||
1393 | /* if you want to reconfigure, please tear down first */ | 1393 | /* if you want to reconfigure, please tear down first */ |
1394 | if (device->state.disk > D_DISKLESS) { | 1394 | if (device->state.disk > D_DISKLESS) { |
@@ -1455,7 +1455,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) | |||
1455 | goto fail; | 1455 | goto fail; |
1456 | 1456 | ||
1457 | rcu_read_lock(); | 1457 | rcu_read_lock(); |
1458 | nc = rcu_dereference(device->connection->net_conf); | 1458 | nc = rcu_dereference(first_peer_device(device)->connection->net_conf); |
1459 | if (nc) { | 1459 | if (nc) { |
1460 | if (new_disk_conf->fencing == FP_STONITH && nc->wire_protocol == DRBD_PROT_A) { | 1460 | if (new_disk_conf->fencing == FP_STONITH && nc->wire_protocol == DRBD_PROT_A) { |
1461 | rcu_read_unlock(); | 1461 | rcu_read_unlock(); |
@@ -1636,7 +1636,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) | |||
1636 | new_disk_conf = NULL; | 1636 | new_disk_conf = NULL; |
1637 | new_plan = NULL; | 1637 | new_plan = NULL; |
1638 | 1638 | ||
1639 | drbd_bump_write_ordering(device->connection, WO_bdev_flush); | 1639 | drbd_bump_write_ordering(first_peer_device(device)->connection, WO_bdev_flush); |
1640 | 1640 | ||
1641 | if (drbd_md_test_flag(device->ldev, MDF_CRASHED_PRIMARY)) | 1641 | if (drbd_md_test_flag(device->ldev, MDF_CRASHED_PRIMARY)) |
1642 | set_bit(CRASHED_PRIMARY, &device->flags); | 1642 | set_bit(CRASHED_PRIMARY, &device->flags); |
@@ -1644,7 +1644,8 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) | |||
1644 | clear_bit(CRASHED_PRIMARY, &device->flags); | 1644 | clear_bit(CRASHED_PRIMARY, &device->flags); |
1645 | 1645 | ||
1646 | if (drbd_md_test_flag(device->ldev, MDF_PRIMARY_IND) && | 1646 | if (drbd_md_test_flag(device->ldev, MDF_PRIMARY_IND) && |
1647 | !(device->state.role == R_PRIMARY && device->connection->susp_nod)) | 1647 | !(device->state.role == R_PRIMARY && |
1648 | first_peer_device(device)->connection->susp_nod)) | ||
1648 | set_bit(CRASHED_PRIMARY, &device->flags); | 1649 | set_bit(CRASHED_PRIMARY, &device->flags); |
1649 | 1650 | ||
1650 | device->send_cnt = 0; | 1651 | device->send_cnt = 0; |
@@ -1702,7 +1703,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) | |||
1702 | if (_drbd_bm_total_weight(device) == drbd_bm_bits(device)) | 1703 | if (_drbd_bm_total_weight(device) == drbd_bm_bits(device)) |
1703 | drbd_suspend_al(device); /* IO is still suspended here... */ | 1704 | drbd_suspend_al(device); /* IO is still suspended here... */ |
1704 | 1705 | ||
1705 | spin_lock_irq(&device->connection->req_lock); | 1706 | spin_lock_irq(&first_peer_device(device)->connection->req_lock); |
1706 | os = drbd_read_state(device); | 1707 | os = drbd_read_state(device); |
1707 | ns = os; | 1708 | ns = os; |
1708 | /* If MDF_CONSISTENT is not set go into inconsistent state, | 1709 | /* If MDF_CONSISTENT is not set go into inconsistent state, |
@@ -1754,7 +1755,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) | |||
1754 | } | 1755 | } |
1755 | 1756 | ||
1756 | rv = _drbd_set_state(device, ns, CS_VERBOSE, NULL); | 1757 | rv = _drbd_set_state(device, ns, CS_VERBOSE, NULL); |
1757 | spin_unlock_irq(&device->connection->req_lock); | 1758 | spin_unlock_irq(&first_peer_device(device)->connection->req_lock); |
1758 | 1759 | ||
1759 | if (rv < SS_SUCCESS) | 1760 | if (rv < SS_SUCCESS) |
1760 | goto force_diskless_dec; | 1761 | goto force_diskless_dec; |
@@ -1771,7 +1772,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) | |||
1771 | 1772 | ||
1772 | kobject_uevent(&disk_to_dev(device->vdisk)->kobj, KOBJ_CHANGE); | 1773 | kobject_uevent(&disk_to_dev(device->vdisk)->kobj, KOBJ_CHANGE); |
1773 | put_ldev(device); | 1774 | put_ldev(device); |
1774 | conn_reconfig_done(device->connection); | 1775 | conn_reconfig_done(first_peer_device(device)->connection); |
1775 | drbd_adm_finish(info, retcode); | 1776 | drbd_adm_finish(info, retcode); |
1776 | return 0; | 1777 | return 0; |
1777 | 1778 | ||
@@ -1781,7 +1782,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) | |||
1781 | drbd_force_state(device, NS(disk, D_DISKLESS)); | 1782 | drbd_force_state(device, NS(disk, D_DISKLESS)); |
1782 | drbd_md_sync(device); | 1783 | drbd_md_sync(device); |
1783 | fail: | 1784 | fail: |
1784 | conn_reconfig_done(device->connection); | 1785 | conn_reconfig_done(first_peer_device(device)->connection); |
1785 | if (nbc) { | 1786 | if (nbc) { |
1786 | if (nbc->backing_bdev) | 1787 | if (nbc->backing_bdev) |
1787 | blkdev_put(nbc->backing_bdev, | 1788 | blkdev_put(nbc->backing_bdev, |
@@ -2357,7 +2358,7 @@ void resync_after_online_grow(struct drbd_device *device) | |||
2357 | if (device->state.role != device->state.peer) | 2358 | if (device->state.role != device->state.peer) |
2358 | iass = (device->state.role == R_PRIMARY); | 2359 | iass = (device->state.role == R_PRIMARY); |
2359 | else | 2360 | else |
2360 | iass = test_bit(RESOLVE_CONFLICTS, &device->connection->flags); | 2361 | iass = test_bit(RESOLVE_CONFLICTS, &first_peer_device(device)->connection->flags); |
2361 | 2362 | ||
2362 | if (iass) | 2363 | if (iass) |
2363 | drbd_start_resync(device, C_SYNC_SOURCE); | 2364 | drbd_start_resync(device, C_SYNC_SOURCE); |
@@ -2412,7 +2413,7 @@ int drbd_adm_resize(struct sk_buff *skb, struct genl_info *info) | |||
2412 | goto fail_ldev; | 2413 | goto fail_ldev; |
2413 | } | 2414 | } |
2414 | 2415 | ||
2415 | if (rs.no_resync && device->connection->agreed_pro_version < 93) { | 2416 | if (rs.no_resync && first_peer_device(device)->connection->agreed_pro_version < 93) { |
2416 | retcode = ERR_NEED_APV_93; | 2417 | retcode = ERR_NEED_APV_93; |
2417 | goto fail_ldev; | 2418 | goto fail_ldev; |
2418 | } | 2419 | } |
@@ -2454,12 +2455,12 @@ int drbd_adm_resize(struct sk_buff *skb, struct genl_info *info) | |||
2454 | device->ldev->known_size = drbd_get_capacity(device->ldev->backing_bdev); | 2455 | device->ldev->known_size = drbd_get_capacity(device->ldev->backing_bdev); |
2455 | 2456 | ||
2456 | if (new_disk_conf) { | 2457 | if (new_disk_conf) { |
2457 | mutex_lock(&device->connection->conf_update); | 2458 | mutex_lock(&first_peer_device(device)->connection->conf_update); |
2458 | old_disk_conf = device->ldev->disk_conf; | 2459 | old_disk_conf = device->ldev->disk_conf; |
2459 | *new_disk_conf = *old_disk_conf; | 2460 | *new_disk_conf = *old_disk_conf; |
2460 | new_disk_conf->disk_size = (sector_t)rs.resize_size; | 2461 | new_disk_conf->disk_size = (sector_t)rs.resize_size; |
2461 | rcu_assign_pointer(device->ldev->disk_conf, new_disk_conf); | 2462 | rcu_assign_pointer(device->ldev->disk_conf, new_disk_conf); |
2462 | mutex_unlock(&device->connection->conf_update); | 2463 | mutex_unlock(&first_peer_device(device)->connection->conf_update); |
2463 | synchronize_rcu(); | 2464 | synchronize_rcu(); |
2464 | kfree(old_disk_conf); | 2465 | kfree(old_disk_conf); |
2465 | } | 2466 | } |
@@ -2710,9 +2711,9 @@ int drbd_adm_resume_io(struct sk_buff *skb, struct genl_info *info) | |||
2710 | retcode = drbd_request_state(device, NS3(susp, 0, susp_nod, 0, susp_fen, 0)); | 2711 | retcode = drbd_request_state(device, NS3(susp, 0, susp_nod, 0, susp_fen, 0)); |
2711 | if (retcode == SS_SUCCESS) { | 2712 | if (retcode == SS_SUCCESS) { |
2712 | if (device->state.conn < C_CONNECTED) | 2713 | if (device->state.conn < C_CONNECTED) |
2713 | tl_clear(device->connection); | 2714 | tl_clear(first_peer_device(device)->connection); |
2714 | if (device->state.disk == D_DISKLESS || device->state.disk == D_FAILED) | 2715 | if (device->state.disk == D_DISKLESS || device->state.disk == D_FAILED) |
2715 | tl_restart(device->connection, FAIL_FROZEN_DISK_IO); | 2716 | tl_restart(first_peer_device(device)->connection, FAIL_FROZEN_DISK_IO); |
2716 | } | 2717 | } |
2717 | drbd_resume_io(device); | 2718 | drbd_resume_io(device); |
2718 | 2719 | ||
@@ -2778,10 +2779,10 @@ static int nla_put_status_info(struct sk_buff *skb, struct drbd_device *device, | |||
2778 | 2779 | ||
2779 | /* We need to add connection name and volume number information still. | 2780 | /* We need to add connection name and volume number information still. |
2780 | * Minor number is in drbd_genlmsghdr. */ | 2781 | * Minor number is in drbd_genlmsghdr. */ |
2781 | if (nla_put_drbd_cfg_context(skb, device->connection, device->vnr)) | 2782 | if (nla_put_drbd_cfg_context(skb, first_peer_device(device)->connection, device->vnr)) |
2782 | goto nla_put_failure; | 2783 | goto nla_put_failure; |
2783 | 2784 | ||
2784 | if (res_opts_to_skb(skb, &device->connection->res_opts, exclude_sensitive)) | 2785 | if (res_opts_to_skb(skb, &first_peer_device(device)->connection->res_opts, exclude_sensitive)) |
2785 | goto nla_put_failure; | 2786 | goto nla_put_failure; |
2786 | 2787 | ||
2787 | rcu_read_lock(); | 2788 | rcu_read_lock(); |
@@ -2794,7 +2795,7 @@ static int nla_put_status_info(struct sk_buff *skb, struct drbd_device *device, | |||
2794 | if (!err) { | 2795 | if (!err) { |
2795 | struct net_conf *nc; | 2796 | struct net_conf *nc; |
2796 | 2797 | ||
2797 | nc = rcu_dereference(device->connection->net_conf); | 2798 | nc = rcu_dereference(first_peer_device(device)->connection->net_conf); |
2798 | if (nc) | 2799 | if (nc) |
2799 | err = net_conf_to_skb(skb, nc, exclude_sensitive); | 2800 | err = net_conf_to_skb(skb, nc, exclude_sensitive); |
2800 | } | 2801 | } |
@@ -2981,7 +2982,7 @@ next_connection: | |||
2981 | } | 2982 | } |
2982 | 2983 | ||
2983 | D_ASSERT(device->vnr == volume); | 2984 | D_ASSERT(device->vnr == volume); |
2984 | D_ASSERT(device->connection == connection); | 2985 | D_ASSERT(first_peer_device(device)->connection == connection); |
2985 | 2986 | ||
2986 | dh->minor = device_to_minor(device); | 2987 | dh->minor = device_to_minor(device); |
2987 | dh->ret_code = NO_ERROR; | 2988 | dh->ret_code = NO_ERROR; |
@@ -3168,7 +3169,8 @@ int drbd_adm_new_c_uuid(struct sk_buff *skb, struct genl_info *info) | |||
3168 | } | 3169 | } |
3169 | 3170 | ||
3170 | /* this is "skip initial sync", assume to be clean */ | 3171 | /* this is "skip initial sync", assume to be clean */ |
3171 | if (device->state.conn == C_CONNECTED && device->connection->agreed_pro_version >= 90 && | 3172 | if (device->state.conn == C_CONNECTED && |
3173 | first_peer_device(device)->connection->agreed_pro_version >= 90 && | ||
3172 | device->ldev->md.uuid[UI_CURRENT] == UUID_JUST_CREATED && args.clear_bm) { | 3174 | device->ldev->md.uuid[UI_CURRENT] == UUID_JUST_CREATED && args.clear_bm) { |
3173 | dev_info(DEV, "Preparing to skip initial sync\n"); | 3175 | dev_info(DEV, "Preparing to skip initial sync\n"); |
3174 | skip_initial_sync = 1; | 3176 | skip_initial_sync = 1; |
@@ -3191,10 +3193,10 @@ int drbd_adm_new_c_uuid(struct sk_buff *skb, struct genl_info *info) | |||
3191 | drbd_send_uuids_skip_initial_sync(device); | 3193 | drbd_send_uuids_skip_initial_sync(device); |
3192 | _drbd_uuid_set(device, UI_BITMAP, 0); | 3194 | _drbd_uuid_set(device, UI_BITMAP, 0); |
3193 | drbd_print_uuids(device, "cleared bitmap UUID"); | 3195 | drbd_print_uuids(device, "cleared bitmap UUID"); |
3194 | spin_lock_irq(&device->connection->req_lock); | 3196 | spin_lock_irq(&first_peer_device(device)->connection->req_lock); |
3195 | _drbd_set_state(_NS2(device, disk, D_UP_TO_DATE, pdsk, D_UP_TO_DATE), | 3197 | _drbd_set_state(_NS2(device, disk, D_UP_TO_DATE, pdsk, D_UP_TO_DATE), |
3196 | CS_VERBOSE, NULL); | 3198 | CS_VERBOSE, NULL); |
3197 | spin_unlock_irq(&device->connection->req_lock); | 3199 | spin_unlock_irq(&first_peer_device(device)->connection->req_lock); |
3198 | } | 3200 | } |
3199 | } | 3201 | } |
3200 | 3202 | ||
@@ -3287,7 +3289,7 @@ int drbd_adm_add_minor(struct sk_buff *skb, struct genl_info *info) | |||
3287 | } | 3289 | } |
3288 | 3290 | ||
3289 | /* drbd_adm_prepare made sure already | 3291 | /* drbd_adm_prepare made sure already |
3290 | * that device->connection and device->vnr match the request. */ | 3292 | * that first_peer_device(device)->connection and device->vnr match the request. */ |
3291 | if (adm_ctx.device) { | 3293 | if (adm_ctx.device) { |
3292 | if (info->nlhdr->nlmsg_flags & NLM_F_EXCL) | 3294 | if (info->nlhdr->nlmsg_flags & NLM_F_EXCL) |
3293 | retcode = ERR_MINOR_EXISTS; | 3295 | retcode = ERR_MINOR_EXISTS; |
@@ -3295,7 +3297,7 @@ int drbd_adm_add_minor(struct sk_buff *skb, struct genl_info *info) | |||
3295 | goto out; | 3297 | goto out; |
3296 | } | 3298 | } |
3297 | 3299 | ||
3298 | retcode = conn_new_minor(adm_ctx.connection, dh->minor, adm_ctx.volume); | 3300 | retcode = drbd_create_minor(adm_ctx.connection, dh->minor, adm_ctx.volume); |
3299 | out: | 3301 | out: |
3300 | drbd_adm_finish(info, retcode); | 3302 | drbd_adm_finish(info, retcode); |
3301 | return 0; | 3303 | return 0; |
@@ -3310,7 +3312,7 @@ static enum drbd_ret_code adm_delete_minor(struct drbd_device *device) | |||
3310 | device->state.role == R_SECONDARY) { | 3312 | device->state.role == R_SECONDARY) { |
3311 | _drbd_request_state(device, NS(conn, C_WF_REPORT_PARAMS), | 3313 | _drbd_request_state(device, NS(conn, C_WF_REPORT_PARAMS), |
3312 | CS_VERBOSE + CS_WAIT_COMPLETE); | 3314 | CS_VERBOSE + CS_WAIT_COMPLETE); |
3313 | idr_remove(&device->connection->volumes, device->vnr); | 3315 | idr_remove(&first_peer_device(device)->connection->volumes, device->vnr); |
3314 | idr_remove(&minors, device_to_minor(device)); | 3316 | idr_remove(&minors, device_to_minor(device)); |
3315 | destroy_workqueue(device->submit.wq); | 3317 | destroy_workqueue(device->submit.wq); |
3316 | del_gendisk(device->vdisk); | 3318 | del_gendisk(device->vdisk); |