[ovs-dev] [PATCH] netlink-socket: Exit NL transaction loop when EINVAL is returned

Nithin Raju nithin at vmware.com
Tue Apr 14 21:35:51 UTC 2015


> On Apr 14, 2015, at 2:19 PM, Alin Serdean <aserdean at cloudbasesolutions.com> wrote:
> 
> In nl_sock_transact_multiple__ we do the following:
> 
> if (!DeviceIoControl(sock->handle, OVS_IOCTL_TRANSACT,
>                             txn->request->data,
>                             txn->request->size,
>                             reply_buf, sizeof reply_buf,
>                             &reply_len, NULL)) {
>            /* XXX: Map to a more appropriate error. */
>            error = EINVAL;
>            break;
>        }
> 
> We map every failure to EINVAL that is why it did not pop out into Linux.

Alin,
Setting ‘error’ to EINVAL was purely temporary since I didn’t know what is the correct semantic that time. At some point, I wanted to resist this.

One more thing we need to do is to define meaningful error codes for:
struct nlmsgerr             
{                           
        int error;          
        struct nlmsghdr msg;
};                          

Currently, we set ‘nlmsgerr.error’ to a value in 'enum _NL_ERROR_’ in the kernel. All of the enums don’t map 1-1 with errno_t (eg. EADDRINUSE does not map to NL_ERROR_ADDRINUSE).

> We should definitely log the error using ovs_lasterror_to_string before setting it to EINVAL.
> 
> Maybe we should just increase the number of transactions in some situations(i.e. STATUS_INVALID_PARAMETER) as an idea to allow the rest of the transactions to be processed.

Sure that is a good idea too, and can be considered. In the first version of the code submitted for review, we were supported transaction based on read/write IOCTL. It could be resurrected back if we see benefits of doing it.

thanks,
-- Nithin


More information about the dev mailing list