summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2011-07-18 10:44:24 +0200
committerPhilipp Reisner <philipp.reisner@linbit.com>2012-11-08 16:58:00 +0100
commitf132f554cea3ad1333ff8ea1ac23e1085abd639e (patch)
treea3c50aad5bf2363b56a77917032f0b23755c6b7c /drivers
parent97ddb68790891ed568ab8212189f5173dd600ea4 (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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/drbd/drbd_state.c21
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
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 = {
- { .role = R_SECONDARY,
- .peer = R_UNKNOWN,
- .conn = val.conn,
- .disk = D_DISKLESS,
- .pdsk = D_UNKNOWN
- } };
+ union drbd_state ns, os, ns_max = { };
union drbd_state ns_min = {
{ .role = R_MASK,
.peer = R_MASK,
@@ -1592,13 +1586,14 @@ conn_set_state(struct drbd_tconn *tconn, union drbd_state mask, union drbd_state
} };
struct drbd_conf *mdev;
enum drbd_state_rv rv;
- int vnr;
+ int vnr, number_of_volumes = 0;
if (mask.conn == C_MASK)
tconn->cstate = val.conn;
rcu_read_lock();
idr_for_each_entry(&tconn->volumes, mdev, vnr) {
+ number_of_volumes++;
os = drbd_read_state(mdev);
ns = apply_mask_val(os, mask, val);
ns = sanitize_state(mdev, ns, NULL);
@@ -1625,6 +1620,16 @@ conn_set_state(struct drbd_tconn *tconn, union drbd_state mask, union drbd_state
}
rcu_read_unlock();
+ if (number_of_volumes == 0) {
+ ns_min = ns_max = (union drbd_state) { {
+ .role = R_SECONDARY,
+ .peer = R_UNKNOWN,
+ .conn = val.conn,
+ .disk = D_DISKLESS,
+ .pdsk = D_UNKNOWN
+ } };
+ }
+
ns_min.susp = ns_max.susp = tconn->susp;
ns_min.susp_nod = ns_max.susp_nod = tconn->susp_nod;
ns_min.susp_fen = ns_max.susp_fen = tconn->susp_fen;