aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2010-12-03 09:22:48 -0500
committerPhilipp Reisner <philipp.reisner@linbit.com>2011-03-10 05:35:17 -0500
commit2561b9c1f1d63077c41903fc6ad58dc9ec47248b (patch)
tree79f4148dce59a9f696e680d70151312721f296cf
parent42ff269d1022a86be4f526cf674998c47b7ab856 (diff)
drbd: --force option for disconnect
As the network connection can be lost at any time, a --force option for disconnect is just a matter of completeness. 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_nl.c15
-rw-r--r--include/linux/drbd_nl.h4
2 files changed, 18 insertions, 1 deletions
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 6a6dde6c51c6..cd0459f0403f 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -1531,6 +1531,21 @@ static int drbd_nl_disconnect(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nl
1531 struct drbd_nl_cfg_reply *reply) 1531 struct drbd_nl_cfg_reply *reply)
1532{ 1532{
1533 int retcode; 1533 int retcode;
1534 struct disconnect dc;
1535
1536 memset(&dc, 0, sizeof(struct disconnect));
1537 if (!disconnect_from_tags(mdev, nlp->tag_list, &dc)) {
1538 retcode = ERR_MANDATORY_TAG;
1539 goto fail;
1540 }
1541
1542 if (dc.force) {
1543 spin_lock_irq(&mdev->req_lock);
1544 if (mdev->state.conn >= C_WF_CONNECTION)
1545 _drbd_set_state(_NS(mdev, conn, C_DISCONNECTING), CS_HARD, NULL);
1546 spin_unlock_irq(&mdev->req_lock);
1547 goto done;
1548 }
1534 1549
1535 retcode = _drbd_request_state(mdev, NS(conn, C_DISCONNECTING), CS_ORDERED); 1550 retcode = _drbd_request_state(mdev, NS(conn, C_DISCONNECTING), CS_ORDERED);
1536 1551
diff --git a/include/linux/drbd_nl.h b/include/linux/drbd_nl.h
index 6fc614b06c4d..ab6159e4fcf0 100644
--- a/include/linux/drbd_nl.h
+++ b/include/linux/drbd_nl.h
@@ -69,7 +69,9 @@ NL_PACKET(net_conf, 5,
69 NL_BIT( 70, T_MANDATORY, dry_run) 69 NL_BIT( 70, T_MANDATORY, dry_run)
70) 70)
71 71
72NL_PACKET(disconnect, 6, ) 72NL_PACKET(disconnect, 6,
73 NL_BIT( 84, T_MAY_IGNORE, force)
74)
73 75
74NL_PACKET(resize, 7, 76NL_PACKET(resize, 7,
75 NL_INT64( 29, T_MAY_IGNORE, resize_size) 77 NL_INT64( 29, T_MAY_IGNORE, resize_size)