Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 345807
b: refs/heads/master
c: bbeb641
h: refs/heads/master
i:
  345805: 60c2635
  345803: 2ef6193
  345799: 5fde6e2
  345791: ba74723
v: v3
  • Loading branch information
Philipp Reisner committed Oct 14, 2011
1 parent 5843e49 commit cd2f17a
Show file tree
Hide file tree
Showing 8 changed files with 277 additions and 87 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 56707f9e873108c0173b4edf20ea452e1d2a89d2
refs/heads/master: bbeb641c3e4982d6bba21188545a7fd44ab0a715
4 changes: 2 additions & 2 deletions trunk/drivers/block/drbd/drbd_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -918,8 +918,8 @@ enum {
struct drbd_tconn { /* is a resource from the config file */
char *name; /* Resource name */
struct list_head all_tconn; /* List of all drbd_tconn, prot by global_state_lock */
struct drbd_conf *volume0; /* TODO: Remove me again */
struct idr volumes; /* <tconn, vnr> to mdev mapping */
enum drbd_conns cstate; /* Only C_STANDALONE to C_WF_REPORT_PARAMS */

unsigned long flags;
struct net_conf *net_conf; /* protected by get_net_conf() and put_net_conf() */
Expand Down Expand Up @@ -2024,7 +2024,7 @@ static inline int get_net_conf(struct drbd_tconn *tconn)
int have_net_conf;

atomic_inc(&tconn->net_cnt);
have_net_conf = tconn->volume0->state.conn >= C_UNCONNECTED;
have_net_conf = tconn->cstate >= C_UNCONNECTED;
if (!have_net_conf)
put_net_conf(tconn);
return have_net_conf;
Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/block/drbd/drbd_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,7 @@ static int we_should_drop_the_connection(struct drbd_tconn *tconn, struct socket
drop_it = tconn->meta.socket == sock
|| !tconn->asender.task
|| get_t_state(&tconn->asender) != RUNNING
|| tconn->volume0->state.conn < C_CONNECTED;
|| tconn->cstate < C_WF_REPORT_PARAMS;

if (drop_it)
return true;
Expand Down Expand Up @@ -1705,9 +1705,9 @@ int drbd_send(struct drbd_tconn *tconn, struct socket *sock,
conn_err(tconn, "%s_sendmsg returned %d\n",
sock == tconn->meta.socket ? "msock" : "sock",
rv);
drbd_force_state(tconn->volume0, NS(conn, C_BROKEN_PIPE));
conn_request_state(tconn, NS(conn, C_BROKEN_PIPE), CS_HARD);
} else
drbd_force_state(tconn->volume0, NS(conn, C_TIMEOUT));
conn_request_state(tconn, NS(conn, C_TIMEOUT), CS_HARD);
}

return sent;
Expand Down Expand Up @@ -2188,6 +2188,7 @@ struct drbd_tconn *drbd_new_tconn(char *name)
if (!tconn->name)
goto fail;

tconn->cstate = C_STANDALONE;
spin_lock_init(&tconn->req_lock);
atomic_set(&tconn->net_cnt, 0);
init_waitqueue_head(&tconn->net_cnt_wait);
Expand Down Expand Up @@ -2258,7 +2259,6 @@ struct drbd_conf *drbd_new_device(unsigned int minor)
if (!zalloc_cpumask_var(&mdev->tconn->cpu_mask, GFP_KERNEL))
goto out_no_cpumask;

mdev->tconn->volume0 = mdev;
mdev->minor = minor;

drbd_init_set_defaults(mdev);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/block/drbd/drbd_nl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1547,7 +1547,7 @@ static int drbd_nl_net_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
mdev->tconn->int_dig_out=int_dig_out;
mdev->tconn->int_dig_in=int_dig_in;
mdev->tconn->int_dig_vv=int_dig_vv;
retcode = _drbd_set_state(_NS(mdev, conn, C_UNCONNECTED), CS_VERBOSE, NULL);
retcode = _conn_request_state(mdev->tconn, NS(conn, C_UNCONNECTED), CS_VERBOSE);
spin_unlock_irq(&mdev->tconn->req_lock);

kobject_uevent(&disk_to_dev(mdev->vdisk)->kobj, KOBJ_CHANGE);
Expand Down
39 changes: 18 additions & 21 deletions trunk/drivers/block/drbd/drbd_receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ static int drbd_recv(struct drbd_tconn *tconn, void *buf, size_t size)
set_fs(oldfs);

if (rv != size)
drbd_force_state(tconn->volume0, NS(conn, C_BROKEN_PIPE));
conn_request_state(tconn, NS(conn, C_BROKEN_PIPE), CS_HARD);

return rv;
}
Expand Down Expand Up @@ -647,7 +647,7 @@ static struct socket *drbd_try_connect(struct drbd_tconn *tconn)
conn_err(tconn, "%s failed, err = %d\n", what, err);
}
if (disconnect_on_error)
drbd_force_state(tconn->volume0, NS(conn, C_DISCONNECTING));
conn_request_state(tconn, NS(conn, C_DISCONNECTING), CS_HARD);
}
put_net_conf(tconn);
return sock;
Expand Down Expand Up @@ -694,7 +694,7 @@ static struct socket *drbd_wait_for_connect(struct drbd_tconn *tconn)
if (err < 0) {
if (err != -EAGAIN && err != -EINTR && err != -ERESTARTSYS) {
conn_err(tconn, "%s failed, err = %d\n", what, err);
drbd_force_state(tconn->volume0, NS(conn, C_DISCONNECTING));
conn_request_state(tconn, NS(conn, C_DISCONNECTING), CS_HARD);
}
}
put_net_conf(tconn);
Expand Down Expand Up @@ -776,7 +776,7 @@ static int drbd_connect(struct drbd_tconn *tconn)
struct socket *s, *sock, *msock;
int try, h, ok;

