diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2011-07-18 04:44:24 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-08 10:58:00 -0500 |
commit | f132f554cea3ad1333ff8ea1ac23e1085abd639e (patch) | |
tree | a3c50aad5bf2363b56a77917032f0b23755c6b7c | |
parent | 97ddb68790891ed568ab8212189f5173dd600ea4 (diff) |
drbd: Do not display bogus log lines for pdsk in case pdsk < D_UNKNOWN
This was a regression recently introduced with commit
7848ddb752c09b6dfd1ddfabb06b69b08aa8f6b9
"drbd: Correctly handle resources without volumes"
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
-rw-r--r-- | drivers/block/drbd/drbd_state.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/block/drbd/drbd_state.c b/drivers/block/drbd/drbd_state.c index ecc5e2761668..9aefca69e4e7 100644 --- a/drivers/block/drbd/drbd_state.c +++ b/drivers/block/drbd/drbd_state.c | |||
@@ -1576,13 +1576,7 @@ void | |||
1576 | conn_set_state(struct drbd_tconn *tconn, union drbd_state mask, union drbd_state val, | 1576 | conn_set_state(struct drbd_tconn *tconn, union drbd_state mask, union drbd_state val, |
1577 | union drbd_state *pns_min, union drbd_state *pns_max, enum chg_state_flags flags) | 1577 | union drbd_state *pns_min, union drbd_state *pns_max, enum chg_state_flags flags) |
1578 | { | 1578 | { |
1579 | union drbd_state ns, os, ns_max = { | 1579 | union drbd_state ns, os, ns_max = { }; |
1580 | { .role = R_SECONDARY, | ||
1581 | .peer = R_UNKNOWN, | ||
1582 | .conn = val.conn, | ||
1583 | .disk = D_DISKLESS, | ||
1584 | .pdsk = D_UNKNOWN | ||
1585 | } }; | ||
1586 | union drbd_state ns_min = { | 1580 | union drbd_state ns_min = { |
1587 | { .role = R_MASK, | 1581 | { .role = R_MASK, |
1588 | .peer = R_MASK, | 1582 | .peer = R_MASK, |
@@ -1592,13 +1586,14 @@ conn_set_state(struct drbd_tconn *tconn, union drbd_state mask, union drbd_state | |||
1592 | } }; | 1586 | } }; |
1593 | struct drbd_conf *mdev; | 1587 | struct drbd_conf *mdev; |
1594 | enum drbd_state_rv rv; | 1588 | enum drbd_state_rv rv; |
1595 | int vnr; | 1589 | int vnr, number_of_volumes = 0; |
1596 | 1590 | ||
1597 | if (mask.conn == C_MASK) | 1591 | if (mask.conn == C_MASK) |
1598 | tconn->cstate = val.conn; | 1592 | tconn->cstate = val.conn; |
1599 | 1593 | ||
1600 | rcu_read_lock(); | 1594 | rcu_read_lock(); |
1601 | idr_for_each_entry(&tconn->volumes, mdev, vnr) { | 1595 | idr_for_each_entry(&tconn->volumes, mdev, vnr) { |
1596 | number_of_volumes++; | ||
1602 | os = drbd_read_state(mdev); | 1597 | os = drbd_read_state(mdev); |
1603 | ns = apply_mask_val(os, mask, val); | 1598 | ns = apply_mask_val(os, mask, val); |
1604 | ns = sanitize_state(mdev, ns, NULL); | 1599 | ns = sanitize_state(mdev, ns, NULL); |
@@ -1625,6 +1620,16 @@ conn_set_state(struct drbd_tconn *tconn, union drbd_state mask, union drbd_state | |||
1625 | } | 1620 | } |
1626 | rcu_read_unlock(); | 1621 | rcu_read_unlock(); |
1627 | 1622 | ||
1623 | if (number_of_volumes == 0) { | ||
1624 | ns_min = ns_max = (union drbd_state) { { | ||
1625 | .role = R_SECONDARY, | ||
1626 | .peer = R_UNKNOWN, | ||
1627 | .conn = val.conn, | ||
1628 | .disk = D_DISKLESS, | ||
1629 | .pdsk = D_UNKNOWN | ||
1630 | } }; | ||
1631 | } | ||
1632 | |||
1628 | ns_min.susp = ns_max.susp = tconn->susp; | 1633 | ns_min.susp = ns_max.susp = tconn->susp; |
1629 | ns_min.susp_nod = ns_max.susp_nod = tconn->susp_nod; | 1634 | ns_min.susp_nod = ns_max.susp_nod = tconn->susp_nod; |
1630 | ns_min.susp_fen = ns_max.susp_fen = tconn->susp_fen; | 1635 | ns_min.susp_fen = ns_max.susp_fen = tconn->susp_fen; |