Commit ae4c8d37 authored by Lars Ellenberg's avatar Lars Ellenberg Committed by Philipp Reisner

wait for pending after-state-change work and similar before attaching

Otherwise, if we do a very quick detach/attach, and the
after-state-change send_state() of the detach got delayed for some
reason, it may be processed after the new diskless->attaching state
change, probably confusing the peer.

Paranoia fix, not yet observed in real life.
Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent e9df68b6
......@@ -919,6 +919,8 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp
drbd_suspend_io(mdev);
/* also wait for the last barrier ack. */
wait_event(mdev->misc_wait, !atomic_read(&mdev->ap_pending_cnt));
/* and for any other previously queued work */
drbd_flush_workqueue(mdev);
retcode = _drbd_request_state(mdev, NS(disk, D_ATTACHING), CS_VERBOSE);
drbd_resume_io(mdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment