9P: Get rid of REQ_STATUS_FLSH
authorSimon Derr <simon.derr@bull.net>
Mon, 10 Mar 2014 15:38:52 +0000 (16:38 +0100)
committerEric Van Hensbergen <ericvh@gmail.com>
Tue, 25 Mar 2014 21:38:15 +0000 (16:38 -0500)
This request state is mostly useless, and properly implementing it
for RDMA would require an extra lock to be taken in handle_recv()
and in rdma_cancel() to avoid this race:

    handle_recv()           rdma_cancel()
        .                     .
        .                   if req->state == SENT
    req->state = RCVD         .
        .                           req->state = FLSH

So just get rid of it.

Signed-off-by: Simon Derr <simon.derr@bull.net>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
include/net/9p/client.h
net/9p/client.c
net/9p/trans_fd.c

index 115aeac401b187d9016530f3a9d996697d7b4e2a..81790a6fc663afb2daf19bf13bd0a6f830bef364 100644 (file)
@@ -67,7 +67,6 @@ enum p9_trans_status {
  * @REQ_STATUS_ALLOC: request has been allocated but not sent
  * @REQ_STATUS_UNSENT: request waiting to be sent
  * @REQ_STATUS_SENT: request sent to server
- * @REQ_STATUS_FLSH: a flush has been sent for this request
  * @REQ_STATUS_RCVD: response received from server
  * @REQ_STATUS_FLSHD: request has been flushed
  * @REQ_STATUS_ERROR: request encountered an error on the client side
@@ -83,7 +82,6 @@ enum p9_req_status_t {
        REQ_STATUS_ALLOC,
        REQ_STATUS_UNSENT,
        REQ_STATUS_SENT,
-       REQ_STATUS_FLSH,
        REQ_STATUS_RCVD,
        REQ_STATUS_FLSHD,
        REQ_STATUS_ERROR,
index 40e558172bbe9c14ab682eec67c7389eccd1b9f9..0004cbaac4a41d9737e017e257c9083df4969b8a 100644 (file)
@@ -667,7 +667,7 @@ static int p9_client_flush(struct p9_client *c, struct p9_req_t *oldreq)
         * if we haven't received a response for oldreq,
         * remove it from the list
         */
-       if (oldreq->status == REQ_STATUS_FLSH)
+       if (oldreq->status == REQ_STATUS_SENT)
                if (c->trans_mod->cancelled)
                        c->trans_mod->cancelled(c, oldreq);
 
index fda4951c869e88cd4fefa1895a6ed986184d421f..9c806428e91a4130e2386e4005b9e38b4133d028 100644 (file)
@@ -345,8 +345,7 @@ static void p9_read_work(struct work_struct *work)
                         "mux %p pkt: size: %d bytes tag: %d\n", m, n, tag);
 
                m->req = p9_tag_lookup(m->client, tag);
-               if (!m->req || (m->req->status != REQ_STATUS_SENT &&
-                                       m->req->status != REQ_STATUS_FLSH)) {
+               if (!m->req || (m->req->status != REQ_STATUS_SENT)) {
                        p9_debug(P9_DEBUG_ERROR, "Unexpected packet tag %d\n",
                                 tag);
                        err = -EIO;
@@ -701,9 +700,7 @@ static int p9_fd_cancel(struct p9_client *client, struct p9_req_t *req)
                list_del(&req->req_list);
                req->status = REQ_STATUS_FLSHD;
                ret = 0;
-       } else if (req->status == REQ_STATUS_SENT)
-               req->status = REQ_STATUS_FLSH;
-
+       }
        spin_unlock(&client->lock);
 
        return ret;