diff options
author | Ilya Dryomov <ilya.dryomov@inktank.com> | 2014-06-24 08:21:45 -0400 |
---|---|---|
committer | Ilya Dryomov <ilya.dryomov@inktank.com> | 2014-07-08 07:08:46 -0400 |
commit | 37ab77ac29b5bdec029a66f6d6eb4756679c7e12 (patch) | |
tree | d15583728ccf00d4df97dd937de6460038882a6d /net/ceph | |
parent | 2d05f082cbc73b837011225b165d64d25b47c940 (diff) |
libceph: drop osd ref when canceling con work
queue_con() bumps osd ref count. We should do the reverse when
canceling con work.
Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Diffstat (limited to 'net/ceph')
-rw-r--r-- | net/ceph/messenger.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 8bffa5b90fef..e51cad0db580 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -174,6 +174,7 @@ static struct lock_class_key socket_class; | |||
174 | #define SKIP_BUF_SIZE 1024 | 174 | #define SKIP_BUF_SIZE 1024 |
175 | 175 | ||
176 | static void queue_con(struct ceph_connection *con); | 176 | static void queue_con(struct ceph_connection *con); |
177 | static void cancel_con(struct ceph_connection *con); | ||
177 | static void con_work(struct work_struct *); | 178 | static void con_work(struct work_struct *); |
178 | static void con_fault(struct ceph_connection *con); | 179 | static void con_fault(struct ceph_connection *con); |
179 | 180 | ||
@@ -680,7 +681,7 @@ void ceph_con_close(struct ceph_connection *con) | |||
680 | 681 | ||
681 | reset_connection(con); | 682 | reset_connection(con); |
682 | con->peer_global_seq = 0; | 683 | con->peer_global_seq = 0; |
683 | cancel_delayed_work(&con->work); | 684 | cancel_con(con); |
684 | con_close_socket(con); | 685 | con_close_socket(con); |
685 | mutex_unlock(&con->mutex); | 686 | mutex_unlock(&con->mutex); |
686 | } | 687 | } |
@@ -2667,19 +2668,16 @@ static int queue_con_delay(struct ceph_connection *con, unsigned long delay) | |||
2667 | { | 2668 | { |
2668 | if (!con->ops->get(con)) { | 2669 | if (!con->ops->get(con)) { |
2669 | dout("%s %p ref count 0\n", __func__, con); | 2670 | dout("%s %p ref count 0\n", __func__, con); |
2670 | |||
2671 | return -ENOENT; | 2671 | return -ENOENT; |
2672 | } | 2672 | } |
2673 | 2673 | ||
2674 | if (!queue_delayed_work(ceph_msgr_wq, &con->work, delay)) { | 2674 | if (!queue_delayed_work(ceph_msgr_wq, &con->work, delay)) { |
2675 | dout("%s %p - already queued\n", __func__, con); | 2675 | dout("%s %p - already queued\n", __func__, con); |
2676 | con->ops->put(con); | 2676 | con->ops->put(con); |
2677 | |||
2678 | return -EBUSY; | 2677 | return -EBUSY; |
2679 | } | 2678 | } |
2680 | 2679 | ||
2681 | dout("%s %p %lu\n", __func__, con, delay); | 2680 | dout("%s %p %lu\n", __func__, con, delay); |
2682 | |||
2683 | return 0; | 2681 | return 0; |
2684 | } | 2682 | } |
2685 | 2683 | ||
@@ -2688,6 +2686,14 @@ static void queue_con(struct ceph_connection *con) | |||
2688 | (void) queue_con_delay(con, 0); | 2686 | (void) queue_con_delay(con, 0); |
2689 | } | 2687 | } |
2690 | 2688 | ||
2689 | static void cancel_con(struct ceph_connection *con) | ||
2690 | { | ||
2691 | if (cancel_delayed_work(&con->work)) { | ||
2692 | dout("%s %p\n", __func__, con); | ||
2693 | con->ops->put(con); | ||
2694 | } | ||
2695 | } | ||
2696 | |||
2691 | static bool con_sock_closed(struct ceph_connection *con) | 2697 | static bool con_sock_closed(struct ceph_connection *con) |
2692 | { | 2698 | { |
2693 | if (!con_flag_test_and_clear(con, CON_FLAG_SOCK_CLOSED)) | 2699 | if (!con_flag_test_and_clear(con, CON_FLAG_SOCK_CLOSED)) |