aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-02-15 12:42:29 -0500
committerAlex Elder <elder@inktank.com>2013-02-18 13:19:44 -0500
commitf9d251994522fed06f47855b534f21c07ecf7181 (patch)
tree23ecc17b43486c5889306d46adc2718d82754a5a /net
parenta3bea47e8bdd51d921e5b2045720d60140612c7c (diff)
libceph: lock outside send_queued()
Two of the three callers of the osd client's send_queued() function already hold the osd client mutex and drop it before the call. Change send_queued() so it assumes the caller holds the mutex, and update all callers accordingly. Rename it __send_queued() to match the convention used elsewhere in the file with respect to the lock. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'net')
-rw-r--r--net/ceph/osd_client.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index d3e75138506b..edda0704f5a7 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -23,7 +23,7 @@
23 23
24static const struct ceph_connection_operations osd_con_ops; 24static const struct ceph_connection_operations osd_con_ops;
25 25
26static void send_queued(struct ceph_osd_client *osdc); 26static void __send_queued(struct ceph_osd_client *osdc);
27static int __reset_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd); 27static int __reset_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd);
28static void __register_request(struct ceph_osd_client *osdc, 28static void __register_request(struct ceph_osd_client *osdc,
29 struct ceph_osd_request *req); 29 struct ceph_osd_request *req);
@@ -554,8 +554,8 @@ static void osd_reset(struct ceph_connection *con)
554 down_read(&osdc->map_sem); 554 down_read(&osdc->map_sem);
555 mutex_lock(&osdc->request_mutex); 555 mutex_lock(&osdc->request_mutex);
556 __kick_osd_requests(osdc, osd); 556 __kick_osd_requests(osdc, osd);
557 __send_queued(osdc);
557 mutex_unlock(&osdc->request_mutex); 558 mutex_unlock(&osdc->request_mutex);
558 send_queued(osdc);
559 up_read(&osdc->map_sem); 559 up_read(&osdc->map_sem);
560} 560}
561 561
@@ -997,16 +997,13 @@ static void __send_request(struct ceph_osd_client *osdc,
997/* 997/*
998 * Send any requests in the queue (req_unsent). 998 * Send any requests in the queue (req_unsent).
999 */ 999 */
1000static void send_queued(struct ceph_osd_client *osdc) 1000static void __send_queued(struct ceph_osd_client *osdc)
1001{ 1001{
1002 struct ceph_osd_request *req, *tmp; 1002 struct ceph_osd_request *req, *tmp;
1003 1003
1004 dout("send_queued\n"); 1004 dout("__send_queued\n");
1005 mutex_lock(&osdc->request_mutex); 1005 list_for_each_entry_safe(req, tmp, &osdc->req_unsent, r_req_lru_item)
1006 list_for_each_entry_safe(req, tmp, &osdc->req_unsent, r_req_lru_item) {
1007 __send_request(osdc, req); 1006 __send_request(osdc, req);
1008 }
1009 mutex_unlock(&osdc->request_mutex);
1010} 1007}
1011 1008
1012/* 1009/*
@@ -1058,8 +1055,8 @@ static void handle_timeout(struct work_struct *work)
1058 } 1055 }
1059 1056
1060 __schedule_osd_timeout(osdc); 1057 __schedule_osd_timeout(osdc);
1058 __send_queued(osdc);
1061 mutex_unlock(&osdc->request_mutex); 1059 mutex_unlock(&osdc->request_mutex);
1062 send_queued(osdc);
1063 up_read(&osdc->map_sem); 1060 up_read(&osdc->map_sem);
1064} 1061}
1065 1062
@@ -1397,7 +1394,9 @@ done:
1397 if (ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_FULL)) 1394 if (ceph_osdmap_flag(osdc->osdmap, CEPH_OSDMAP_FULL))
1398 ceph_monc_request_next_osdmap(&osdc->client->monc); 1395 ceph_monc_request_next_osdmap(&osdc->client->monc);
1399 1396
1400 send_queued(osdc); 1397 mutex_lock(&osdc->request_mutex);
1398 __send_queued(osdc);
1399 mutex_unlock(&osdc->request_mutex);
1401 up_read(&osdc->map_sem); 1400 up_read(&osdc->map_sem);
1402 wake_up_all(&osdc->client->auth_wq); 1401 wake_up_all(&osdc->client->auth_wq);
1403 return; 1402 return;