diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2011-03-14 06:54:47 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-05-09 09:10:38 -0400 |
commit | 02ee8f95fadf7c94b3d28df436a095152f6392b2 (patch) | |
tree | 14ae2da3dc302a7f061023d9ed0eab3c790ae458 | |
parent | 5ca1de0384dafe843de10fed843de26de740bca1 (diff) |
drbd: Force flag for the detach operation
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_main.c | 2 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_nl.c | 15 | ||||
-rw-r--r-- | include/linux/drbd_nl.h | 4 |
3 files changed, 19 insertions, 2 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 1b59ab3ab9c7..bc8a8a7556da 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -495,7 +495,7 @@ static int cl_wide_st_chg(struct drbd_conf *mdev, | |||
495 | ((os.role != R_PRIMARY && ns.role == R_PRIMARY) || | 495 | ((os.role != R_PRIMARY && ns.role == R_PRIMARY) || |
496 | (os.conn != C_STARTING_SYNC_T && ns.conn == C_STARTING_SYNC_T) || | 496 | (os.conn != C_STARTING_SYNC_T && ns.conn == C_STARTING_SYNC_T) || |
497 | (os.conn != C_STARTING_SYNC_S && ns.conn == C_STARTING_SYNC_S) || | 497 | (os.conn != C_STARTING_SYNC_S && ns.conn == C_STARTING_SYNC_S) || |
498 | (os.disk != D_DISKLESS && ns.disk == D_DISKLESS))) || | 498 | (os.disk != D_FAILED && ns.disk == D_FAILED))) || |
499 | (os.conn >= C_CONNECTED && ns.conn == C_DISCONNECTING) || | 499 | (os.conn >= C_CONNECTED && ns.conn == C_DISCONNECTING) || |
500 | (os.conn == C_CONNECTED && ns.conn == C_VERIFY_S); | 500 | (os.conn == C_CONNECTED && ns.conn == C_VERIFY_S); |
501 | } | 501 | } |
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index cabad39f908c..6d116a2b2321 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c | |||
@@ -1337,17 +1337,32 @@ static int drbd_nl_detach(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp, | |||
1337 | { | 1337 | { |
1338 | enum drbd_ret_code retcode; | 1338 | enum drbd_ret_code retcode; |
1339 | int ret; | 1339 | int ret; |
1340 | struct detach dt = {}; | ||
1341 | |||
1342 | if (!detach_from_tags(mdev, nlp->tag_list, &dt)) { | ||
1343 | reply->ret_code = ERR_MANDATORY_TAG; | ||
1344 | goto out; | ||
1345 | } | ||
1346 | |||
1347 | if (dt.detach_force) { | ||
1348 | drbd_force_state(mdev, NS(disk, D_FAILED)); | ||
1349 | reply->ret_code = SS_SUCCESS; | ||
1350 | goto out; | ||
1351 | } | ||
1352 | |||
1340 | drbd_suspend_io(mdev); /* so no-one is stuck in drbd_al_begin_io */ | 1353 | drbd_suspend_io(mdev); /* so no-one is stuck in drbd_al_begin_io */ |
1341 | retcode = drbd_request_state(mdev, NS(disk, D_FAILED)); | 1354 | retcode = drbd_request_state(mdev, NS(disk, D_FAILED)); |
1342 | /* D_FAILED will transition to DISKLESS. */ | 1355 | /* D_FAILED will transition to DISKLESS. */ |
1343 | ret = wait_event_interruptible(mdev->misc_wait, | 1356 | ret = wait_event_interruptible(mdev->misc_wait, |
1344 | mdev->state.disk != D_FAILED); | 1357 | mdev->state.disk != D_FAILED); |
1345 | drbd_resume_io(mdev); | 1358 | drbd_resume_io(mdev); |
1359 | |||
1346 | if ((int)retcode == (int)SS_IS_DISKLESS) | 1360 | if ((int)retcode == (int)SS_IS_DISKLESS) |
1347 | retcode = SS_NOTHING_TO_DO; | 1361 | retcode = SS_NOTHING_TO_DO; |
1348 | if (ret) | 1362 | if (ret) |
1349 | retcode = ERR_INTR; | 1363 | retcode = ERR_INTR; |
1350 | reply->ret_code = retcode; | 1364 | reply->ret_code = retcode; |
1365 | out: | ||
1351 | return 0; | 1366 | return 0; |
1352 | } | 1367 | } |
1353 | 1368 | ||
diff --git a/include/linux/drbd_nl.h b/include/linux/drbd_nl.h index ab6159e4fcf0..7203c9ead233 100644 --- a/include/linux/drbd_nl.h +++ b/include/linux/drbd_nl.h | |||
@@ -33,7 +33,9 @@ NL_PACKET(disk_conf, 3, | |||
33 | NL_BIT( 58, T_MAY_IGNORE, no_disk_drain) | 33 | NL_BIT( 58, T_MAY_IGNORE, no_disk_drain) |
34 | ) | 34 | ) |
35 | 35 | ||
36 | NL_PACKET(detach, 4, ) | 36 | NL_PACKET(detach, 4, |
37 | NL_BIT( 88, T_MANDATORY, detach_force) | ||
38 | ) | ||
37 | 39 | ||
38 | NL_PACKET(net_conf, 5, | 40 | NL_PACKET(net_conf, 5, |
39 | NL_STRING( 8, T_MANDATORY, my_addr, 128) | 41 | NL_STRING( 8, T_MANDATORY, my_addr, 128) |