ceph: make sure mdsc->mutex is nested in s->s_mutex to fix dead lock
[platform/kernel/linux-rpi.git] / fs / ceph / mds_client.c
index 6c283c5..0e0ab01 100644 (file)
@@ -3769,8 +3769,6 @@ fail:
  * recovering MDS might have.
  *
  * This is a relatively heavyweight operation, but it's rare.
- *
- * called with mdsc->mutex held.
  */
 static void send_mds_reconnect(struct ceph_mds_client *mdsc,
                               struct ceph_mds_session *session)
@@ -4024,7 +4022,9 @@ static void check_new_map(struct ceph_mds_client *mdsc,
                            oldstate != CEPH_MDS_STATE_STARTING)
                                pr_info("mds%d recovery completed\n", s->s_mds);
                        kick_requests(mdsc, i);
+                       mutex_unlock(&mdsc->mutex);
                        mutex_lock(&s->s_mutex);
+                       mutex_lock(&mdsc->mutex);
                        ceph_kick_flushing_caps(mdsc, s);
                        mutex_unlock(&s->s_mutex);
                        wake_up_session_caps(s, RECONNECT);