diff options
-rw-r--r-- | include/net/9p/transport.h | 3 | ||||
-rw-r--r-- | net/9p/client.c | 9 | ||||
-rw-r--r-- | net/9p/trans_fd.c | 17 |
3 files changed, 23 insertions, 6 deletions
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h index 9a36d9297114..d9fa68f26c41 100644 --- a/include/net/9p/transport.h +++ b/include/net/9p/transport.h | |||
@@ -40,6 +40,8 @@ | |||
40 | * @close: member function to discard a connection on this transport | 40 | * @close: member function to discard a connection on this transport |
41 | * @request: member function to issue a request to the transport | 41 | * @request: member function to issue a request to the transport |
42 | * @cancel: member function to cancel a request (if it hasn't been sent) | 42 | * @cancel: member function to cancel a request (if it hasn't been sent) |
43 | * @cancelled: member function to notify that a cancelled request will not | ||
44 | * not receive a reply | ||
43 | * | 45 | * |
44 | * This is the basic API for a transport module which is registered by the | 46 | * This is the basic API for a transport module which is registered by the |
45 | * transport module with the 9P core network module and used by the client | 47 | * transport module with the 9P core network module and used by the client |
@@ -58,6 +60,7 @@ struct p9_trans_module { | |||
58 | void (*close) (struct p9_client *); | 60 | void (*close) (struct p9_client *); |
59 | int (*request) (struct p9_client *, struct p9_req_t *req); | 61 | int (*request) (struct p9_client *, struct p9_req_t *req); |
60 | int (*cancel) (struct p9_client *, struct p9_req_t *req); | 62 | int (*cancel) (struct p9_client *, struct p9_req_t *req); |
63 | int (*cancelled)(struct p9_client *, struct p9_req_t *req); | ||
61 | int (*zc_request)(struct p9_client *, struct p9_req_t *, | 64 | int (*zc_request)(struct p9_client *, struct p9_req_t *, |
62 | char *, char *, int , int, int, int); | 65 | char *, char *, int , int, int, int); |
63 | }; | 66 | }; |
diff --git a/net/9p/client.c b/net/9p/client.c index ce26da95f63f..40e558172bbe 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
@@ -663,16 +663,13 @@ static int p9_client_flush(struct p9_client *c, struct p9_req_t *oldreq) | |||
663 | if (IS_ERR(req)) | 663 | if (IS_ERR(req)) |
664 | return PTR_ERR(req); | 664 | return PTR_ERR(req); |
665 | 665 | ||
666 | |||
667 | /* | 666 | /* |
668 | * if we haven't received a response for oldreq, | 667 | * if we haven't received a response for oldreq, |
669 | * remove it from the list | 668 | * remove it from the list |
670 | */ | 669 | */ |
671 | if (oldreq->status == REQ_STATUS_FLSH) { | 670 | if (oldreq->status == REQ_STATUS_FLSH) |
672 | spin_lock(&c->lock); | 671 | if (c->trans_mod->cancelled) |
673 | list_del(&oldreq->req_list); | 672 | c->trans_mod->cancelled(c, oldreq); |
674 | spin_unlock(&c->lock); | ||
675 | } | ||
676 | 673 | ||
677 | p9_free_req(c, req); | 674 | p9_free_req(c, req); |
678 | return 0; | 675 | return 0; |
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index 193efd562466..fda4951c869e 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c | |||
@@ -709,6 +709,20 @@ static int p9_fd_cancel(struct p9_client *client, struct p9_req_t *req) | |||
709 | return ret; | 709 | return ret; |
710 | } | 710 | } |
711 | 711 | ||
712 | static int p9_fd_cancelled(struct p9_client *client, struct p9_req_t *req) | ||
713 | { | ||
714 | p9_debug(P9_DEBUG_TRANS, "client %p req %p\n", client, req); | ||
715 | |||
716 | /* we haven't received a response for oldreq, | ||
717 | * remove it from the list. | ||
718 | */ | ||
719 | spin_lock(&client->lock); | ||
720 | list_del(&req->req_list); | ||
721 | spin_unlock(&client->lock); | ||
722 | |||
723 | return 0; | ||
724 | } | ||
725 | |||
712 | /** | 726 | /** |
713 | * parse_opts - parse mount options into p9_fd_opts structure | 727 | * parse_opts - parse mount options into p9_fd_opts structure |
714 | * @params: options string passed from mount | 728 | * @params: options string passed from mount |
@@ -1050,6 +1064,7 @@ static struct p9_trans_module p9_tcp_trans = { | |||
1050 | .close = p9_fd_close, | 1064 | .close = p9_fd_close, |
1051 | .request = p9_fd_request, | 1065 | .request = p9_fd_request, |
1052 | .cancel = p9_fd_cancel, | 1066 | .cancel = p9_fd_cancel, |
1067 | .cancelled = p9_fd_cancelled, | ||
1053 | .owner = THIS_MODULE, | 1068 | .owner = THIS_MODULE, |
1054 | }; | 1069 | }; |
1055 | 1070 | ||
@@ -1061,6 +1076,7 @@ static struct p9_trans_module p9_unix_trans = { | |||
1061 | .close = p9_fd_close, | 1076 | .close = p9_fd_close, |
1062 | .request = p9_fd_request, | 1077 | .request = p9_fd_request, |
1063 | .cancel = p9_fd_cancel, | 1078 | .cancel = p9_fd_cancel, |
1079 | .cancelled = p9_fd_cancelled, | ||
1064 | .owner = THIS_MODULE, | 1080 | .owner = THIS_MODULE, |
1065 | }; | 1081 | }; |
1066 | 1082 | ||
@@ -1072,6 +1088,7 @@ static struct p9_trans_module p9_fd_trans = { | |||
1072 | .close = p9_fd_close, | 1088 | .close = p9_fd_close, |
1073 | .request = p9_fd_request, | 1089 | .request = p9_fd_request, |
1074 | .cancel = p9_fd_cancel, | 1090 | .cancel = p9_fd_cancel, |
1091 | .cancelled = p9_fd_cancelled, | ||
1075 | .owner = THIS_MODULE, | 1092 | .owner = THIS_MODULE, |
1076 | }; | 1093 | }; |
1077 | 1094 | ||