aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_nl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/drbd/drbd_nl.c')
-rw-r--r--drivers/block/drbd/drbd_nl.c15
1 files changed, 15 insertions, 0 deletions
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