aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/drbd/drbd_main.c2
-rw-r--r--drivers/block/drbd/drbd_nl.c15
2 files changed, 16 insertions, 1 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;
1365out:
1351 return 0; 1366 return 0;
1352} 1367}
1353 1368