Skip to content

Commit

Permalink
drbd: report net config even for resources without a single volume
Browse files Browse the repository at this point in the history
Currently it is legal (though unusual) to create and connect a resource,
before adding in all necessary volumes. We should include the network
configuration details, even if we don't have a single volume (yet).

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
  • Loading branch information
Lars Ellenberg authored and Philipp Reisner committed Nov 8, 2012
1 parent e0e1665 commit 367d675
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions drivers/block/drbd/drbd_nl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2731,14 +2731,18 @@ int get_one_status(struct sk_buff *skb, struct netlink_callback *cb)
goto out;

if (!mdev) {
/* this is a tconn without a single volume */
/* This is a tconn without a single volume.
* Suprisingly enough, it may have a network
* configuration. */
struct net_conf *nc;
dh->minor = -1U;
dh->ret_code = NO_ERROR;
if (nla_put_drbd_cfg_context(skb, tconn, VOLUME_UNSPECIFIED))
genlmsg_cancel(skb, dh);
else
genlmsg_end(skb, dh);
goto out;
goto cancel;
nc = rcu_dereference(tconn->net_conf);
if (nc && net_conf_to_skb(skb, nc, 1) != 0)
goto cancel;
goto done;
}

D_ASSERT(mdev->vnr == volume);
Expand All @@ -2748,9 +2752,11 @@ int get_one_status(struct sk_buff *skb, struct netlink_callback *cb)
dh->ret_code = NO_ERROR;

if (nla_put_status_info(skb, mdev, NULL)) {
cancel:
genlmsg_cancel(skb, dh);
goto out;
}
done:
genlmsg_end(skb, dh);
}

Expand Down

0 comments on commit 367d675

Please sign in to comment.