aboutsummaryrefslogtreecommitdiffstats
path: root/net/9p
diff options
context:
space:
mode:
authorSimon Derr <simon.derr@bull.net>2014-03-10 11:38:49 -0400
committerEric Van Hensbergen <ericvh@gmail.com>2014-03-25 17:38:11 -0400
commitafd8d65411551839b7ab14a539d00075b2793451 (patch)
tree0bb73953a08905dbc3ee1071ffeebe11bc6b94d6 /net/9p
parent05a782d416944593ca0268d5718fe4b9cba5ef67 (diff)
9P: Add cancelled() to the transport functions.
And move transport-specific code out of net/9p/client.c Signed-off-by: Simon Derr <simon.derr@bull.net> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net/9p')
-rw-r--r--net/9p/client.c9
-rw-r--r--net/9p/trans_fd.c17
2 files changed, 20 insertions, 6 deletions
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
712static 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