[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] virtiofsd: vu_dispatch locking should never fail
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH v2] virtiofsd: vu_dispatch locking should never fail |
Date: |
Thu, 4 Feb 2021 09:37:20 +0000 |
On Wed, Feb 03, 2021 at 07:24:34PM +0100, Greg Kurz wrote:
> pthread_rwlock_rdlock() and pthread_rwlock_wrlock() can fail if a
> deadlock condition is detected or the current thread already owns
> the lock. They can also fail, like pthread_rwlock_unlock(), if the
> mutex wasn't properly initialized. None of these are ever expected
> to happen with fv_VuDev::vu_dispatch_rwlock.
>
> Some users already check the return value and assert, some others
> don't. Introduce rdlock/wrlock/unlock wrappers that just do the
> former and use them everywhere for improved consistency and
> robustness.
>
> This is just cleanup. It doesn't fix any actual issue.
>
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
>
> v2: - open-code helpers instead of defining them with a macro (Vivek, Stefan)
> - fixed rd/wr typo in fv_queue_thread() (Stefan)
> - make it clear in the changelog this is just cleanup (Stefan)
>
> tools/virtiofsd/fuse_virtio.c | 49 +++++++++++++++++++++++++----------
> 1 file changed, 35 insertions(+), 14 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
signature.asc
Description: PGP signature