@@ -453,7 +453,8 @@ nvme_tcp_fetch_request(struct nvme_tcp_queue *queue)
453453 return NULL ;
454454 }
455455
456- list_del (& req -> entry );
456+ list_del_init (& req -> entry );
457+ init_llist_node (& req -> lentry );
457458 return req ;
458459}
459460
@@ -561,6 +562,8 @@ static int nvme_tcp_init_request(struct blk_mq_tag_set *set,
561562 req -> queue = queue ;
562563 nvme_req (rq )-> ctrl = & ctrl -> ctrl ;
563564 nvme_req (rq )-> cmd = & pdu -> cmd ;
565+ init_llist_node (& req -> lentry );
566+ INIT_LIST_HEAD (& req -> entry );
564567
565568 return 0 ;
566569}
@@ -765,6 +768,14 @@ static int nvme_tcp_handle_r2t(struct nvme_tcp_queue *queue,
765768 return - EPROTO ;
766769 }
767770
771+ if (llist_on_list (& req -> lentry ) ||
772+ !list_empty (& req -> entry )) {
773+ dev_err (queue -> ctrl -> ctrl .device ,
774+ "req %d unexpected r2t while processing request\n" ,
775+ rq -> tag );
776+ return - EPROTO ;
777+ }
778+
768779 req -> pdu_len = 0 ;
769780 req -> h2cdata_left = r2t_length ;
770781 req -> h2cdata_offset = r2t_offset ;
@@ -2583,6 +2594,8 @@ static void nvme_tcp_submit_async_event(struct nvme_ctrl *arg)
25832594 ctrl -> async_req .offset = 0 ;
25842595 ctrl -> async_req .curr_bio = NULL ;
25852596 ctrl -> async_req .data_len = 0 ;
2597+ init_llist_node (& ctrl -> async_req .lentry );
2598+ INIT_LIST_HEAD (& ctrl -> async_req .entry );
25862599
25872600 nvme_tcp_queue_request (& ctrl -> async_req , true, true);
25882601}
0 commit comments