libceph: flush msgr queue during mon_client shutdown
authorSage Weil <sage@inktank.com>
Mon, 11 Jun 2012 03:43:56 +0000 (20:43 -0700)
committerSage Weil <sage@inktank.com>
Fri, 15 Jun 2012 18:26:40 +0000 (11:26 -0700)
We need to flush the msgr workqueue during mon_client shutdown to
ensure that any work affecting our embedded ceph_connection is
finished so that we can be safely destroyed.

Previously, we were flushing the work queue after osd_client
shutdown and before mon_client shutdown to ensure that any osd
connection refs to authorizers are flushed.  Remove the redundant
flush, and document in the comment that the mon_client flush is
needed to cover that case as well.

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Alex Elder <elder@inktank.com>
net/ceph/ceph_common.c
net/ceph/mon_client.c

index 2de3ea1bbd641a2ca4f494bb7d795479f30c748c..c815f31a1a3fc470c97ed1e66fb53a1ec5325043 100644 (file)
@@ -498,13 +498,6 @@ void ceph_destroy_client(struct ceph_client *client)
        /* unmount */
        ceph_osdc_stop(&client->osdc);
 
-       /*
-        * make sure osd connections close out before destroying the
-        * auth module, which is needed to free those connections'
-        * ceph_authorizers.
-        */
-       ceph_msgr_flush();
-
        ceph_monc_stop(&client->monc);
 
        ceph_debugfs_client_cleanup(client);
index 7a16750d62a60460374f59386aae7ee3ad4513bb..dc16595d68850fb09e2814a1235469c3d4e00264 100644 (file)
@@ -838,6 +838,14 @@ void ceph_monc_stop(struct ceph_mon_client *monc)
 
        mutex_unlock(&monc->mutex);
 
+       /*
+        * flush msgr queue before we destroy ourselves to ensure that:
+        *  - any work that references our embedded con is finished.
+        *  - any osd_client or other work that may reference an authorizer
+        *    finishes before we shut down the auth subsystem.
+        */
+       ceph_msgr_flush();
+
        ceph_auth_destroy(monc->auth);
 
        ceph_msg_put(monc->m_auth);