On Thu, 13 Oct 2011, wrote: > kclient will establish only one connection with each osdÿÿbut there is > a mutex in the ceph_connection. > > partial code about con_work > > static void con_work(struct work_struct *work) > { > struct ceph_connection *con = container_of(work, struct ceph_connection, > work.work); > mutex_lock(&con->mutex); > ÿÿÿÿ > if (test_and_clear_bit(SOCK_CLOSED, &con->state) || > try_read(con) < 0 || > try_write(con) < 0) { > mutex_unlock(&con->mutex); > bsdocfs_fault(con); /* error/fault path */ > goto done_unlocked; > } > ÿÿÿÿ > } > > if kclient read data from osdNÿÿcan kclient write data to osdN at the > same timeÿÿ Yes. The messenger code wakes up whenever there is new data queued to send, or new data available on the socket. We only ever read or write as much data as we can without emptying or filling the socket buffer at a time. We never block on network IO, so the mutex is only ever held for very short periods. The model is asynchronous message passing. We have a queue of outgoing messages that we send as quickly as the socket will accept them, and when a complete incoming message is read we process it. sage