Lines Matching refs:req

278 	struct p9_req_t *req = kmem_cache_alloc(p9_req_cache, GFP_NOFS);
292 if (!req)
295 if (p9_fcall_init(c, &req->tc, alloc_tsize))
297 if (p9_fcall_init(c, &req->rc, alloc_rsize))
300 p9pdu_reset(&req->tc);
301 p9pdu_reset(&req->rc);
302 req->t_err = 0;
303 req->status = REQ_STATUS_ALLOC;
308 refcount_set(&req->refcount, 0);
309 init_waitqueue_head(&req->wq);
310 INIT_LIST_HEAD(&req->req_list);
315 tag = idr_alloc(&c->reqs, req, P9_NOTAG, P9_NOTAG + 1,
318 tag = idr_alloc(&c->reqs, req, 0, P9_NOTAG, GFP_NOWAIT);
319 req->tc.tag = tag;
335 refcount_set(&req->refcount, 2);
337 return req;
340 p9_fcall_fini(&req->tc);
341 p9_fcall_fini(&req->rc);
343 kmem_cache_free(p9_req_cache, req);
357 struct p9_req_t *req;
361 req = idr_find(&c->reqs, tag);
362 if (req) {
363 /* We have to be careful with the req found under rcu_read_lock
368 if (!p9_req_try_get(req))
370 if (req->tc.tag != tag) {
371 p9_req_put(c, req);
377 return req;
393 p9_debug(P9_DEBUG_MUX, "freeing clnt %p req %p tag: %d\n", c, r, tag);
422 struct p9_req_t *req;
426 idr_for_each_entry(&c->reqs, req, id) {
428 if (p9_req_put(c, req) == 0)
430 req->tc.tag);
438 * @req: request received
442 void p9_client_cb(struct p9_client *c, struct p9_req_t *req, int status)
444 p9_debug(P9_DEBUG_MUX, " tag %d\n", req->tc.tag);
446 /* This barrier is needed to make sure any change made to req before
450 WRITE_ONCE(req->status, status);
452 wake_up(&req->wq);
453 p9_debug(P9_DEBUG_MUX, "wakeup: %d\n", req->tc.tag);
454 p9_req_put(c, req);
511 * @req: request to parse and check for error conditions
519 static int p9_check_errors(struct p9_client *c, struct p9_req_t *req)
525 err = p9_parse_header(&req->rc, NULL, &type, NULL, 0);
526 if (req->rc.size > req->rc.capacity && !req->rc.zc) {
528 req->rc.size, req->rc.capacity, req->rc.id);
534 trace_9p_protocol_dump(c, &req->rc);
545 err = p9pdu_readf(&req->rc, c->proto_version, "s?d",
563 err = p9pdu_readf(&req->rc, c->proto_version, "d", &ecode);
596 struct p9_req_t *req;
606 req = p9_client_rpc(c, P9_TFLUSH, "w", oldtag);
607 if (IS_ERR(req))
608 return PTR_ERR(req);
618 p9_req_put(c, req);
627 struct p9_req_t *req;
641 req = p9_tag_alloc(c, type, t_size, r_size, fmt, apc);
643 if (IS_ERR(req))
644 return req;
647 p9pdu_prepare(&req->tc, req->tc.tag, type);
648 err = p9pdu_vwritef(&req->tc, c->proto_version, fmt, ap);
651 p9pdu_finalize(c, &req->tc);
652 trace_9p_client_req(c, type, req->tc.tag);
653 return req;
655 p9_req_put(c, req);
657 p9_req_put(c, req);
676 struct p9_req_t *req;
688 req = p9_client_prepare_req(c, type, tsize, rsize, fmt, ap);
690 if (IS_ERR(req))
691 return req;
693 req->tc.zc = false;
694 req->rc.zc = false;
703 err = c->trans_mod->request(c, req);
706 p9_req_put(c, req);
713 err = wait_event_killable(req->wq,
714 READ_ONCE(req->status) >= REQ_STATUS_RCVD);
716 /* Make sure our req is coherent with regard to updates in other
728 if (READ_ONCE(req->status) == REQ_STATUS_ERROR) {
729 p9_debug(P9_DEBUG_ERROR, "req_status error %d\n", req->t_err);
730 err = req->t_err;
737 if (c->trans_mod->cancel(c, req))
738 p9_client_flush(c, req);
741 if (READ_ONCE(req->status) == REQ_STATUS_RCVD)
753 err = p9_check_errors(c, req);
754 trace_9p_client_res(c, type, req->rc.tag, err);
756 return req;
758 p9_req_put(c, req);
784 struct p9_req_t *req;
790 req = p9_client_prepare_req(c, type, P9_ZC_HDR_SZ, P9_ZC_HDR_SZ, fmt, ap);
792 if (IS_ERR(req))
793 return req;
795 req->tc.zc = true;
796 req->rc.zc = true;
805 err = c->trans_mod->zc_request(c, req, uidata, uodata,
813 if (READ_ONCE(req->status) == REQ_STATUS_ERROR) {
814 p9_debug(P9_DEBUG_ERROR, "req_status error %d\n", req->t_err);
815 err = req->t_err;
822 if (c->trans_mod->cancel(c, req))
823 p9_client_flush(c, req);
826 if (READ_ONCE(req->status) == REQ_STATUS_RCVD)
838 err = p9_check_errors(c, req);
839 trace_9p_client_res(c, type, req->rc.tag, err);
841 return req;
843 p9_req_put(c, req);
910 struct p9_req_t *req;
919 req = p9_client_rpc(c, P9_TVERSION, "ds",
923 req = p9_client_rpc(c, P9_TVERSION, "ds",
927 req = p9_client_rpc(c, P9_TVERSION, "ds",
934 if (IS_ERR(req))
935 return PTR_ERR(req);
937 err = p9pdu_readf(&req->rc, c->proto_version, "ds", &msize, &version);
940 trace_9p_protocol_dump(c, &req->rc);
969 p9_req_put(c, req);
1099 struct p9_req_t *req;
1112 req = p9_client_rpc(clnt, P9_TATTACH, "ddss?u", fid->fid,
1114 if (IS_ERR(req)) {
1115 err = PTR_ERR(req);
1119 err = p9pdu_readf(&req->rc, clnt->proto_version, "Q", &qid);
1121 trace_9p_protocol_dump(clnt, &req->rc);
1122 p9_req_put(clnt, req);
1131 p9_req_put(clnt, req);
1148 struct p9_req_t *req;
1167 req = p9_client_rpc(clnt, P9_TWALK, "ddT", oldfid->fid, fid->fid,
1169 if (IS_ERR(req)) {
1170 err = PTR_ERR(req);
1174 err = p9pdu_readf(&req->rc, clnt->proto_version, "R", &nwqids, &wqids);
1176 trace_9p_protocol_dump(clnt, &req->rc);
1177 p9_req_put(clnt, req);
1180 p9_req_put(clnt, req);
1220 struct p9_req_t *req;
1232 req = p9_client_rpc(clnt, P9_TLOPEN, "dd", fid->fid, mode & P9L_MODE_MASK);
1234 req = p9_client_rpc(clnt, P9_TOPEN, "db", fid->fid, mode & P9L_MODE_MASK);
1235 if (IS_ERR(req)) {
1236 err = PTR_ERR(req);
1240 err = p9pdu_readf(&req->rc, clnt->proto_version, "Qd", &qid, &iounit);
1242 trace_9p_protocol_dump(clnt, &req->rc);
1255 p9_req_put(clnt, req);
1266 struct p9_req_t *req;
1278 req = p9_client_rpc(clnt, P9_TLCREATE, "dsddg", ofid->fid, name, flags,
1280 if (IS_ERR(req)) {
1281 err = PTR_ERR(req);
1285 err = p9pdu_readf(&req->rc, clnt->proto_version, "Qd", qid, &iounit);
1287 trace_9p_protocol_dump(clnt, &req->rc);
1299 p9_req_put(clnt, req);
1310 struct p9_req_t *req;
1321 req = p9_client_rpc(clnt, P9_TCREATE, "dsdb?s", fid->fid, name, perm,
1323 if (IS_ERR(req)) {
1324 err = PTR_ERR(req);
1328 err = p9pdu_readf(&req->rc, clnt->proto_version, "Qd", &qid, &iounit);
1330 trace_9p_protocol_dump(clnt, &req->rc);
1342 p9_req_put(clnt, req);
1353 struct p9_req_t *req;
1359 req = p9_client_rpc(clnt, P9_TSYMLINK, "dssg", dfid->fid, name, symtgt,
1361 if (IS_ERR(req)) {
1362 err = PTR_ERR(req);
1366 err = p9pdu_readf(&req->rc, clnt->proto_version, "Q", qid);
1368 trace_9p_protocol_dump(clnt, &req->rc);
1376 p9_req_put(clnt, req);
1385 struct p9_req_t *req;
1390 req = p9_client_rpc(clnt, P9_TLINK, "dds", dfid->fid, oldfid->fid,
1392 if (IS_ERR(req))
1393 return PTR_ERR(req);
1396 p9_req_put(clnt, req);
1405 struct p9_req_t *req;
1411 req = p9_client_rpc(clnt, P9_TFSYNC, "dd", fid->fid, datasync);
1412 if (IS_ERR(req)) {
1413 err = PTR_ERR(req);
1419 p9_req_put(clnt, req);
1430 struct p9_req_t *req;
1438 req = p9_client_rpc(clnt, P9_TCLUNK, "d", fid->fid);
1439 if (IS_ERR(req)) {
1440 err = PTR_ERR(req);
1446 p9_req_put(clnt, req);
1466 struct p9_req_t *req;
1471 req = p9_client_rpc(clnt, P9_TREMOVE, "d", fid->fid);
1472 if (IS_ERR(req)) {
1473 err = PTR_ERR(req);
1479 p9_req_put(clnt, req);
1492 struct p9_req_t *req;
1499 req = p9_client_rpc(clnt, P9_TUNLINKAT, "dsd", dfid->fid, name, flags);
1500 if (IS_ERR(req)) {
1501 err = PTR_ERR(req);
1506 p9_req_put(clnt, req);
1536 struct p9_req_t *req;
1557 req = p9_client_zc_rpc(clnt, P9_TREAD, to, NULL, rsize,
1562 req = p9_client_rpc(clnt, P9_TREAD, "dqd", fid->fid, offset,
1565 if (IS_ERR(req)) {
1566 *err = PTR_ERR(req);
1572 *err = p9pdu_readf(&req->rc, clnt->proto_version,
1577 trace_9p_protocol_dump(clnt, &req->rc);
1578 p9_req_put(clnt, req);
1593 p9_req_put(clnt, req);
1599 p9_req_put(clnt, req);
1608 struct p9_req_t *req;
1628 req = p9_client_zc_rpc(clnt, P9_TWRITE, NULL, from, 0,
1632 req = p9_client_rpc(clnt, P9_TWRITE, "dqV", fid->fid,
1635 if (IS_ERR(req)) {
1637 *err = PTR_ERR(req);
1641 *err = p9pdu_readf(&req->rc, clnt->proto_version, "d", &written);
1644 trace_9p_protocol_dump(clnt, &req->rc);
1645 p9_req_put(clnt, req);
1655 p9_req_put(clnt, req);
1669 struct p9_req_t *req;
1680 req = p9_client_rpc(clnt, P9_TSTAT, "d", fid->fid);
1681 if (IS_ERR(req)) {
1682 err = PTR_ERR(req);
1686 err = p9pdu_readf(&req->rc, clnt->proto_version, "wS", &ignored, ret);
1688 trace_9p_protocol_dump(clnt, &req->rc);
1689 p9_req_put(clnt, req);
1706 p9_req_put(clnt, req);
1721 struct p9_req_t *req;
1732 req = p9_client_rpc(clnt, P9_TGETATTR, "dq", fid->fid, request_mask);
1733 if (IS_ERR(req)) {
1734 err = PTR_ERR(req);
1738 err = p9pdu_readf(&req->rc, clnt->proto_version, "A", ret);
1740 trace_9p_protocol_dump(clnt, &req->rc);
1741 p9_req_put(clnt, req);
1767 p9_req_put(clnt, req);
1809 struct p9_req_t *req;
1829 req = p9_client_rpc(clnt, P9_TWSTAT, "dwS",
1831 if (IS_ERR(req)) {
1832 err = PTR_ERR(req);
1838 p9_req_put(clnt, req);
1847 struct p9_req_t *req;
1862 req = p9_client_rpc(clnt, P9_TSETATTR, "dI", fid->fid, p9attr);
1864 if (IS_ERR(req)) {
1865 err = PTR_ERR(req);
1869 p9_req_put(clnt, req);
1878 struct p9_req_t *req;
1885 req = p9_client_rpc(clnt, P9_TSTATFS, "d", fid->fid);
1886 if (IS_ERR(req)) {
1887 err = PTR_ERR(req);
1891 err = p9pdu_readf(&req->rc, clnt->proto_version, "ddqqqqqqd", &sb->type,
1895 trace_9p_protocol_dump(clnt, &req->rc);
1896 p9_req_put(clnt, req);
1905 p9_req_put(clnt, req);
1915 struct p9_req_t *req;
1923 req = p9_client_rpc(clnt, P9_TRENAME, "dds", fid->fid,
1925 if (IS_ERR(req)) {
1926 err = PTR_ERR(req);
1932 p9_req_put(clnt, req);
1942 struct p9_req_t *req;
1951 req = p9_client_rpc(clnt, P9_TRENAMEAT, "dsds", olddirfid->fid,
1953 if (IS_ERR(req)) {
1954 err = PTR_ERR(req);
1961 p9_req_put(clnt, req);
1973 struct p9_req_t *req;
1987 req = p9_client_rpc(clnt, P9_TXATTRWALK, "dds",
1989 if (IS_ERR(req)) {
1990 err = PTR_ERR(req);
1993 err = p9pdu_readf(&req->rc, clnt->proto_version, "q", attr_size);
1995 trace_9p_protocol_dump(clnt, &req->rc);
1996 p9_req_put(clnt, req);
1999 p9_req_put(clnt, req);
2018 struct p9_req_t *req;
2025 req = p9_client_rpc(clnt, P9_TXATTRCREATE, "dsqd",
2027 if (IS_ERR(req)) {
2028 err = PTR_ERR(req);
2032 p9_req_put(clnt, req);
2042 struct p9_req_t *req;
2066 req = p9_client_zc_rpc(clnt, P9_TREADDIR, &to, NULL, rsize, 0,
2070 req = p9_client_rpc(clnt, P9_TREADDIR, "dqd", fid->fid,
2073 if (IS_ERR(req)) {
2074 err = PTR_ERR(req);
2078 err = p9pdu_readf(&req->rc, clnt->proto_version, "D", &count, &dataptr);
2080 trace_9p_protocol_dump(clnt, &req->rc);
2093 p9_req_put(clnt, req);
2097 p9_req_put(clnt, req);
2108 struct p9_req_t *req;
2114 req = p9_client_rpc(clnt, P9_TMKNOD, "dsdddg", fid->fid, name, mode,
2116 if (IS_ERR(req))
2117 return PTR_ERR(req);
2119 err = p9pdu_readf(&req->rc, clnt->proto_version, "Q", qid);
2121 trace_9p_protocol_dump(clnt, &req->rc);
2128 p9_req_put(clnt, req);
2138 struct p9_req_t *req;
2143 req = p9_client_rpc(clnt, P9_TMKDIR, "dsdg",
2145 if (IS_ERR(req))
2146 return PTR_ERR(req);
2148 err = p9pdu_readf(&req->rc, clnt->proto_version, "Q", qid);
2150 trace_9p_protocol_dump(clnt, &req->rc);
2157 p9_req_put(clnt, req);
2166 struct p9_req_t *req;
2174 req = p9_client_rpc(clnt, P9_TLOCK, "dbdqqds", fid->fid, flock->type,
2178 if (IS_ERR(req))
2179 return PTR_ERR(req);
2181 err = p9pdu_readf(&req->rc, clnt->proto_version, "b", status);
2183 trace_9p_protocol_dump(clnt, &req->rc);
2188 p9_req_put(clnt, req);
2197 struct p9_req_t *req;
2205 req = p9_client_rpc(clnt, P9_TGETLOCK, "dbqqds", fid->fid,
2209 if (IS_ERR(req))
2210 return PTR_ERR(req);
2212 err = p9pdu_readf(&req->rc, clnt->proto_version, "bqqds", &glock->type,
2216 trace_9p_protocol_dump(clnt, &req->rc);
2224 p9_req_put(clnt, req);
2233 struct p9_req_t *req;
2238 req = p9_client_rpc(clnt, P9_TREADLINK, "d", fid->fid);
2239 if (IS_ERR(req))
2240 return PTR_ERR(req);
2242 err = p9pdu_readf(&req->rc, clnt->proto_version, "s", target);
2244 trace_9p_protocol_dump(clnt, &req->rc);
2249 p9_req_put(clnt, req);