summaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_state.c
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2011-07-11 17:04:23 +0200
committerPhilipp Reisner <philipp.reisner@linbit.com>2012-11-08 16:57:52 +0100
commite0e1665381a519fd1f588948b1c48b5e609e336d (patch)
tree71a90ae0b21ad39066536fb558672288add717cc /drivers/block/drbd/drbd_state.c
parentdrbd: Eliminated the "notified peer" messages (diff)
downloadlinux-e0e1665381a519fd1f588948b1c48b5e609e336d.tar.xz
linux-e0e1665381a519fd1f588948b1c48b5e609e336d.zip
drbd: Correctly handle resources without volumes
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_state.c')
-rw-r--r--drivers/block/drbd/drbd_state.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/block/drbd/drbd_state.c b/drivers/block/drbd/drbd_state.c
index c4dd667b20e4..eafc19532e15 100644
--- a/drivers/block/drbd/drbd_state.c
+++ b/drivers/block/drbd/drbd_state.c
@@ -1491,9 +1491,15 @@ static int w_after_conn_state_ch(struct drbd_work *w, int unused)
void conn_old_common_state(struct drbd_tconn *tconn, union drbd_state *pcs, enum chg_state_flags *pf)
{
enum chg_state_flags flags = ~0;
- union drbd_dev_state os, cs = {}; /* old_state, common_state */
struct drbd_conf *mdev;
int vnr, first_vol = 1;
+ union drbd_dev_state os, cs = {
+ { .role = R_SECONDARY,
+ .peer = R_UNKNOWN,
+ .conn = tconn->cstate,
+ .disk = D_DISKLESS,
+ .pdsk = D_UNKNOWN,
+ } };
rcu_read_lock();
idr_for_each_entry(&tconn->volumes, mdev, vnr) {
@@ -1574,10 +1580,17 @@ void
conn_set_state(struct drbd_tconn *tconn, union drbd_state mask, union drbd_state val,
union drbd_state *pns_min, union drbd_state *pns_max, enum chg_state_flags flags)
{
- union drbd_state ns, os, ns_max = { };
+ union drbd_state ns, os, ns_max = {
+ { .role = R_SECONDARY,
+ .peer = R_UNKNOWN,
+ .conn = val.conn,
+ .disk = D_DISKLESS,
+ .pdsk = D_UNKNOWN
+ } };
union drbd_state ns_min = {
{ .role = R_MASK,
.peer = R_MASK,
+ .conn = val.conn,
.disk = D_MASK,
.pdsk = D_MASK
} };