if (drbd_request_state(tconn->volume0, NS(conn, C_WF_CONNECTION)) < SS_SUCCESS)
if (conn_request_state(tconn, NS(conn, C_WF_CONNECTION), CS_VERBOSE) < SS_SUCCESS)
return -2;

clear_bit(DISCARD_CONCURRENT, &tconn->flags);
Expand Down Expand Up @@ -850,7 +850,7 @@ static int drbd_connect(struct drbd_tconn *tconn)
}
}

if (tconn->volume0->state.conn <= C_DISCONNECTING)
if (tconn->cstate <= C_DISCONNECTING)
goto out_release_sockets;
if (signal_pending(current)) {
flush_signals(current);
Expand Down Expand Up @@ -912,7 +912,7 @@ static int drbd_connect(struct drbd_tconn *tconn)
}
}

if (drbd_request_state(tconn->volume0, NS(conn, C_WF_REPORT_PARAMS)) < SS_SUCCESS)
if (conn_request_state(tconn, NS(conn, C_WF_REPORT_PARAMS), CS_VERBOSE) < SS_SUCCESS)
return 0;

sock->sk->sk_sndtimeo = tconn->net_conf->timeout*HZ/10;
Expand Down Expand Up @@ -3817,7 +3817,7 @@ static void drbdd(struct drbd_tconn *tconn)

if (0) {
err_out:
drbd_force_state(tconn->volume0, NS(conn, C_PROTOCOL_ERROR));
conn_request_state(tconn, NS(conn, C_PROTOCOL_ERROR), CS_HARD);
}
}

Expand All @@ -3834,10 +3834,10 @@ void drbd_flush_workqueue(struct drbd_conf *mdev)

static void drbd_disconnect(struct drbd_tconn *tconn)
{
union drbd_state os, ns;
enum drbd_conns oc;
int rv = SS_UNKNOWN_ERROR;

if (tconn->volume0->state.conn == C_STANDALONE)
if (tconn->cstate == C_STANDALONE)
return;

/* asender does not clean up anything. it must not interfere, either */
Expand All @@ -3849,24 +3849,21 @@ static void drbd_disconnect(struct drbd_tconn *tconn)
conn_info(tconn, "Connection closed\n");

spin_lock_irq(&tconn->req_lock);
os = tconn->volume0->state;
if (os.conn >= C_UNCONNECTED) {
/* Do not restart in case we are C_DISCONNECTING */
ns.i = os.i;
ns.conn = C_UNCONNECTED;
rv = _drbd_set_state(tconn->volume0, ns, CS_VERBOSE, NULL);
}
oc = tconn->cstate;
if (oc >= C_UNCONNECTED)
rv = _conn_request_state(tconn, NS(conn, C_UNCONNECTED), CS_VERBOSE);

spin_unlock_irq(&tconn->req_lock);

if (os.conn == C_DISCONNECTING) {
if (oc == C_DISCONNECTING) {
wait_event(tconn->net_cnt_wait, atomic_read(&tconn->net_cnt) == 0);

crypto_free_hash(tconn->cram_hmac_tfm);
tconn->cram_hmac_tfm = NULL;

kfree(tconn->net_conf);
tconn->net_conf = NULL;
drbd_request_state(tconn->volume0, NS(conn, C_STANDALONE));
conn_request_state(tconn, NS(conn, C_STANDALONE), CS_VERBOSE);
}
}

Expand Down Expand Up @@ -4240,7 +4237,7 @@ int drbdd_init(struct drbd_thread *thi)
}
if (h == -1) {
conn_warn(tconn, "Discarding network configuration.\n");
drbd_force_state(tconn->volume0, NS(conn, C_DISCONNECTING));
conn_request_state(tconn, NS(conn, C_DISCONNECTING), CS_HARD);
}
} while (h == 0);

Expand Down Expand Up @@ -4709,11 +4706,11 @@ int drbd_asender(struct drbd_thread *thi)

if (0) {
reconnect:
drbd_force_state(tconn->volume0, NS(conn, C_NETWORK_FAILURE));
conn_request_state(tconn, NS(conn, C_NETWORK_FAILURE), CS_HARD);
}
if (0) {
disconnect:
drbd_force_state(tconn->volume0, NS(conn, C_DISCONNECTING));
conn_request_state(tconn, NS(conn, C_DISCONNECTING), CS_HARD);
}
clear_bit(SIGNAL_ASENDER, &tconn->flags);

Expand Down
Loading

0 comments on commit cd2f17a

Please sign in to comment.