]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: use a new reply mutex, fixes locks dependency problem
authorYehuda Sadeh <yehuda@hq.newdream.net>
Thu, 23 Oct 2008 18:49:27 +0000 (11:49 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Thu, 23 Oct 2008 18:49:27 +0000 (11:49 -0700)
src/kernel/mds_client.c
src/kernel/mds_client.h

index 1355fc4adc21d0c4faf95aadbb090d0f00583002..6af5cfb24626da2d4a9b4150a34219eeca7a0fa1 100644 (file)
@@ -440,6 +440,7 @@ static struct ceph_mds_request *new_request(struct ceph_msg *msg)
        req->r_request = msg;
        req->r_started = jiffies;
        req->r_resend_mds = -1;
+       mutex_init(&req->r_mutex);
        atomic_set(&req->r_ref, 1);  /* one for request_tree, one for caller */
        init_completion(&req->r_completion);
        return req;
@@ -1213,8 +1214,10 @@ retry:
                wait_for_completion(&req->r_completion);
        }
        mutex_lock(&mdsc->mutex);
+       mutex_lock(&req->r_mutex);
        if (req->r_reply == NULL && !err) {
                put_request_sessions(req);
+               mutex_unlock(&req->r_mutex);
                goto retry;
        }
        if (IS_ERR(req->r_reply)) {
@@ -1225,6 +1228,7 @@ retry:
                /* all is well, reply has been parsed. */
                err = le32_to_cpu(req->r_reply_info.head->result);
 
+       mutex_unlock(&req->r_mutex);
 finish:
        __unregister_request(mdsc, req);
        mutex_unlock(&mdsc->mutex);
@@ -1349,14 +1353,14 @@ done:
        if (took_snap_sem)
                up_write(&mdsc->snap_rwsem);
 
-       mutex_lock(&mdsc->mutex);
+       mutex_lock(&req->r_mutex);
        if (err) {
                req->r_err = err;
        } else {
                req->r_reply = msg;
                ceph_msg_get(msg);
        }
-       mutex_unlock(&mdsc->mutex);
+       mutex_unlock(&req->r_mutex);
 
        mutex_unlock(&req->r_session->s_mutex);
 
index e5a9c4b2e563c78d995e6aefff970da3f53558d8..7cb303aa29b2799fe2962cd62ab28d1ea5608715 100644 (file)
@@ -158,6 +158,7 @@ struct ceph_mds_request {
 
        atomic_t          r_ref;
        struct completion r_completion;
+       struct mutex      r_mutex;
 };
 
 /*