Lines Matching refs:rqstp
567 svc_init_buffer(struct svc_rqst *rqstp, unsigned int size, int node) in svc_init_buffer() argument
572 if (svc_is_backchannel(rqstp)) in svc_init_buffer()
586 rqstp->rq_pages[arghi++] = p; in svc_init_buffer()
596 svc_release_buffer(struct svc_rqst *rqstp) in svc_release_buffer() argument
600 for (i = 0; i < ARRAY_SIZE(rqstp->rq_pages); i++) in svc_release_buffer()
601 if (rqstp->rq_pages[i]) in svc_release_buffer()
602 put_page(rqstp->rq_pages[i]); in svc_release_buffer()
608 struct svc_rqst *rqstp; in svc_rqst_alloc() local
610 rqstp = kzalloc_node(sizeof(*rqstp), GFP_KERNEL, node); in svc_rqst_alloc()
611 if (!rqstp) in svc_rqst_alloc()
612 return rqstp; in svc_rqst_alloc()
614 __set_bit(RQ_BUSY, &rqstp->rq_flags); in svc_rqst_alloc()
615 spin_lock_init(&rqstp->rq_lock); in svc_rqst_alloc()
616 rqstp->rq_server = serv; in svc_rqst_alloc()
617 rqstp->rq_pool = pool; in svc_rqst_alloc()
619 rqstp->rq_scratch_page = alloc_pages_node(node, GFP_KERNEL, 0); in svc_rqst_alloc()
620 if (!rqstp->rq_scratch_page) in svc_rqst_alloc()
623 rqstp->rq_argp = kmalloc_node(serv->sv_xdrsize, GFP_KERNEL, node); in svc_rqst_alloc()
624 if (!rqstp->rq_argp) in svc_rqst_alloc()
627 rqstp->rq_resp = kmalloc_node(serv->sv_xdrsize, GFP_KERNEL, node); in svc_rqst_alloc()
628 if (!rqstp->rq_resp) in svc_rqst_alloc()
631 if (!svc_init_buffer(rqstp, serv->sv_max_mesg, node)) in svc_rqst_alloc()
634 return rqstp; in svc_rqst_alloc()
636 svc_rqst_free(rqstp); in svc_rqst_alloc()
644 struct svc_rqst *rqstp; in svc_prepare_thread() local
646 rqstp = svc_rqst_alloc(serv, pool, node); in svc_prepare_thread()
647 if (!rqstp) in svc_prepare_thread()
653 list_add_rcu(&rqstp->rq_all, &pool->sp_all_threads); in svc_prepare_thread()
655 return rqstp; in svc_prepare_thread()
696 struct svc_rqst *rqstp; in choose_victim() local
702 rqstp = list_entry(pool->sp_all_threads.next, struct svc_rqst, rq_all); in choose_victim()
703 set_bit(RQ_VICTIM, &rqstp->rq_flags); in choose_victim()
704 list_del_rcu(&rqstp->rq_all); in choose_victim()
705 task = rqstp->rq_task; in choose_victim()
716 struct svc_rqst *rqstp; in svc_start_kthreads() local
727 rqstp = svc_prepare_thread(serv, chosen_pool, node); in svc_start_kthreads()
728 if (IS_ERR(rqstp)) in svc_start_kthreads()
729 return PTR_ERR(rqstp); in svc_start_kthreads()
732 task = kthread_create_on_node(serv->sv_ops->svo_function, rqstp, in svc_start_kthreads()
736 svc_exit_thread(rqstp); in svc_start_kthreads()
740 rqstp->rq_task = task; in svc_start_kthreads()
809 struct svc_rqst *rqstp; in svc_stop_kthreads() local
818 rqstp = kthread_data(task); in svc_stop_kthreads()
821 svc_exit_thread(rqstp); in svc_stop_kthreads()
855 void svc_rqst_replace_page(struct svc_rqst *rqstp, struct page *page) in svc_rqst_replace_page() argument
857 if (*rqstp->rq_next_page) { in svc_rqst_replace_page()
858 if (!pagevec_space(&rqstp->rq_pvec)) in svc_rqst_replace_page()
859 __pagevec_release(&rqstp->rq_pvec); in svc_rqst_replace_page()
860 pagevec_add(&rqstp->rq_pvec, *rqstp->rq_next_page); in svc_rqst_replace_page()
864 *(rqstp->rq_next_page++) = page; in svc_rqst_replace_page()
873 svc_rqst_free(struct svc_rqst *rqstp) in svc_rqst_free() argument
875 svc_release_buffer(rqstp); in svc_rqst_free()
876 if (rqstp->rq_scratch_page) in svc_rqst_free()
877 put_page(rqstp->rq_scratch_page); in svc_rqst_free()
878 kfree(rqstp->rq_resp); in svc_rqst_free()
879 kfree(rqstp->rq_argp); in svc_rqst_free()
880 kfree(rqstp->rq_auth_data); in svc_rqst_free()
881 kfree_rcu(rqstp, rq_rcu_head); in svc_rqst_free()
886 svc_exit_thread(struct svc_rqst *rqstp) in svc_exit_thread() argument
888 struct svc_serv *serv = rqstp->rq_server; in svc_exit_thread()
889 struct svc_pool *pool = rqstp->rq_pool; in svc_exit_thread()
893 if (!test_and_set_bit(RQ_VICTIM, &rqstp->rq_flags)) in svc_exit_thread()
894 list_del_rcu(&rqstp->rq_all); in svc_exit_thread()
897 svc_rqst_free(rqstp); in svc_exit_thread()
1174 void svc_printk(struct svc_rqst *rqstp, const char *fmt, ...) in svc_printk() argument
1185 dprintk("svc: %s: %pV", svc_print_addr(rqstp, buf, sizeof(buf)), &vaf); in svc_printk()
1190 static __printf(2,3) void svc_printk(struct svc_rqst *rqstp, const char *fmt, ...) {} in svc_printk() argument
1194 svc_generic_dispatch(struct svc_rqst *rqstp, __be32 *statp) in svc_generic_dispatch() argument
1196 struct kvec *argv = &rqstp->rq_arg.head[0]; in svc_generic_dispatch()
1197 struct kvec *resv = &rqstp->rq_res.head[0]; in svc_generic_dispatch()
1198 const struct svc_procedure *procp = rqstp->rq_procinfo; in svc_generic_dispatch()
1205 !procp->pc_decode(rqstp, argv->iov_base)) { in svc_generic_dispatch()
1210 *statp = procp->pc_func(rqstp); in svc_generic_dispatch()
1213 test_bit(RQ_DROPME, &rqstp->rq_flags)) in svc_generic_dispatch()
1216 if (rqstp->rq_auth_stat != rpc_auth_ok) in svc_generic_dispatch()
1224 !procp->pc_encode(rqstp, resv->iov_base + resv->iov_len)) { in svc_generic_dispatch()
1233 svc_generic_init_request(struct svc_rqst *rqstp, in svc_generic_init_request() argument
1240 if (rqstp->rq_vers >= progp->pg_nvers ) in svc_generic_init_request()
1242 versp = progp->pg_vers[rqstp->rq_vers]; in svc_generic_init_request()
1257 if (versp->vs_need_cong_ctrl && rqstp->rq_xprt && in svc_generic_init_request()
1258 !test_bit(XPT_CONG_CTRL, &rqstp->rq_xprt->xpt_flags)) in svc_generic_init_request()
1261 if (rqstp->rq_proc >= versp->vs_nproc) in svc_generic_init_request()
1263 rqstp->rq_procinfo = procp = &versp->vs_proc[rqstp->rq_proc]; in svc_generic_init_request()
1268 memset(rqstp->rq_argp, 0, procp->pc_argsize); in svc_generic_init_request()
1269 memset(rqstp->rq_resp, 0, procp->pc_ressize); in svc_generic_init_request()
1272 versp->vs_count[rqstp->rq_proc]++; in svc_generic_init_request()
1289 svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv) in svc_process_common() argument
1293 struct svc_serv *serv = rqstp->rq_server; in svc_process_common()
1307 set_bit(RQ_SPLICE_OK, &rqstp->rq_flags); in svc_process_common()
1309 set_bit(RQ_USEDEFERRAL, &rqstp->rq_flags); in svc_process_common()
1310 clear_bit(RQ_DROPME, &rqstp->rq_flags); in svc_process_common()
1312 svc_putu32(resv, rqstp->rq_xid); in svc_process_common()
1327 rqstp->rq_prog = prog = svc_getnl(argv); /* program number */ in svc_process_common()
1328 rqstp->rq_vers = svc_getnl(argv); /* version number */ in svc_process_common()
1329 rqstp->rq_proc = svc_getnl(argv); /* procedure number */ in svc_process_common()
1340 auth_res = svc_authenticate(rqstp); in svc_process_common()
1343 auth_res = progp->pg_authenticate(rqstp); in svc_process_common()
1345 trace_svc_authenticate(rqstp, auth_res); in svc_process_common()
1367 rpc_stat = progp->pg_init_request(rqstp, progp, &process); in svc_process_common()
1379 procp = rqstp->rq_procinfo; in svc_process_common()
1386 trace_svc_process(rqstp, progp->pg_name); in svc_process_common()
1396 svc_reserve_auth(rqstp, procp->pc_xdrressize<<2); in svc_process_common()
1400 if (!svc_generic_dispatch(rqstp, statp)) in svc_process_common()
1406 if (!process.dispatch(rqstp, statp)) in svc_process_common()
1410 if (rqstp->rq_auth_stat != rpc_auth_ok) in svc_process_common()
1419 procp->pc_release(rqstp); in svc_process_common()
1425 if (svc_authorise(rqstp)) in svc_process_common()
1431 procp->pc_release(rqstp); in svc_process_common()
1433 svc_authorise(rqstp); /* doesn't hurt to call this twice */ in svc_process_common()
1438 svc_authorise(rqstp); in svc_process_common()
1440 if (rqstp->rq_xprt && test_bit(XPT_TEMP, &rqstp->rq_xprt->xpt_flags)) in svc_process_common()
1441 svc_close_xprt(rqstp->rq_xprt); in svc_process_common()
1446 svc_printk(rqstp, "short len %zd, dropping request\n", in svc_process_common()
1460 procp->pc_release(rqstp); in svc_process_common()
1463 be32_to_cpu(rqstp->rq_auth_stat)); in svc_process_common()
1466 xdr_ressize_check(rqstp, reply_statp); in svc_process_common()
1469 svc_putu32(resv, rqstp->rq_auth_stat); /* status */ in svc_process_common()
1479 svc_printk(rqstp, "unknown version (%d for prog %d, %s)\n", in svc_process_common()
1480 rqstp->rq_vers, rqstp->rq_prog, progp->pg_name); in svc_process_common()
1489 svc_printk(rqstp, "unknown procedure (%d)\n", rqstp->rq_proc); in svc_process_common()
1496 svc_printk(rqstp, "failed to decode args\n"); in svc_process_common()
1509 svc_process(struct svc_rqst *rqstp) in svc_process() argument
1511 struct kvec *argv = &rqstp->rq_arg.head[0]; in svc_process()
1512 struct kvec *resv = &rqstp->rq_res.head[0]; in svc_process()
1513 struct svc_serv *serv = rqstp->rq_server; in svc_process()
1519 svc_xprt_deferred_close(rqstp->rq_xprt); in svc_process()
1526 rqstp->rq_next_page = &rqstp->rq_respages[1]; in svc_process()
1527 resv->iov_base = page_address(rqstp->rq_respages[0]); in svc_process()
1529 rqstp->rq_res.pages = rqstp->rq_respages + 1; in svc_process()
1530 rqstp->rq_res.len = 0; in svc_process()
1531 rqstp->rq_res.page_base = 0; in svc_process()
1532 rqstp->rq_res.page_len = 0; in svc_process()
1533 rqstp->rq_res.buflen = PAGE_SIZE; in svc_process()
1534 rqstp->rq_res.tail[0].iov_base = NULL; in svc_process()
1535 rqstp->rq_res.tail[0].iov_len = 0; in svc_process()
1540 svc_printk(rqstp, "bad direction %d, dropping request\n", dir); in svc_process()
1546 if (likely(svc_process_common(rqstp, argv, resv))) in svc_process()
1547 return svc_send(rqstp); in svc_process()
1550 svc_drop(rqstp); in svc_process()
1562 struct svc_rqst *rqstp) in bc_svc_process() argument
1564 struct kvec *argv = &rqstp->rq_arg.head[0]; in bc_svc_process()
1565 struct kvec *resv = &rqstp->rq_res.head[0]; in bc_svc_process()
1573 rqstp->rq_xid = req->rq_xid; in bc_svc_process()
1574 rqstp->rq_prot = req->rq_xprt->prot; in bc_svc_process()
1575 rqstp->rq_server = serv; in bc_svc_process()
1576 rqstp->rq_bc_net = req->rq_xprt->xprt_net; in bc_svc_process()
1578 rqstp->rq_addrlen = sizeof(req->rq_xprt->addr); in bc_svc_process()
1579 memcpy(&rqstp->rq_addr, &req->rq_xprt->addr, rqstp->rq_addrlen); in bc_svc_process()
1580 memcpy(&rqstp->rq_arg, &req->rq_rcv_buf, sizeof(rqstp->rq_arg)); in bc_svc_process()
1581 memcpy(&rqstp->rq_res, &req->rq_snd_buf, sizeof(rqstp->rq_res)); in bc_svc_process()
1584 rqstp->rq_arg.len = req->rq_private_buf.len; in bc_svc_process()
1585 if (rqstp->rq_arg.len <= rqstp->rq_arg.head[0].iov_len) { in bc_svc_process()
1586 rqstp->rq_arg.head[0].iov_len = rqstp->rq_arg.len; in bc_svc_process()
1587 rqstp->rq_arg.page_len = 0; in bc_svc_process()
1588 } else if (rqstp->rq_arg.len <= rqstp->rq_arg.head[0].iov_len + in bc_svc_process()
1589 rqstp->rq_arg.page_len) in bc_svc_process()
1590 rqstp->rq_arg.page_len = rqstp->rq_arg.len - in bc_svc_process()
1591 rqstp->rq_arg.head[0].iov_len; in bc_svc_process()
1593 rqstp->rq_arg.len = rqstp->rq_arg.head[0].iov_len + in bc_svc_process()
1594 rqstp->rq_arg.page_len; in bc_svc_process()
1607 proc_error = svc_process_common(rqstp, argv, resv); in bc_svc_process()
1617 memcpy(&req->rq_snd_buf, &rqstp->rq_res, sizeof(req->rq_snd_buf)); in bc_svc_process()
1638 u32 svc_max_payload(const struct svc_rqst *rqstp) in svc_max_payload() argument
1640 u32 max = rqstp->rq_xprt->xpt_class->xcl_max_payload; in svc_max_payload()
1642 if (rqstp->rq_server->sv_max_payload < max) in svc_max_payload()
1643 max = rqstp->rq_server->sv_max_payload; in svc_max_payload()
1655 const char *svc_proc_name(const struct svc_rqst *rqstp) in svc_proc_name() argument
1657 if (rqstp && rqstp->rq_procinfo) in svc_proc_name()
1658 return rqstp->rq_procinfo->pc_name; in svc_proc_name()
1672 int svc_encode_result_payload(struct svc_rqst *rqstp, unsigned int offset, in svc_encode_result_payload() argument
1675 return rqstp->rq_xprt->xpt_ops->xpo_result_payload(rqstp, offset, in svc_encode_result_payload()
1687 unsigned int svc_fill_write_vector(struct svc_rqst *rqstp, in svc_fill_write_vector() argument
1692 struct kvec *vec = rqstp->rq_vec; in svc_fill_write_vector()
1715 WARN_ON_ONCE(i > ARRAY_SIZE(rqstp->rq_vec)); in svc_fill_write_vector()
1731 char *svc_fill_symlink_pathname(struct svc_rqst *rqstp, struct kvec *first, in svc_fill_symlink_pathname() argument