[PATCH 12/14] nvmet-tcp: allocate socket file
Sagi Grimberg
sagi at grimberg.me
Tue Aug 8 01:44:03 PDT 2023
>>>>>>> -static int nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port,
>>>>>>> +static void nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port,
>>>>>>> struct socket *newsock)
>>>>>>
>>>>>> Why does the function change from retcode to void in this patch?
>>>>>
>>>>> Because the return code was never evaluated.
>>>>
>>>> ??
>>>>
>>>> I see it is evaluated.
>>>
>>> Yes, but this patch moved the 'sock_release()' call into
>>> nvmet_tcp_alloc_queue(), making the return code obsolete.
>>>
>>> But I can make it a separate patch if required.
>>
>> But now who calls sock_release if you failed before allocating
>> the sockfile?
>>
> That is done in nvmet_tcp_remove_port(), and independent on
> queue release.
I'm referring to newsock, not the listener socket.
--
static void nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port,
struct socket *newsock)
{
struct nvmet_tcp_queue *queue;
int ret;
queue = kzalloc(sizeof(*queue), GFP_KERNEL);
//i.e. you fail here...
if (!queue)
return;
--
More information about the Linux-nvme
mailing list