From: Chenbo Xia <chenbox@nvidia.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
"otilibil@eurecom.fr" <otilibil@eurecom.fr>,
"david.marchand@redhat.com" <david.marchand@redhat.com>
Subject: Re: [PATCH] vhost: fix VDUSE devices registration
Date: Thu, 6 Feb 2025 08:35:41 +0000 [thread overview]
Message-ID: <ABE5D435-146D-4D71-B824-A29A89D02B45@nvidia.com> (raw)
In-Reply-To: <20250131130957.293562-1-maxime.coquelin@redhat.com>
> On Jan 31, 2025, at 21:09, Maxime Coquelin <maxime.coquelin@redhat.com> wrote:
>
> External email: Use caution opening links or attachments
>
>
> This patch fixes a regression in vhost_driver_register()
> causing VDUSE devices registration to fail systematically
> because the return value was initialized to -1 and not
> changed later on for this type of devices.
>
> Fixes: 4d2aa150769b ("vhost: remove check around mutex init")
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
> lib/vhost/socket.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
> index 433a42bf80..894a0f0dcb 100644
> --- a/lib/vhost/socket.c
> +++ b/lib/vhost/socket.c
> @@ -893,7 +893,6 @@ vhost_user_socket_mem_free(struct vhost_user_socket *vsocket)
> int
> rte_vhost_driver_register(const char *path, uint64_t flags)
> {
> - int ret = -1;
> struct vhost_user_socket *vsocket;
>
> if (!path)
> @@ -997,7 +996,6 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
> } else {
> #ifndef RTE_LIBRTE_VHOST_POSTCOPY
> VHOST_CONFIG_LOG(path, ERR, "Postcopy requested but not compiled");
> - ret = -1;
> goto out_mutex;
> #endif
> }
> @@ -1012,15 +1010,14 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
> } else {
> vsocket->is_server = true;
> }
> - ret = create_unix_socket(vsocket);
> - if (ret < 0)
> + if (create_unix_socket(vsocket) < 0)
> goto out_mutex;
> }
>
> vhost_user.vsockets[vhost_user.vsocket_cnt++] = vsocket;
>
> pthread_mutex_unlock(&vhost_user.mutex);
> - return ret;
> + return 0;
>
> out_mutex:
> if (pthread_mutex_destroy(&vsocket->conn_mutex)) {
> @@ -1028,8 +1025,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
> }
> out:
> pthread_mutex_unlock(&vhost_user.mutex);
> -
> - return ret;
> + return -1;
> }
>
> static bool
> --
> 2.48.1
>
Reviewed-by: Chenbo Xia <chenbox@nvidia.com>
next prev parent reply other threads:[~2025-02-06 8:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-31 13:09 Maxime Coquelin
2025-02-06 8:35 ` Chenbo Xia [this message]
2025-01-31 17:34 Ariel Otilibili-Anieli
2025-02-05 21:18 ` Maxime Coquelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ABE5D435-146D-4D71-B824-A29A89D02B45@nvidia.com \
--to=chenbox@nvidia.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
--cc=otilibil@eurecom.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).