diff options
-rw-r--r-- | drivers/block/drbd/drbd_int.h | 7 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 28 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_nl.c | 28 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_proc.c | 4 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 124 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_req.c | 22 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_worker.c | 8 |
7 files changed, 110 insertions, 111 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index 1f486f001dfd..4c4c276e0eb8 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -977,7 +977,6 @@ struct drbd_conf { | |||
977 | unsigned long flags; | 977 | unsigned long flags; |
978 | 978 | ||
979 | /* configured by drbdsetup */ | 979 | /* configured by drbdsetup */ |
980 | struct net_conf *net_conf; /* protected by get_net_conf() and put_net_conf() */ | ||
981 | struct syncer_conf sync_conf; | 980 | struct syncer_conf sync_conf; |
982 | struct drbd_backing_dev *ldev __protected_by(local); | 981 | struct drbd_backing_dev *ldev __protected_by(local); |
983 | 982 | ||
@@ -2134,10 +2133,10 @@ static inline void put_net_conf(struct drbd_conf *mdev) | |||
2134 | } | 2133 | } |
2135 | 2134 | ||
2136 | /** | 2135 | /** |
2137 | * get_net_conf() - Increase ref count on mdev->net_conf; Returns 0 if nothing there | 2136 | * get_net_conf() - Increase ref count on mdev->tconn->net_conf; Returns 0 if nothing there |
2138 | * @mdev: DRBD device. | 2137 | * @mdev: DRBD device. |
2139 | * | 2138 | * |
2140 | * You have to call put_net_conf() when finished working with mdev->net_conf. | 2139 | * You have to call put_net_conf() when finished working with mdev->tconn->net_conf. |
2141 | */ | 2140 | */ |
2142 | static inline int get_net_conf(struct drbd_conf *mdev) | 2141 | static inline int get_net_conf(struct drbd_conf *mdev) |
2143 | { | 2142 | { |
@@ -2253,7 +2252,7 @@ static inline int drbd_get_max_buffers(struct drbd_conf *mdev) | |||
2253 | { | 2252 | { |
2254 | int mxb = 1000000; /* arbitrary limit on open requests */ | 2253 | int mxb = 1000000; /* arbitrary limit on open requests */ |
2255 | if (get_net_conf(mdev)) { | 2254 | if (get_net_conf(mdev)) { |
2256 | mxb = mdev->net_conf->max_buffers; | 2255 | mxb = mdev->tconn->net_conf->max_buffers; |
2257 | put_net_conf(mdev); | 2256 | put_net_conf(mdev); |
2258 | } | 2257 | } |
2259 | return mxb; | 2258 | return mxb; |
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index a6ac0c81406b..7e88a49d3448 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -693,7 +693,7 @@ is_valid_state(struct drbd_conf *mdev, union drbd_state ns) | |||
693 | } | 693 | } |
694 | 694 | ||
695 | if (get_net_conf(mdev)) { | 695 | if (get_net_conf(mdev)) { |
696 | if (!mdev->net_conf->two_primaries && | 696 | if (!mdev->tconn->net_conf->two_primaries && |
697 | ns.role == R_PRIMARY && ns.peer == R_PRIMARY) | 697 | ns.role == R_PRIMARY && ns.peer == R_PRIMARY) |
698 | rv = SS_TWO_PRIMARIES; | 698 | rv = SS_TWO_PRIMARIES; |
699 | put_net_conf(mdev); | 699 | put_net_conf(mdev); |
@@ -1952,7 +1952,7 @@ int drbd_send_protocol(struct drbd_conf *mdev) | |||
1952 | size = sizeof(struct p_protocol); | 1952 | size = sizeof(struct p_protocol); |
1953 | 1953 | ||
1954 | if (mdev->agreed_pro_version >= 87) | 1954 | if (mdev->agreed_pro_version >= 87) |
1955 | size += strlen(mdev->net_conf->integrity_alg) + 1; | 1955 | size += strlen(mdev->tconn->net_conf->integrity_alg) + 1; |
1956 | 1956 | ||
1957 | /* we must not recurse into our own queue, | 1957 | /* we must not recurse into our own queue, |
1958 | * as that is blocked during handshake */ | 1958 | * as that is blocked during handshake */ |
@@ -1960,16 +1960,16 @@ int drbd_send_protocol(struct drbd_conf *mdev) | |||
1960 | if (p == NULL) | 1960 | if (p == NULL) |
1961 | return 0; | 1961 | return 0; |
1962 | 1962 | ||
1963 | p->protocol = cpu_to_be32(mdev->net_conf->wire_protocol); | 1963 | p->protocol = cpu_to_be32(mdev->tconn->net_conf->wire_protocol); |
1964 | p->after_sb_0p = cpu_to_be32(mdev->net_conf->after_sb_0p); | 1964 | p->after_sb_0p = cpu_to_be32(mdev->tconn->net_conf->after_sb_0p); |
1965 | p->after_sb_1p = cpu_to_be32(mdev->net_conf->after_sb_1p); | 1965 | p->after_sb_1p = cpu_to_be32(mdev->tconn->net_conf->after_sb_1p); |
1966 | p->after_sb_2p = cpu_to_be32(mdev->net_conf->after_sb_2p); | 1966 | p->after_sb_2p = cpu_to_be32(mdev->tconn->net_conf->after_sb_2p); |
1967 | p->two_primaries = cpu_to_be32(mdev->net_conf->two_primaries); | 1967 | p->two_primaries = cpu_to_be32(mdev->tconn->net_conf->two_primaries); |
1968 | 1968 | ||
1969 | cf = 0; | 1969 | cf = 0; |
1970 | if (mdev->net_conf->want_lose) | 1970 | if (mdev->tconn->net_conf->want_lose) |
1971 | cf |= CF_WANT_LOSE; | 1971 | cf |= CF_WANT_LOSE; |
1972 | if (mdev->net_conf->dry_run) { | 1972 | if (mdev->tconn->net_conf->dry_run) { |
1973 | if (mdev->agreed_pro_version >= 92) | 1973 | if (mdev->agreed_pro_version >= 92) |
1974 | cf |= CF_DRY_RUN; | 1974 | cf |= CF_DRY_RUN; |
1975 | else { | 1975 | else { |
@@ -1981,7 +1981,7 @@ int drbd_send_protocol(struct drbd_conf *mdev) | |||
1981 | p->conn_flags = cpu_to_be32(cf); | 1981 | p->conn_flags = cpu_to_be32(cf); |
1982 | 1982 | ||
1983 | if (mdev->agreed_pro_version >= 87) | 1983 | if (mdev->agreed_pro_version >= 87) |
1984 | strcpy(p->integrity_alg, mdev->net_conf->integrity_alg); | 1984 | strcpy(p->integrity_alg, mdev->tconn->net_conf->integrity_alg); |
1985 | 1985 | ||
1986 | rv = drbd_send_cmd(mdev, USE_DATA_SOCKET, P_PROTOCOL, | 1986 | rv = drbd_send_cmd(mdev, USE_DATA_SOCKET, P_PROTOCOL, |
1987 | (struct p_header80 *)p, size); | 1987 | (struct p_header80 *)p, size); |
@@ -2002,7 +2002,7 @@ int _drbd_send_uuids(struct drbd_conf *mdev, u64 uuid_flags) | |||
2002 | 2002 | ||
2003 | mdev->comm_bm_set = drbd_bm_total_weight(mdev); | 2003 | mdev->comm_bm_set = drbd_bm_total_weight(mdev); |
2004 | p.uuid[UI_SIZE] = cpu_to_be64(mdev->comm_bm_set); | 2004 | p.uuid[UI_SIZE] = cpu_to_be64(mdev->comm_bm_set); |
2005 | uuid_flags |= mdev->net_conf->want_lose ? 1 : 0; | 2005 | uuid_flags |= mdev->tconn->net_conf->want_lose ? 1 : 0; |
2006 | uuid_flags |= test_bit(CRASHED_PRIMARY, &mdev->flags) ? 2 : 0; | 2006 | uuid_flags |= test_bit(CRASHED_PRIMARY, &mdev->flags) ? 2 : 0; |
2007 | uuid_flags |= mdev->new_state_tmp.disk == D_INCONSISTENT ? 4 : 0; | 2007 | uuid_flags |= mdev->new_state_tmp.disk == D_INCONSISTENT ? 4 : 0; |
2008 | p.uuid[UI_FLAGS] = cpu_to_be64(uuid_flags); | 2008 | p.uuid[UI_FLAGS] = cpu_to_be64(uuid_flags); |
@@ -2717,7 +2717,7 @@ int drbd_send_dblock(struct drbd_conf *mdev, struct drbd_request *req) | |||
2717 | * out ok after sending on this side, but does not fit on the | 2717 | * out ok after sending on this side, but does not fit on the |
2718 | * receiving side, we sure have detected corruption elsewhere. | 2718 | * receiving side, we sure have detected corruption elsewhere. |
2719 | */ | 2719 | */ |
2720 | if (mdev->net_conf->wire_protocol == DRBD_PROT_A || dgs) | 2720 | if (mdev->tconn->net_conf->wire_protocol == DRBD_PROT_A || dgs) |
2721 | ok = _drbd_send_bio(mdev, req->master_bio); | 2721 | ok = _drbd_send_bio(mdev, req->master_bio); |
2722 | else | 2722 | else |
2723 | ok = _drbd_send_zc_bio(mdev, req->master_bio); | 2723 | ok = _drbd_send_zc_bio(mdev, req->master_bio); |
@@ -2843,7 +2843,7 @@ int drbd_send(struct drbd_conf *mdev, struct socket *sock, | |||
2843 | msg.msg_flags = msg_flags | MSG_NOSIGNAL; | 2843 | msg.msg_flags = msg_flags | MSG_NOSIGNAL; |
2844 | 2844 | ||
2845 | if (sock == mdev->data.socket) { | 2845 | if (sock == mdev->data.socket) { |
2846 | mdev->ko_count = mdev->net_conf->ko_count; | 2846 | mdev->ko_count = mdev->tconn->net_conf->ko_count; |
2847 | drbd_update_congested(mdev); | 2847 | drbd_update_congested(mdev); |
2848 | } | 2848 | } |
2849 | do { | 2849 | do { |
@@ -3073,7 +3073,7 @@ void drbd_mdev_cleanup(struct drbd_conf *mdev) | |||
3073 | mdev->rs_mark_left[i] = 0; | 3073 | mdev->rs_mark_left[i] = 0; |
3074 | mdev->rs_mark_time[i] = 0; | 3074 | mdev->rs_mark_time[i] = 0; |
3075 | } | 3075 | } |
3076 | D_ASSERT(mdev->net_conf == NULL); | 3076 | D_ASSERT(mdev->tconn->net_conf == NULL); |
3077 | 3077 | ||
3078 | drbd_set_my_capacity(mdev, 0); | 3078 | drbd_set_my_capacity(mdev, 0); |
3079 | if (mdev->bitmap) { | 3079 | if (mdev->bitmap) { |
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index 51da84940a33..d816c61cd983 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c | |||
@@ -150,21 +150,21 @@ int drbd_khelper(struct drbd_conf *mdev, char *cmd) | |||
150 | snprintf(mb, 12, "minor-%d", mdev_to_minor(mdev)); | 150 | snprintf(mb, 12, "minor-%d", mdev_to_minor(mdev)); |
151 | 151 | ||
152 | if (get_net_conf(mdev)) { | 152 | if (get_net_conf(mdev)) { |
153 | switch (((struct sockaddr *)mdev->net_conf->peer_addr)->sa_family) { | 153 | switch (((struct sockaddr *)mdev->tconn->net_conf->peer_addr)->sa_family) { |
154 | case AF_INET6: | 154 | case AF_INET6: |
155 | afs = "ipv6"; | 155 | afs = "ipv6"; |
156 | snprintf(ad, 60, "DRBD_PEER_ADDRESS=%pI6", | 156 | snprintf(ad, 60, "DRBD_PEER_ADDRESS=%pI6", |
157 | &((struct sockaddr_in6 *)mdev->net_conf->peer_addr)->sin6_addr); | 157 | &((struct sockaddr_in6 *)mdev->tconn->net_conf->peer_addr)->sin6_addr); |
158 | break; | 158 | break; |
159 | case AF_INET: | 159 | case AF_INET: |
160 | afs = "ipv4"; | 160 | afs = "ipv4"; |
161 | snprintf(ad, 60, "DRBD_PEER_ADDRESS=%pI4", | 161 | snprintf(ad, 60, "DRBD_PEER_ADDRESS=%pI4", |
162 | &((struct sockaddr_in *)mdev->net_conf->peer_addr)->sin_addr); | 162 | &((struct sockaddr_in *)mdev->tconn->net_conf->peer_addr)->sin_addr); |
163 | break; | 163 | break; |
164 | default: | 164 | default: |
165 | afs = "ssocks"; | 165 | afs = "ssocks"; |
166 | snprintf(ad, 60, "DRBD_PEER_ADDRESS=%pI4", | 166 | snprintf(ad, 60, "DRBD_PEER_ADDRESS=%pI4", |
167 | &((struct sockaddr_in *)mdev->net_conf->peer_addr)->sin_addr); | 167 | &((struct sockaddr_in *)mdev->tconn->net_conf->peer_addr)->sin_addr); |
168 | } | 168 | } |
169 | snprintf(af, 20, "DRBD_PEER_AF=%s", afs); | 169 | snprintf(af, 20, "DRBD_PEER_AF=%s", afs); |
170 | envp[3]=af; | 170 | envp[3]=af; |
@@ -379,7 +379,7 @@ drbd_set_role(struct drbd_conf *mdev, enum drbd_role new_role, int force) | |||
379 | if (rv == SS_TWO_PRIMARIES) { | 379 | if (rv == SS_TWO_PRIMARIES) { |
380 | /* Maybe the peer is detected as dead very soon... | 380 | /* Maybe the peer is detected as dead very soon... |
381 | retry at most once more in this case. */ | 381 | retry at most once more in this case. */ |
382 | schedule_timeout_interruptible((mdev->net_conf->ping_timeo+1)*HZ/10); | 382 | schedule_timeout_interruptible((mdev->tconn->net_conf->ping_timeo+1)*HZ/10); |
383 | if (try < max_tries) | 383 | if (try < max_tries) |
384 | try = max_tries - 1; | 384 | try = max_tries - 1; |
385 | continue; | 385 | continue; |
@@ -410,7 +410,7 @@ drbd_set_role(struct drbd_conf *mdev, enum drbd_role new_role, int force) | |||
410 | } | 410 | } |
411 | } else { | 411 | } else { |
412 | if (get_net_conf(mdev)) { | 412 | if (get_net_conf(mdev)) { |
413 | mdev->net_conf->want_lose = 0; | 413 | mdev->tconn->net_conf->want_lose = 0; |
414 | put_net_conf(mdev); | 414 | put_net_conf(mdev); |
415 | } | 415 | } |
416 | set_disk_ro(mdev->vdisk, false); | 416 | set_disk_ro(mdev->vdisk, false); |
@@ -972,7 +972,7 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp | |||
972 | } | 972 | } |
973 | 973 | ||
974 | if (get_net_conf(mdev)) { | 974 | if (get_net_conf(mdev)) { |
975 | int prot = mdev->net_conf->wire_protocol; | 975 | int prot = mdev->tconn->net_conf->wire_protocol; |
976 | put_net_conf(mdev); | 976 | put_net_conf(mdev); |
977 | if (nbc->dc.fencing == FP_STONITH && prot == DRBD_PROT_A) { | 977 | if (nbc->dc.fencing == FP_STONITH && prot == DRBD_PROT_A) { |
978 | retcode = ERR_STONITH_AND_PROT_A; | 978 | retcode = ERR_STONITH_AND_PROT_A; |
@@ -1439,13 +1439,13 @@ static int drbd_nl_net_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp, | |||
1439 | if (!odev || odev == mdev) | 1439 | if (!odev || odev == mdev) |
1440 | continue; | 1440 | continue; |
1441 | if (get_net_conf(odev)) { | 1441 | if (get_net_conf(odev)) { |
1442 | taken_addr = (struct sockaddr *)&odev->net_conf->my_addr; | 1442 | taken_addr = (struct sockaddr *)&odev->tconn->net_conf->my_addr; |
1443 | if (new_conf->my_addr_len == odev->net_conf->my_addr_len && | 1443 | if (new_conf->my_addr_len == odev->tconn->net_conf->my_addr_len && |
1444 | !memcmp(new_my_addr, taken_addr, new_conf->my_addr_len)) | 1444 | !memcmp(new_my_addr, taken_addr, new_conf->my_addr_len)) |
1445 | retcode = ERR_LOCAL_ADDR; | 1445 | retcode = ERR_LOCAL_ADDR; |
1446 | 1446 | ||
1447 | taken_addr = (struct sockaddr *)&odev->net_conf->peer_addr; | 1447 | taken_addr = (struct sockaddr *)&odev->tconn->net_conf->peer_addr; |
1448 | if (new_conf->peer_addr_len == odev->net_conf->peer_addr_len && | 1448 | if (new_conf->peer_addr_len == odev->tconn->net_conf->peer_addr_len && |
1449 | !memcmp(new_peer_addr, taken_addr, new_conf->peer_addr_len)) | 1449 | !memcmp(new_peer_addr, taken_addr, new_conf->peer_addr_len)) |
1450 | retcode = ERR_PEER_ADDR; | 1450 | retcode = ERR_PEER_ADDR; |
1451 | 1451 | ||
@@ -1522,12 +1522,12 @@ static int drbd_nl_net_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp, | |||
1522 | 1522 | ||
1523 | drbd_flush_workqueue(mdev); | 1523 | drbd_flush_workqueue(mdev); |
1524 | spin_lock_irq(&mdev->req_lock); | 1524 | spin_lock_irq(&mdev->req_lock); |
1525 | if (mdev->net_conf != NULL) { | 1525 | if (mdev->tconn->net_conf != NULL) { |
1526 | retcode = ERR_NET_CONFIGURED; | 1526 | retcode = ERR_NET_CONFIGURED; |
1527 | spin_unlock_irq(&mdev->req_lock); | 1527 | spin_unlock_irq(&mdev->req_lock); |
1528 | goto fail; | 1528 | goto fail; |
1529 | } | 1529 | } |
1530 | mdev->net_conf = new_conf; | 1530 | mdev->tconn->net_conf = new_conf; |
1531 | 1531 | ||
1532 | mdev->send_cnt = 0; | 1532 | mdev->send_cnt = 0; |
1533 | mdev->recv_cnt = 0; | 1533 | mdev->recv_cnt = 0; |
@@ -2051,7 +2051,7 @@ static int drbd_nl_get_config(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nl | |||
2051 | } | 2051 | } |
2052 | 2052 | ||
2053 | if (get_net_conf(mdev)) { | 2053 | if (get_net_conf(mdev)) { |
2054 | tl = net_conf_to_tags(mdev, mdev->net_conf, tl); | 2054 | tl = net_conf_to_tags(mdev, mdev->tconn->net_conf, tl); |
2055 | put_net_conf(mdev); | 2055 | put_net_conf(mdev); |
2056 | } | 2056 | } |
2057 | tl = syncer_conf_to_tags(mdev, &mdev->sync_conf, tl); | 2057 | tl = syncer_conf_to_tags(mdev, &mdev->sync_conf, tl); |
diff --git a/drivers/block/drbd/drbd_proc.c b/drivers/block/drbd/drbd_proc.c index 2959cdfb77f5..4e53cb3d99e7 100644 --- a/drivers/block/drbd/drbd_proc.c +++ b/drivers/block/drbd/drbd_proc.c | |||
@@ -254,8 +254,8 @@ static int drbd_seq_show(struct seq_file *seq, void *v) | |||
254 | drbd_role_str(mdev->state.peer), | 254 | drbd_role_str(mdev->state.peer), |
255 | drbd_disk_str(mdev->state.disk), | 255 | drbd_disk_str(mdev->state.disk), |
256 | drbd_disk_str(mdev->state.pdsk), | 256 | drbd_disk_str(mdev->state.pdsk), |
257 | (mdev->net_conf == NULL ? ' ' : | 257 | (mdev->tconn->net_conf == NULL ? ' ' : |
258 | (mdev->net_conf->wire_protocol - DRBD_PROT_A+'A')), | 258 | (mdev->tconn->net_conf->wire_protocol - DRBD_PROT_A+'A')), |
259 | is_susp(mdev->state) ? 's' : 'r', | 259 | is_susp(mdev->state) ? 's' : 'r', |
260 | mdev->state.aftr_isp ? 'a' : '-', | 260 | mdev->state.aftr_isp ? 'a' : '-', |
261 | mdev->state.peer_isp ? 'p' : '-', | 261 | mdev->state.peer_isp ? 'p' : '-', |
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index a41b07820ddf..e5e7dd1c6dd8 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -237,7 +237,7 @@ static struct page *drbd_pp_alloc(struct drbd_conf *mdev, unsigned number, bool | |||
237 | 237 | ||
238 | /* Yes, we may run up to @number over max_buffers. If we | 238 | /* Yes, we may run up to @number over max_buffers. If we |
239 | * follow it strictly, the admin will get it wrong anyways. */ | 239 | * follow it strictly, the admin will get it wrong anyways. */ |
240 | if (atomic_read(&mdev->pp_in_use) < mdev->net_conf->max_buffers) | 240 | if (atomic_read(&mdev->pp_in_use) < mdev->tconn->net_conf->max_buffers) |
241 | page = drbd_pp_first_pages_or_try_alloc(mdev, number); | 241 | page = drbd_pp_first_pages_or_try_alloc(mdev, number); |
242 | 242 | ||
243 | while (page == NULL) { | 243 | while (page == NULL) { |
@@ -245,7 +245,7 @@ static struct page *drbd_pp_alloc(struct drbd_conf *mdev, unsigned number, bool | |||
245 | 245 | ||
246 | drbd_kick_lo_and_reclaim_net(mdev); | 246 | drbd_kick_lo_and_reclaim_net(mdev); |
247 | 247 | ||
248 | if (atomic_read(&mdev->pp_in_use) < mdev->net_conf->max_buffers) { | 248 | if (atomic_read(&mdev->pp_in_use) < mdev->tconn->net_conf->max_buffers) { |
249 | page = drbd_pp_first_pages_or_try_alloc(mdev, number); | 249 | page = drbd_pp_first_pages_or_try_alloc(mdev, number); |
250 | if (page) | 250 | if (page) |
251 | break; | 251 | break; |
@@ -582,7 +582,7 @@ static struct socket *drbd_try_connect(struct drbd_conf *mdev) | |||
582 | return NULL; | 582 | return NULL; |
583 | 583 | ||
584 | what = "sock_create_kern"; | 584 | what = "sock_create_kern"; |
585 | err = sock_create_kern(((struct sockaddr *)mdev->net_conf->my_addr)->sa_family, | 585 | err = sock_create_kern(((struct sockaddr *)mdev->tconn->net_conf->my_addr)->sa_family, |
586 | SOCK_STREAM, IPPROTO_TCP, &sock); | 586 | SOCK_STREAM, IPPROTO_TCP, &sock); |
587 | if (err < 0) { | 587 | if (err < 0) { |
588 | sock = NULL; | 588 | sock = NULL; |
@@ -590,9 +590,9 @@ static struct socket *drbd_try_connect(struct drbd_conf *mdev) | |||
590 | } | 590 | } |
591 | 591 | ||
592 | sock->sk->sk_rcvtimeo = | 592 | sock->sk->sk_rcvtimeo = |
593 | sock->sk->sk_sndtimeo = mdev->net_conf->try_connect_int*HZ; | 593 | sock->sk->sk_sndtimeo = mdev->tconn->net_conf->try_connect_int*HZ; |
594 | drbd_setbufsize(sock, mdev->net_conf->sndbuf_size, | 594 | drbd_setbufsize(sock, mdev->tconn->net_conf->sndbuf_size, |
595 | mdev->net_conf->rcvbuf_size); | 595 | mdev->tconn->net_conf->rcvbuf_size); |
596 | 596 | ||
597 | /* explicitly bind to the configured IP as source IP | 597 | /* explicitly bind to the configured IP as source IP |
598 | * for the outgoing connections. | 598 | * for the outgoing connections. |
@@ -601,9 +601,9 @@ static struct socket *drbd_try_connect(struct drbd_conf *mdev) | |||
601 | * Make sure to use 0 as port number, so linux selects | 601 | * Make sure to use 0 as port number, so linux selects |
602 | * a free one dynamically. | 602 | * a free one dynamically. |
603 | */ | 603 | */ |
604 | memcpy(&src_in6, mdev->net_conf->my_addr, | 604 | memcpy(&src_in6, mdev->tconn->net_conf->my_addr, |
605 | min_t(int, mdev->net_conf->my_addr_len, sizeof(src_in6))); | 605 | min_t(int, mdev->tconn->net_conf->my_addr_len, sizeof(src_in6))); |
606 | if (((struct sockaddr *)mdev->net_conf->my_addr)->sa_family == AF_INET6) | 606 | if (((struct sockaddr *)mdev->tconn->net_conf->my_addr)->sa_family == AF_INET6) |
607 | src_in6.sin6_port = 0; | 607 | src_in6.sin6_port = 0; |
608 | else | 608 | else |
609 | ((struct sockaddr_in *)&src_in6)->sin_port = 0; /* AF_INET & AF_SCI */ | 609 | ((struct sockaddr_in *)&src_in6)->sin_port = 0; /* AF_INET & AF_SCI */ |
@@ -611,7 +611,7 @@ static struct socket *drbd_try_connect(struct drbd_conf *mdev) | |||
611 | what = "bind before connect"; | 611 | what = "bind before connect"; |
612 | err = sock->ops->bind(sock, | 612 | err = sock->ops->bind(sock, |
613 | (struct sockaddr *) &src_in6, | 613 | (struct sockaddr *) &src_in6, |
614 | mdev->net_conf->my_addr_len); | 614 | mdev->tconn->net_conf->my_addr_len); |
615 | if (err < 0) | 615 | if (err < 0) |
616 | goto out; | 616 | goto out; |
617 | 617 | ||
@@ -620,8 +620,8 @@ static struct socket *drbd_try_connect(struct drbd_conf *mdev) | |||
620 | disconnect_on_error = 0; | 620 | disconnect_on_error = 0; |
621 | what = "connect"; | 621 | what = "connect"; |
622 | err = sock->ops->connect(sock, | 622 | err = sock->ops->connect(sock, |
623 | (struct sockaddr *)mdev->net_conf->peer_addr, | 623 | (struct sockaddr *)mdev->tconn->net_conf->peer_addr, |
624 | mdev->net_conf->peer_addr_len, 0); | 624 | mdev->tconn->net_conf->peer_addr_len, 0); |
625 | 625 | ||
626 | out: | 626 | out: |
627 | if (err < 0) { | 627 | if (err < 0) { |
@@ -658,26 +658,26 @@ static struct socket *drbd_wait_for_connect(struct drbd_conf *mdev) | |||
658 | return NULL; | 658 | return NULL; |
659 | 659 | ||
660 | what = "sock_create_kern"; | 660 | what = "sock_create_kern"; |
661 | err = sock_create_kern(((struct sockaddr *)mdev->net_conf->my_addr)->sa_family, | 661 | err = sock_create_kern(((struct sockaddr *)mdev->tconn->net_conf->my_addr)->sa_family, |
662 | SOCK_STREAM, IPPROTO_TCP, &s_listen); | 662 | SOCK_STREAM, IPPROTO_TCP, &s_listen); |
663 | if (err) { | 663 | if (err) { |
664 | s_listen = NULL; | 664 | s_listen = NULL; |
665 | goto out; | 665 | goto out; |
666 | } | 666 | } |
667 | 667 | ||
668 | timeo = mdev->net_conf->try_connect_int * HZ; | 668 | timeo = mdev->tconn->net_conf->try_connect_int * HZ; |
669 | timeo += (random32() & 1) ? timeo / 7 : -timeo / 7; /* 28.5% random jitter */ | 669 | timeo += (random32() & 1) ? timeo / 7 : -timeo / 7; /* 28.5% random jitter */ |
670 | 670 | ||
671 | s_listen->sk->sk_reuse = 1; /* SO_REUSEADDR */ | 671 | s_listen->sk->sk_reuse = 1; /* SO_REUSEADDR */ |
672 | s_listen->sk->sk_rcvtimeo = timeo; | 672 | s_listen->sk->sk_rcvtimeo = timeo; |
673 | s_listen->sk->sk_sndtimeo = timeo; | 673 | s_listen->sk->sk_sndtimeo = timeo; |
674 | drbd_setbufsize(s_listen, mdev->net_conf->sndbuf_size, | 674 | drbd_setbufsize(s_listen, mdev->tconn->net_conf->sndbuf_size, |
675 | mdev->net_conf->rcvbuf_size); | 675 | mdev->tconn->net_conf->rcvbuf_size); |
676 | 676 | ||
677 | what = "bind before listen"; | 677 | what = "bind before listen"; |
678 | err = s_listen->ops->bind(s_listen, | 678 | err = s_listen->ops->bind(s_listen, |
679 | (struct sockaddr *) mdev->net_conf->my_addr, | 679 | (struct sockaddr *) mdev->tconn->net_conf->my_addr, |
680 | mdev->net_conf->my_addr_len); | 680 | mdev->tconn->net_conf->my_addr_len); |
681 | if (err < 0) | 681 | if (err < 0) |
682 | goto out; | 682 | goto out; |
683 | 683 | ||
@@ -791,7 +791,7 @@ static int drbd_connect(struct drbd_conf *mdev) | |||
791 | } | 791 | } |
792 | 792 | ||
793 | if (sock && msock) { | 793 | if (sock && msock) { |
794 | schedule_timeout_interruptible(mdev->net_conf->ping_timeo*HZ/10); | 794 | schedule_timeout_interruptible(mdev->tconn->net_conf->ping_timeo*HZ/10); |
795 | ok = drbd_socket_okay(mdev, &sock); | 795 | ok = drbd_socket_okay(mdev, &sock); |
796 | ok = drbd_socket_okay(mdev, &msock) && ok; | 796 | ok = drbd_socket_okay(mdev, &msock) && ok; |
797 | if (ok) | 797 | if (ok) |
@@ -855,15 +855,15 @@ retry: | |||
855 | msock->sk->sk_priority = TC_PRIO_INTERACTIVE; | 855 | msock->sk->sk_priority = TC_PRIO_INTERACTIVE; |
856 | 856 | ||
857 | /* NOT YET ... | 857 | /* NOT YET ... |
858 | * sock->sk->sk_sndtimeo = mdev->net_conf->timeout*HZ/10; | 858 | * sock->sk->sk_sndtimeo = mdev->tconn->net_conf->timeout*HZ/10; |
859 | * sock->sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT; | 859 | * sock->sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT; |
860 | * first set it to the P_HAND_SHAKE timeout, | 860 | * first set it to the P_HAND_SHAKE timeout, |
861 | * which we set to 4x the configured ping_timeout. */ | 861 | * which we set to 4x the configured ping_timeout. */ |
862 | sock->sk->sk_sndtimeo = | 862 | sock->sk->sk_sndtimeo = |
863 | sock->sk->sk_rcvtimeo = mdev->net_conf->ping_timeo*4*HZ/10; | 863 | sock->sk->sk_rcvtimeo = mdev->tconn->net_conf->ping_timeo*4*HZ/10; |
864 | 864 | ||
865 | msock->sk->sk_sndtimeo = mdev->net_conf->timeout*HZ/10; | 865 | msock->sk->sk_sndtimeo = mdev->tconn->net_conf->timeout*HZ/10; |
866 | msock->sk->sk_rcvtimeo = mdev->net_conf->ping_int*HZ; | 866 | msock->sk->sk_rcvtimeo = mdev->tconn->net_conf->ping_int*HZ; |
867 | 867 | ||
868 | /* we don't want delays. | 868 | /* we don't want delays. |
869 | * we use TCP_CORK where appropriate, though */ | 869 | * we use TCP_CORK where appropriate, though */ |
@@ -895,7 +895,7 @@ retry: | |||
895 | if (drbd_request_state(mdev, NS(conn, C_WF_REPORT_PARAMS)) < SS_SUCCESS) | 895 | if (drbd_request_state(mdev, NS(conn, C_WF_REPORT_PARAMS)) < SS_SUCCESS) |
896 | return 0; | 896 | return 0; |
897 | 897 | ||
898 | sock->sk->sk_sndtimeo = mdev->net_conf->timeout*HZ/10; | 898 | sock->sk->sk_sndtimeo = mdev->tconn->net_conf->timeout*HZ/10; |
899 | sock->sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT; | 899 | sock->sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT; |
900 | 900 | ||
901 | atomic_set(&mdev->packet_seq, 0); | 901 | atomic_set(&mdev->packet_seq, 0); |
@@ -1555,7 +1555,7 @@ static int e_end_block(struct drbd_conf *mdev, struct drbd_work *w, int cancel) | |||
1555 | sector_t sector = e->i.sector; | 1555 | sector_t sector = e->i.sector; |
1556 | int ok = 1, pcmd; | 1556 | int ok = 1, pcmd; |
1557 | 1557 | ||
1558 | if (mdev->net_conf->wire_protocol == DRBD_PROT_C) { | 1558 | if (mdev->tconn->net_conf->wire_protocol == DRBD_PROT_C) { |
1559 | if (likely((e->flags & EE_WAS_ERROR) == 0)) { | 1559 | if (likely((e->flags & EE_WAS_ERROR) == 0)) { |
1560 | pcmd = (mdev->state.conn >= C_SYNC_SOURCE && | 1560 | pcmd = (mdev->state.conn >= C_SYNC_SOURCE && |
1561 | mdev->state.conn <= C_PAUSED_SYNC_T && | 1561 | mdev->state.conn <= C_PAUSED_SYNC_T && |
@@ -1573,7 +1573,7 @@ static int e_end_block(struct drbd_conf *mdev, struct drbd_work *w, int cancel) | |||
1573 | } | 1573 | } |
1574 | /* we delete from the conflict detection hash _after_ we sent out the | 1574 | /* we delete from the conflict detection hash _after_ we sent out the |
1575 | * P_WRITE_ACK / P_NEG_ACK, to get the sequence number right. */ | 1575 | * P_WRITE_ACK / P_NEG_ACK, to get the sequence number right. */ |
1576 | if (mdev->net_conf->two_primaries) { | 1576 | if (mdev->tconn->net_conf->two_primaries) { |
1577 | spin_lock_irq(&mdev->req_lock); | 1577 | spin_lock_irq(&mdev->req_lock); |
1578 | D_ASSERT(!drbd_interval_empty(&e->i)); | 1578 | D_ASSERT(!drbd_interval_empty(&e->i)); |
1579 | drbd_remove_interval(&mdev->epoch_entries, &e->i); | 1579 | drbd_remove_interval(&mdev->epoch_entries, &e->i); |
@@ -1592,7 +1592,7 @@ static int e_send_discard_ack(struct drbd_conf *mdev, struct drbd_work *w, int u | |||
1592 | struct drbd_epoch_entry *e = (struct drbd_epoch_entry *)w; | 1592 | struct drbd_epoch_entry *e = (struct drbd_epoch_entry *)w; |
1593 | int ok = 1; | 1593 | int ok = 1; |
1594 | 1594 | ||
1595 | D_ASSERT(mdev->net_conf->wire_protocol == DRBD_PROT_C); | 1595 | D_ASSERT(mdev->tconn->net_conf->wire_protocol == DRBD_PROT_C); |
1596 | ok = drbd_send_ack(mdev, P_DISCARD_ACK, e); | 1596 | ok = drbd_send_ack(mdev, P_DISCARD_ACK, e); |
1597 | 1597 | ||
1598 | spin_lock_irq(&mdev->req_lock); | 1598 | spin_lock_irq(&mdev->req_lock); |
@@ -1717,7 +1717,7 @@ static int receive_Data(struct drbd_conf *mdev, enum drbd_packets cmd, unsigned | |||
1717 | spin_unlock(&mdev->epoch_lock); | 1717 | spin_unlock(&mdev->epoch_lock); |
1718 | 1718 | ||
1719 | /* I'm the receiver, I do hold a net_cnt reference. */ | 1719 | /* I'm the receiver, I do hold a net_cnt reference. */ |
1720 | if (!mdev->net_conf->two_primaries) { | 1720 | if (!mdev->tconn->net_conf->two_primaries) { |
1721 | spin_lock_irq(&mdev->req_lock); | 1721 | spin_lock_irq(&mdev->req_lock); |
1722 | } else { | 1722 | } else { |
1723 | /* don't get the req_lock yet, | 1723 | /* don't get the req_lock yet, |
@@ -1727,7 +1727,7 @@ static int receive_Data(struct drbd_conf *mdev, enum drbd_packets cmd, unsigned | |||
1727 | DEFINE_WAIT(wait); | 1727 | DEFINE_WAIT(wait); |
1728 | int first; | 1728 | int first; |
1729 | 1729 | ||
1730 | D_ASSERT(mdev->net_conf->wire_protocol == DRBD_PROT_C); | 1730 | D_ASSERT(mdev->tconn->net_conf->wire_protocol == DRBD_PROT_C); |
1731 | 1731 | ||
1732 | /* conflict detection and handling: | 1732 | /* conflict detection and handling: |
1733 | * 1. wait on the sequence number, | 1733 | * 1. wait on the sequence number, |
@@ -1845,7 +1845,7 @@ static int receive_Data(struct drbd_conf *mdev, enum drbd_packets cmd, unsigned | |||
1845 | list_add(&e->w.list, &mdev->active_ee); | 1845 | list_add(&e->w.list, &mdev->active_ee); |
1846 | spin_unlock_irq(&mdev->req_lock); | 1846 | spin_unlock_irq(&mdev->req_lock); |
1847 | 1847 | ||
1848 | switch (mdev->net_conf->wire_protocol) { | 1848 | switch (mdev->tconn->net_conf->wire_protocol) { |
1849 | case DRBD_PROT_C: | 1849 | case DRBD_PROT_C: |
1850 | inc_unacked(mdev); | 1850 | inc_unacked(mdev); |
1851 | /* corresponding dec_unacked() in e_end_block() | 1851 | /* corresponding dec_unacked() in e_end_block() |
@@ -2153,7 +2153,7 @@ static int drbd_asb_recover_0p(struct drbd_conf *mdev) __must_hold(local) | |||
2153 | ch_peer = mdev->p_uuid[UI_SIZE]; | 2153 | ch_peer = mdev->p_uuid[UI_SIZE]; |
2154 | ch_self = mdev->comm_bm_set; | 2154 | ch_self = mdev->comm_bm_set; |
2155 | 2155 | ||
2156 | switch (mdev->net_conf->after_sb_0p) { | 2156 | switch (mdev->tconn->net_conf->after_sb_0p) { |
2157 | case ASB_CONSENSUS: | 2157 | case ASB_CONSENSUS: |
2158 | case ASB_DISCARD_SECONDARY: | 2158 | case ASB_DISCARD_SECONDARY: |
2159 | case ASB_CALL_HELPER: | 2159 | case ASB_CALL_HELPER: |
@@ -2192,7 +2192,7 @@ static int drbd_asb_recover_0p(struct drbd_conf *mdev) __must_hold(local) | |||
2192 | if (ch_peer == 0) { rv = 1; break; } | 2192 | if (ch_peer == 0) { rv = 1; break; } |
2193 | if (ch_self == 0) { rv = -1; break; } | 2193 | if (ch_self == 0) { rv = -1; break; } |
2194 | } | 2194 | } |
2195 | if (mdev->net_conf->after_sb_0p == ASB_DISCARD_ZERO_CHG) | 2195 | if (mdev->tconn->net_conf->after_sb_0p == ASB_DISCARD_ZERO_CHG) |
2196 | break; | 2196 | break; |
2197 | case ASB_DISCARD_LEAST_CHG: | 2197 | case ASB_DISCARD_LEAST_CHG: |
2198 | if (ch_self < ch_peer) | 2198 | if (ch_self < ch_peer) |
@@ -2218,7 +2218,7 @@ static int drbd_asb_recover_1p(struct drbd_conf *mdev) __must_hold(local) | |||
2218 | { | 2218 | { |
2219 | int hg, rv = -100; | 2219 | int hg, rv = -100; |
2220 | 2220 | ||
2221 | switch (mdev->net_conf->after_sb_1p) { | 2221 | switch (mdev->tconn->net_conf->after_sb_1p) { |
2222 | case ASB_DISCARD_YOUNGER_PRI: | 2222 | case ASB_DISCARD_YOUNGER_PRI: |
2223 | case ASB_DISCARD_OLDER_PRI: | 2223 | case ASB_DISCARD_OLDER_PRI: |
2224 | case ASB_DISCARD_LEAST_CHG: | 2224 | case ASB_DISCARD_LEAST_CHG: |
@@ -2267,7 +2267,7 @@ static int drbd_asb_recover_2p(struct drbd_conf *mdev) __must_hold(local) | |||
2267 | { | 2267 | { |
2268 | int hg, rv = -100; | 2268 | int hg, rv = -100; |
2269 | 2269 | ||
2270 | switch (mdev->net_conf->after_sb_2p) { | 2270 | switch (mdev->tconn->net_conf->after_sb_2p) { |
2271 | case ASB_DISCARD_YOUNGER_PRI: | 2271 | case ASB_DISCARD_YOUNGER_PRI: |
2272 | case ASB_DISCARD_OLDER_PRI: | 2272 | case ASB_DISCARD_OLDER_PRI: |
2273 | case ASB_DISCARD_LEAST_CHG: | 2273 | case ASB_DISCARD_LEAST_CHG: |
@@ -2558,7 +2558,7 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_conf *mdev, enum drbd_rol | |||
2558 | if (abs(hg) == 100) | 2558 | if (abs(hg) == 100) |
2559 | drbd_khelper(mdev, "initial-split-brain"); | 2559 | drbd_khelper(mdev, "initial-split-brain"); |
2560 | 2560 | ||
2561 | if (hg == 100 || (hg == -100 && mdev->net_conf->always_asbp)) { | 2561 | if (hg == 100 || (hg == -100 && mdev->tconn->net_conf->always_asbp)) { |
2562 | int pcount = (mdev->state.role == R_PRIMARY) | 2562 | int pcount = (mdev->state.role == R_PRIMARY) |
2563 | + (peer_role == R_PRIMARY); | 2563 | + (peer_role == R_PRIMARY); |
2564 | int forced = (hg == -100); | 2564 | int forced = (hg == -100); |
@@ -2587,9 +2587,9 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_conf *mdev, enum drbd_rol | |||
2587 | } | 2587 | } |
2588 | 2588 | ||
2589 | if (hg == -100) { | 2589 | if (hg == -100) { |
2590 | if (mdev->net_conf->want_lose && !(mdev->p_uuid[UI_FLAGS]&1)) | 2590 | if (mdev->tconn->net_conf->want_lose && !(mdev->p_uuid[UI_FLAGS]&1)) |
2591 | hg = -1; | 2591 | hg = -1; |
2592 | if (!mdev->net_conf->want_lose && (mdev->p_uuid[UI_FLAGS]&1)) | 2592 | if (!mdev->tconn->net_conf->want_lose && (mdev->p_uuid[UI_FLAGS]&1)) |
2593 | hg = 1; | 2593 | hg = 1; |
2594 | 2594 | ||
2595 | if (abs(hg) < 100) | 2595 | if (abs(hg) < 100) |
@@ -2615,7 +2615,7 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_conf *mdev, enum drbd_rol | |||
2615 | 2615 | ||
2616 | if (hg < 0 && /* by intention we do not use mydisk here. */ | 2616 | if (hg < 0 && /* by intention we do not use mydisk here. */ |
2617 | mdev->state.role == R_PRIMARY && mdev->state.disk >= D_CONSISTENT) { | 2617 | mdev->state.role == R_PRIMARY && mdev->state.disk >= D_CONSISTENT) { |
2618 | switch (mdev->net_conf->rr_conflict) { | 2618 | switch (mdev->tconn->net_conf->rr_conflict) { |
2619 | case ASB_CALL_HELPER: | 2619 | case ASB_CALL_HELPER: |
2620 | drbd_khelper(mdev, "pri-lost"); | 2620 | drbd_khelper(mdev, "pri-lost"); |
2621 | /* fall through */ | 2621 | /* fall through */ |
@@ -2628,7 +2628,7 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_conf *mdev, enum drbd_rol | |||
2628 | } | 2628 | } |
2629 | } | 2629 | } |
2630 | 2630 | ||
2631 | if (mdev->net_conf->dry_run || test_bit(CONN_DRY_RUN, &mdev->flags)) { | 2631 | if (mdev->tconn->net_conf->dry_run || test_bit(CONN_DRY_RUN, &mdev->flags)) { |
2632 | if (hg == 0) | 2632 | if (hg == 0) |
2633 | dev_info(DEV, "dry-run connect: No resync, would become Connected immediately.\n"); | 2633 | dev_info(DEV, "dry-run connect: No resync, would become Connected immediately.\n"); |
2634 | else | 2634 | else |
@@ -2701,38 +2701,38 @@ static int receive_protocol(struct drbd_conf *mdev, enum drbd_packets cmd, unsig | |||
2701 | if (cf & CF_DRY_RUN) | 2701 | if (cf & CF_DRY_RUN) |
2702 | set_bit(CONN_DRY_RUN, &mdev->flags); | 2702 | set_bit(CONN_DRY_RUN, &mdev->flags); |
2703 | 2703 | ||
2704 | if (p_proto != mdev->net_conf->wire_protocol) { | 2704 | if (p_proto != mdev->tconn->net_conf->wire_protocol) { |
2705 | dev_err(DEV, "incompatible communication protocols\n"); | 2705 | dev_err(DEV, "incompatible communication protocols\n"); |
2706 | goto disconnect; | 2706 | goto disconnect; |
2707 | } | 2707 | } |
2708 | 2708 | ||
2709 | if (cmp_after_sb(p_after_sb_0p, mdev->net_conf->after_sb_0p)) { | 2709 | if (cmp_after_sb(p_after_sb_0p, mdev->tconn->net_conf->after_sb_0p)) { |
2710 | dev_err(DEV, "incompatible after-sb-0pri settings\n"); | 2710 | dev_err(DEV, "incompatible after-sb-0pri settings\n"); |
2711 | goto disconnect; | 2711 | goto disconnect; |
2712 | } | 2712 | } |
2713 | 2713 | ||
2714 | if (cmp_after_sb(p_after_sb_1p, mdev->net_conf->after_sb_1p)) { | 2714 | if (cmp_after_sb(p_after_sb_1p, mdev->tconn->net_conf->after_sb_1p)) { |
2715 | dev_err(DEV, "incompatible after-sb-1pri settings\n"); | 2715 | dev_err(DEV, "incompatible after-sb-1pri settings\n"); |
2716 | goto disconnect; | 2716 | goto disconnect; |
2717 | } | 2717 | } |
2718 | 2718 | ||
2719 | if (cmp_after_sb(p_after_sb_2p, mdev->net_conf->after_sb_2p)) { | 2719 | if (cmp_after_sb(p_after_sb_2p, mdev->tconn->net_conf->after_sb_2p)) { |
2720 | dev_err(DEV, "incompatible after-sb-2pri settings\n"); | 2720 | dev_err(DEV, "incompatible after-sb-2pri settings\n"); |
2721 | goto disconnect; | 2721 | goto disconnect; |
2722 | } | 2722 | } |
2723 | 2723 | ||
2724 | if (p_want_lose && mdev->net_conf->want_lose) { | 2724 | if (p_want_lose && mdev->tconn->net_conf->want_lose) { |
2725 | dev_err(DEV, "both sides have the 'want_lose' flag set\n"); | 2725 | dev_err(DEV, "both sides have the 'want_lose' flag set\n"); |
2726 | goto disconnect; | 2726 | goto disconnect; |
2727 | } | 2727 | } |
2728 | 2728 | ||
2729 | if (p_two_primaries != mdev->net_conf->two_primaries) { | 2729 | if (p_two_primaries != mdev->tconn->net_conf->two_primaries) { |
2730 | dev_err(DEV, "incompatible setting of the two-primaries options\n"); | 2730 | dev_err(DEV, "incompatible setting of the two-primaries options\n"); |
2731 | goto disconnect; | 2731 | goto disconnect; |
2732 | } | 2732 | } |
2733 | 2733 | ||
2734 | if (mdev->agreed_pro_version >= 87) { | 2734 | if (mdev->agreed_pro_version >= 87) { |
2735 | unsigned char *my_alg = mdev->net_conf->integrity_alg; | 2735 | unsigned char *my_alg = mdev->tconn->net_conf->integrity_alg; |
2736 | 2736 | ||
2737 | if (drbd_recv(mdev, p_integrity_alg, data_size) != data_size) | 2737 | if (drbd_recv(mdev, p_integrity_alg, data_size) != data_size) |
2738 | return false; | 2738 | return false; |
@@ -3312,7 +3312,7 @@ static int receive_state(struct drbd_conf *mdev, enum drbd_packets cmd, unsigned | |||
3312 | } | 3312 | } |
3313 | } | 3313 | } |
3314 | 3314 | ||
3315 | mdev->net_conf->want_lose = 0; | 3315 | mdev->tconn->net_conf->want_lose = 0; |
3316 | 3316 | ||
3317 | drbd_md_sync(mdev); /* update connected indicator, la_size, ... */ | 3317 | drbd_md_sync(mdev); /* update connected indicator, la_size, ... */ |
3318 | 3318 | ||
@@ -3844,8 +3844,8 @@ static void drbd_disconnect(struct drbd_conf *mdev) | |||
3844 | crypto_free_hash(mdev->cram_hmac_tfm); | 3844 | crypto_free_hash(mdev->cram_hmac_tfm); |
3845 | mdev->cram_hmac_tfm = NULL; | 3845 | mdev->cram_hmac_tfm = NULL; |
3846 | 3846 | ||
3847 | kfree(mdev->net_conf); | 3847 | kfree(mdev->tconn->net_conf); |
3848 | mdev->net_conf = NULL; | 3848 | mdev->tconn->net_conf = NULL; |
3849 | drbd_request_state(mdev, NS(conn, C_STANDALONE)); | 3849 | drbd_request_state(mdev, NS(conn, C_STANDALONE)); |
3850 | } | 3850 | } |
3851 | 3851 | ||
@@ -4005,7 +4005,7 @@ static int drbd_do_auth(struct drbd_conf *mdev) | |||
4005 | char *response = NULL; | 4005 | char *response = NULL; |
4006 | char *right_response = NULL; | 4006 | char *right_response = NULL; |
4007 | char *peers_ch = NULL; | 4007 | char *peers_ch = NULL; |
4008 | unsigned int key_len = strlen(mdev->net_conf->shared_secret); | 4008 | unsigned int key_len = strlen(mdev->tconn->net_conf->shared_secret); |
4009 | unsigned int resp_size; | 4009 | unsigned int resp_size; |
4010 | struct hash_desc desc; | 4010 | struct hash_desc desc; |
4011 | enum drbd_packets cmd; | 4011 | enum drbd_packets cmd; |
@@ -4016,7 +4016,7 @@ static int drbd_do_auth(struct drbd_conf *mdev) | |||
4016 | desc.flags = 0; | 4016 | desc.flags = 0; |
4017 | 4017 | ||
4018 | rv = crypto_hash_setkey(mdev->cram_hmac_tfm, | 4018 | rv = crypto_hash_setkey(mdev->cram_hmac_tfm, |
4019 | (u8 *)mdev->net_conf->shared_secret, key_len); | 4019 | (u8 *)mdev->tconn->net_conf->shared_secret, key_len); |
4020 | if (rv) { | 4020 | if (rv) { |
4021 | dev_err(DEV, "crypto_hash_setkey() failed with %d\n", rv); | 4021 | dev_err(DEV, "crypto_hash_setkey() failed with %d\n", rv); |
4022 | rv = -1; | 4022 | rv = -1; |
@@ -4130,7 +4130,7 @@ static int drbd_do_auth(struct drbd_conf *mdev) | |||
4130 | 4130 | ||
4131 | if (rv) | 4131 | if (rv) |
4132 | dev_info(DEV, "Peer authenticated using %d bytes of '%s' HMAC\n", | 4132 | dev_info(DEV, "Peer authenticated using %d bytes of '%s' HMAC\n", |
4133 | resp_size, mdev->net_conf->cram_hmac_alg); | 4133 | resp_size, mdev->tconn->net_conf->cram_hmac_alg); |
4134 | else | 4134 | else |
4135 | rv = -1; | 4135 | rv = -1; |
4136 | 4136 | ||
@@ -4207,7 +4207,7 @@ static int got_Ping(struct drbd_conf *mdev, struct p_header80 *h) | |||
4207 | static int got_PingAck(struct drbd_conf *mdev, struct p_header80 *h) | 4207 | static int got_PingAck(struct drbd_conf *mdev, struct p_header80 *h) |
4208 | { | 4208 | { |
4209 | /* restore idle timeout */ | 4209 | /* restore idle timeout */ |
4210 | mdev->meta.socket->sk->sk_rcvtimeo = mdev->net_conf->ping_int*HZ; | 4210 | mdev->meta.socket->sk->sk_rcvtimeo = mdev->tconn->net_conf->ping_int*HZ; |
4211 | if (!test_and_set_bit(GOT_PING_ACK, &mdev->flags)) | 4211 | if (!test_and_set_bit(GOT_PING_ACK, &mdev->flags)) |
4212 | wake_up(&mdev->misc_wait); | 4212 | wake_up(&mdev->misc_wait); |
4213 | 4213 | ||
@@ -4275,19 +4275,19 @@ static int got_BlockAck(struct drbd_conf *mdev, struct p_header80 *h) | |||
4275 | } | 4275 | } |
4276 | switch (be16_to_cpu(h->command)) { | 4276 | switch (be16_to_cpu(h->command)) { |
4277 | case P_RS_WRITE_ACK: | 4277 | case P_RS_WRITE_ACK: |
4278 | D_ASSERT(mdev->net_conf->wire_protocol == DRBD_PROT_C); | 4278 | D_ASSERT(mdev->tconn->net_conf->wire_protocol == DRBD_PROT_C); |
4279 | what = WRITE_ACKED_BY_PEER_AND_SIS; | 4279 | what = WRITE_ACKED_BY_PEER_AND_SIS; |
4280 | break; | 4280 | break; |
4281 | case P_WRITE_ACK: | 4281 | case P_WRITE_ACK: |
4282 | D_ASSERT(mdev->net_conf->wire_protocol == DRBD_PROT_C); | 4282 | D_ASSERT(mdev->tconn->net_conf->wire_protocol == DRBD_PROT_C); |
4283 | what = WRITE_ACKED_BY_PEER; | 4283 | what = WRITE_ACKED_BY_PEER; |
4284 | break; | 4284 | break; |
4285 | case P_RECV_ACK: | 4285 | case P_RECV_ACK: |
4286 | D_ASSERT(mdev->net_conf->wire_protocol == DRBD_PROT_B); | 4286 | D_ASSERT(mdev->tconn->net_conf->wire_protocol == DRBD_PROT_B); |
4287 | what = RECV_ACKED_BY_PEER; | 4287 | what = RECV_ACKED_BY_PEER; |
4288 | break; | 4288 | break; |
4289 | case P_DISCARD_ACK: | 4289 | case P_DISCARD_ACK: |
4290 | D_ASSERT(mdev->net_conf->wire_protocol == DRBD_PROT_C); | 4290 | D_ASSERT(mdev->tconn->net_conf->wire_protocol == DRBD_PROT_C); |
4291 | what = CONFLICT_DISCARDED_BY_PEER; | 4291 | what = CONFLICT_DISCARDED_BY_PEER; |
4292 | break; | 4292 | break; |
4293 | default: | 4293 | default: |
@@ -4305,8 +4305,8 @@ static int got_NegAck(struct drbd_conf *mdev, struct p_header80 *h) | |||
4305 | struct p_block_ack *p = (struct p_block_ack *)h; | 4305 | struct p_block_ack *p = (struct p_block_ack *)h; |
4306 | sector_t sector = be64_to_cpu(p->sector); | 4306 | sector_t sector = be64_to_cpu(p->sector); |
4307 | int size = be32_to_cpu(p->blksize); | 4307 | int size = be32_to_cpu(p->blksize); |
4308 | bool missing_ok = mdev->net_conf->wire_protocol == DRBD_PROT_A || | 4308 | bool missing_ok = mdev->tconn->net_conf->wire_protocol == DRBD_PROT_A || |
4309 | mdev->net_conf->wire_protocol == DRBD_PROT_B; | 4309 | mdev->tconn->net_conf->wire_protocol == DRBD_PROT_B; |
4310 | bool found; | 4310 | bool found; |
4311 | 4311 | ||
4312 | update_peer_seq(mdev, be32_to_cpu(p->seq_num)); | 4312 | update_peer_seq(mdev, be32_to_cpu(p->seq_num)); |
@@ -4502,13 +4502,13 @@ int drbd_asender(struct drbd_thread *thi) | |||
4502 | goto reconnect; | 4502 | goto reconnect; |
4503 | } | 4503 | } |
4504 | mdev->meta.socket->sk->sk_rcvtimeo = | 4504 | mdev->meta.socket->sk->sk_rcvtimeo = |
4505 | mdev->net_conf->ping_timeo*HZ/10; | 4505 | mdev->tconn->net_conf->ping_timeo*HZ/10; |
4506 | ping_timeout_active = 1; | 4506 | ping_timeout_active = 1; |
4507 | } | 4507 | } |
4508 | 4508 | ||
4509 | /* conditionally cork; | 4509 | /* conditionally cork; |
4510 | * it may hurt latency if we cork without much to send */ | 4510 | * it may hurt latency if we cork without much to send */ |
4511 | if (!mdev->net_conf->no_cork && | 4511 | if (!mdev->tconn->net_conf->no_cork && |
4512 | 3 < atomic_read(&mdev->unacked_cnt)) | 4512 | 3 < atomic_read(&mdev->unacked_cnt)) |
4513 | drbd_tcp_cork(mdev->meta.socket); | 4513 | drbd_tcp_cork(mdev->meta.socket); |
4514 | while (1) { | 4514 | while (1) { |
@@ -4528,7 +4528,7 @@ int drbd_asender(struct drbd_thread *thi) | |||
4528 | break; | 4528 | break; |
4529 | } | 4529 | } |
4530 | /* but unconditionally uncork unless disabled */ | 4530 | /* but unconditionally uncork unless disabled */ |
4531 | if (!mdev->net_conf->no_cork) | 4531 | if (!mdev->tconn->net_conf->no_cork) |
4532 | drbd_tcp_uncork(mdev->meta.socket); | 4532 | drbd_tcp_uncork(mdev->meta.socket); |
4533 | 4533 | ||
4534 | /* short circuit, recv_msg would return EINTR anyways. */ | 4534 | /* short circuit, recv_msg would return EINTR anyways. */ |
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c index b3b1d4edbb03..2b2662d4ab3c 100644 --- a/drivers/block/drbd/drbd_req.c +++ b/drivers/block/drbd/drbd_req.c | |||
@@ -528,7 +528,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what, | |||
528 | drbd_queue_work(&mdev->data.work, &req->w); | 528 | drbd_queue_work(&mdev->data.work, &req->w); |
529 | 529 | ||
530 | /* close the epoch, in case it outgrew the limit */ | 530 | /* close the epoch, in case it outgrew the limit */ |
531 | if (mdev->newest_tle->n_writes >= mdev->net_conf->max_epoch_size) | 531 | if (mdev->newest_tle->n_writes >= mdev->tconn->net_conf->max_epoch_size) |
532 | queue_barrier(mdev); | 532 | queue_barrier(mdev); |
533 | 533 | ||
534 | break; | 534 | break; |
@@ -558,7 +558,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what, | |||
558 | atomic_add(req->i.size >> 9, &mdev->ap_in_flight); | 558 | atomic_add(req->i.size >> 9, &mdev->ap_in_flight); |
559 | 559 | ||
560 | if (bio_data_dir(req->master_bio) == WRITE && | 560 | if (bio_data_dir(req->master_bio) == WRITE && |
561 | mdev->net_conf->wire_protocol == DRBD_PROT_A) { | 561 | mdev->tconn->net_conf->wire_protocol == DRBD_PROT_A) { |
562 | /* this is what is dangerous about protocol A: | 562 | /* this is what is dangerous about protocol A: |
563 | * pretend it was successfully written on the peer. */ | 563 | * pretend it was successfully written on the peer. */ |
564 | if (req->rq_state & RQ_NET_PENDING) { | 564 | if (req->rq_state & RQ_NET_PENDING) { |
@@ -697,8 +697,8 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what, | |||
697 | } | 697 | } |
698 | if ((req->rq_state & RQ_NET_MASK) != 0) { | 698 | if ((req->rq_state & RQ_NET_MASK) != 0) { |
699 | req->rq_state |= RQ_NET_DONE; | 699 | req->rq_state |= RQ_NET_DONE; |
700 | if (mdev->net_conf->wire_protocol == DRBD_PROT_A) | 700 | if (mdev->tconn->net_conf->wire_protocol == DRBD_PROT_A) |
701 | atomic_sub(req->i.size >> 9, &mdev->ap_in_flight); | 701 | atomic_sub(req->i.size>>9, &mdev->ap_in_flight); |
702 | } | 702 | } |
703 | _req_may_be_done(req, m); /* Allowed while state.susp */ | 703 | _req_may_be_done(req, m); /* Allowed while state.susp */ |
704 | break; | 704 | break; |
@@ -951,16 +951,16 @@ allocate_barrier: | |||
951 | _req_mod(req, QUEUE_FOR_SEND_OOS); | 951 | _req_mod(req, QUEUE_FOR_SEND_OOS); |
952 | 952 | ||
953 | if (remote && | 953 | if (remote && |
954 | mdev->net_conf->on_congestion != OC_BLOCK && mdev->agreed_pro_version >= 96) { | 954 | mdev->tconn->net_conf->on_congestion != OC_BLOCK && mdev->agreed_pro_version >= 96) { |
955 | int congested = 0; | 955 | int congested = 0; |
956 | 956 | ||
957 | if (mdev->net_conf->cong_fill && | 957 | if (mdev->tconn->net_conf->cong_fill && |
958 | atomic_read(&mdev->ap_in_flight) >= mdev->net_conf->cong_fill) { | 958 | atomic_read(&mdev->ap_in_flight) >= mdev->tconn->net_conf->cong_fill) { |
959 | dev_info(DEV, "Congestion-fill threshold reached\n"); | 959 | dev_info(DEV, "Congestion-fill threshold reached\n"); |
960 | congested = 1; | 960 | congested = 1; |
961 | } | 961 | } |
962 | 962 | ||
963 | if (mdev->act_log->used >= mdev->net_conf->cong_extents) { | 963 | if (mdev->act_log->used >= mdev->tconn->net_conf->cong_extents) { |
964 | dev_info(DEV, "Congestion-extents threshold reached\n"); | 964 | dev_info(DEV, "Congestion-extents threshold reached\n"); |
965 | congested = 1; | 965 | congested = 1; |
966 | } | 966 | } |
@@ -968,9 +968,9 @@ allocate_barrier: | |||
968 | if (congested) { | 968 | if (congested) { |
969 | queue_barrier(mdev); /* last barrier, after mirrored writes */ | 969 | queue_barrier(mdev); /* last barrier, after mirrored writes */ |
970 | 970 | ||
971 | if (mdev->net_conf->on_congestion == OC_PULL_AHEAD) | 971 | if (mdev->tconn->net_conf->on_congestion == OC_PULL_AHEAD) |
972 | _drbd_set_state(_NS(mdev, conn, C_AHEAD), 0, NULL); | 972 | _drbd_set_state(_NS(mdev, conn, C_AHEAD), 0, NULL); |
973 | else /*mdev->net_conf->on_congestion == OC_DISCONNECT */ | 973 | else /*mdev->tconn->net_conf->on_congestion == OC_DISCONNECT */ |
974 | _drbd_set_state(_NS(mdev, conn, C_DISCONNECTING), 0, NULL); | 974 | _drbd_set_state(_NS(mdev, conn, C_DISCONNECTING), 0, NULL); |
975 | } | 975 | } |
976 | } | 976 | } |
@@ -1182,7 +1182,7 @@ void request_timer_fn(unsigned long data) | |||
1182 | unsigned long et = 0; /* effective timeout = ko_count * timeout */ | 1182 | unsigned long et = 0; /* effective timeout = ko_count * timeout */ |
1183 | 1183 | ||
1184 | if (get_net_conf(mdev)) { | 1184 | if (get_net_conf(mdev)) { |
1185 | et = mdev->net_conf->timeout*HZ/10 * mdev->net_conf->ko_count; | 1185 | et = mdev->tconn->net_conf->timeout*HZ/10 * mdev->tconn->net_conf->ko_count; |
1186 | put_net_conf(mdev); | 1186 | put_net_conf(mdev); |
1187 | } | 1187 | } |
1188 | if (!et || mdev->state.conn < C_WF_REPORT_PARAMS) | 1188 | if (!et || mdev->state.conn < C_WF_REPORT_PARAMS) |
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c index 2e2c0659a3eb..d8c61816d103 100644 --- a/drivers/block/drbd/drbd_worker.c +++ b/drivers/block/drbd/drbd_worker.c | |||
@@ -1590,8 +1590,8 @@ void drbd_start_resync(struct drbd_conf *mdev, enum drbd_conns side) | |||
1590 | * the race considerably, but does not solve it. */ | 1590 | * the race considerably, but does not solve it. */ |
1591 | if (side == C_SYNC_SOURCE) | 1591 | if (side == C_SYNC_SOURCE) |
1592 | schedule_timeout_interruptible( | 1592 | schedule_timeout_interruptible( |
1593 | mdev->net_conf->ping_int * HZ + | 1593 | mdev->tconn->net_conf->ping_int * HZ + |
1594 | mdev->net_conf->ping_timeo*HZ/9); | 1594 | mdev->tconn->net_conf->ping_timeo*HZ/9); |
1595 | drbd_resync_finished(mdev); | 1595 | drbd_resync_finished(mdev); |
1596 | } | 1596 | } |
1597 | 1597 | ||
@@ -1623,14 +1623,14 @@ int drbd_worker(struct drbd_thread *thi) | |||
1623 | 1623 | ||
1624 | if (down_trylock(&mdev->data.work.s)) { | 1624 | if (down_trylock(&mdev->data.work.s)) { |
1625 | mutex_lock(&mdev->data.mutex); | 1625 | mutex_lock(&mdev->data.mutex); |
1626 | if (mdev->data.socket && !mdev->net_conf->no_cork) | 1626 | if (mdev->data.socket && !mdev->tconn->net_conf->no_cork) |
1627 | drbd_tcp_uncork(mdev->data.socket); | 1627 | drbd_tcp_uncork(mdev->data.socket); |
1628 | mutex_unlock(&mdev->data.mutex); | 1628 | mutex_unlock(&mdev->data.mutex); |
1629 | 1629 | ||
1630 | intr = down_interruptible(&mdev->data.work.s); | 1630 | intr = down_interruptible(&mdev->data.work.s); |
1631 | 1631 | ||
1632 | mutex_lock(&mdev->data.mutex); | 1632 | mutex_lock(&mdev->data.mutex); |
1633 | if (mdev->data.socket && !mdev->net_conf->no_cork) | 1633 | if (mdev->data.socket && !mdev->tconn->net_conf->no_cork) |
1634 | drbd_tcp_cork(mdev->data.socket); | 1634 | drbd_tcp_cork(mdev->data.socket); |
1635 | mutex_unlock(&mdev->data.mutex); | 1635 | mutex_unlock(&mdev->data.mutex); |
1636 | } | 1636 | } |