diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2010-06-23 05:20:05 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2010-10-14 09:04:46 -0400 |
commit | 84dfb9f564208a0331131d1ab922382c7d61a553 (patch) | |
tree | 1506d6c318afa4a94b13bab6af983031eac5e3cd /drivers/block/drbd | |
parent | 65d922c33ebd359db25d5846929b2eafc4238fcc (diff) |
drbd: Fixed a deadlock, probably only affected UP machines
After disconnect (most likely mdev->net_cnt == 0) and we are
still in an unstable state (!drbd_state_is_stable()). When we
get an IO request in drbd_get_max_buffers() (called from
__inc_ap_bio_cond(), called from inc_ap_bio()) we wake up
misc_wait. Misc_wait is also used in inc_ap_bio() to sleep
until the outcome of __inc_ap_bio_cond() changes. => Busy loop!
Solution: Have a dedicated wait queue for get_net_conf() and
put_net_conf().
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd')
-rw-r--r-- | drivers/block/drbd/drbd_int.h | 3 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 1 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 2 |
3 files changed, 4 insertions, 2 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index e0e08f5e0a76..aa9bb213fe70 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -947,6 +947,7 @@ struct drbd_conf { | |||
947 | union drbd_state state; | 947 | union drbd_state state; |
948 | wait_queue_head_t misc_wait; | 948 | wait_queue_head_t misc_wait; |
949 | wait_queue_head_t state_wait; /* upon each state change. */ | 949 | wait_queue_head_t state_wait; /* upon each state change. */ |
950 | wait_queue_head_t net_cnt_wait; | ||
950 | unsigned int send_cnt; | 951 | unsigned int send_cnt; |
951 | unsigned int recv_cnt; | 952 | unsigned int recv_cnt; |
952 | unsigned int read_cnt; | 953 | unsigned int read_cnt; |
@@ -2018,7 +2019,7 @@ static inline void inc_unacked(struct drbd_conf *mdev) | |||
2018 | static inline void put_net_conf(struct drbd_conf *mdev) | 2019 | static inline void put_net_conf(struct drbd_conf *mdev) |
2019 | { | 2020 | { |
2020 | if (atomic_dec_and_test(&mdev->net_cnt)) | 2021 | if (atomic_dec_and_test(&mdev->net_cnt)) |
2021 | wake_up(&mdev->misc_wait); | 2022 | wake_up(&mdev->net_cnt_wait); |
2022 | } | 2023 | } |
2023 | 2024 | ||
2024 | /** | 2025 | /** |
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 440b1d5dcfe2..9fe9bdd9e33d 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -2763,6 +2763,7 @@ void drbd_init_set_defaults(struct drbd_conf *mdev) | |||
2763 | 2763 | ||
2764 | init_waitqueue_head(&mdev->misc_wait); | 2764 | init_waitqueue_head(&mdev->misc_wait); |
2765 | init_waitqueue_head(&mdev->state_wait); | 2765 | init_waitqueue_head(&mdev->state_wait); |
2766 | init_waitqueue_head(&mdev->net_cnt_wait); | ||
2766 | init_waitqueue_head(&mdev->ee_wait); | 2767 | init_waitqueue_head(&mdev->ee_wait); |
2767 | init_waitqueue_head(&mdev->al_wait); | 2768 | init_waitqueue_head(&mdev->al_wait); |
2768 | init_waitqueue_head(&mdev->seq_wait); | 2769 | init_waitqueue_head(&mdev->seq_wait); |
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 224c79ed16e9..22d74d79ba42 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -3775,7 +3775,7 @@ static void drbd_disconnect(struct drbd_conf *mdev) | |||
3775 | 3775 | ||
3776 | if (os.conn == C_DISCONNECTING) { | 3776 | if (os.conn == C_DISCONNECTING) { |
3777 | struct hlist_head *h; | 3777 | struct hlist_head *h; |
3778 | wait_event(mdev->misc_wait, atomic_read(&mdev->net_cnt) == 0); | 3778 | wait_event(mdev->net_cnt_wait, atomic_read(&mdev->net_cnt) == 0); |
3779 | 3779 | ||
3780 | /* we must not free the tl_hash | 3780 | /* we must not free the tl_hash |
3781 | * while application io is still on the fly */ | 3781 | * while application io is still on the fly */ |