Re: [PATCH 07/17] nvme-tcp: allocate socket file

Hannes Reinecke
2023-08-11T10:32:17Z

On 8/11/23 12:19, Simon Horman wrote:
> On Thu, Aug 10, 2023 at 05:06:20PM +0200, Hannes Reinecke wrote:
>> When using the TLS upcall we need to allocate a socket file such
>> that the userspace daemon is able to use the socket.
>>
>> Signed-off-by: Hannes Reinecke <hare@suse.de>
>> Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
>
> ...
>
>> @@ -1512,6 +1514,7 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid)
>> struct nvme_tcp_ctrl *ctrl = to_tcp_ctrl(nctrl);
>> struct nvme_tcp_queue *queue = &ctrl->queues[qid];
>> int ret, rcv_pdu_size;
>> + struct file *sock_file;
>>
>> mutex_init(&queue->queue_lock);
>> queue->ctrl = ctrl;
>> @@ -1534,6 +1537,13 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid)
>> goto err_destroy_mutex;
>> }
>>
>> + sock_file = sock_alloc_file(queue->sock, O_CLOEXEC, NULL);
>> + if (IS_ERR(sock_file)) {
>> + sock_release(queue->sock);
>
> Hi Hannes,
>
> Is it correct to call sock_release() here?
> sock_alloc_file() already does so on error.
>
> Flagged by Smatch.
>
Ah, no, you are correct. Will be fixing it up.

Cheers,

Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions Germany GmbH, Frankenstr. 146, 90461 Nürnberg
Managing Directors: I. Totev, A. Myers, A. McDonald, M. B. Moerman
(HRB 36809, AG Nürnberg)