diff options
authorAlex Elder <>2013-05-15 16:28:33 -0500
committerGreg Kroah-Hartman <>2013-06-20 11:58:43 -0700
commitb84a4fc13ba928644833672442d29f6c7dff2622 (patch)
parentd2305b5a32d15d0156115c24adcd8ecfa30209c7 (diff)
libceph: must hold mutex for reset_changed_osds()
commit 14d2f38df67fadee34625fcbd282ee22514c4846 upstream. An osd client has a red-black tree describing its osds, and occasionally we would get crashes due to one of these trees tree becoming corrupt somehow. The problem turned out to be that reset_changed_osds() was being called without protection of the osd client request mutex. That function would call __reset_osd() for any osd that had changed, and __reset_osd() would call __remove_osd() for any osd with no outstanding requests, and finally __remove_osd() would remove the corresponding entry from the red-black tree. Thus, the tree was getting modified without having any lock protection, and was vulnerable to problems due to concurrent updates. This appears to be the only osd tree updating path that has this problem. It can be fairly easily fixed by moving the call up a few lines, to just before the request mutex gets dropped in kick_requests(). This resolves: Signed-off-by: Alex Elder <> Reviewed-by: Sage Weil <> Signed-off-by: Greg Kroah-Hartman <>
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index b16dfa25e75..2e54e57708b 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -1337,13 +1337,13 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend)
__register_request(osdc, req);
__unregister_linger_request(osdc, req);
+ reset_changed_osds(osdc);
if (needmap) {
dout("%d requests for down osds, need new map\n", needmap);
- reset_changed_osds(osdc);