virtiofsd: vu_dispatch locking should never fail
commit525a3030a82714693c2045d390b698dd4e2090bd
authorGreg Kurz <groug@kaod.org>
Wed, 3 Feb 2021 18:24:34 +0000 (3 19:24 +0100)
committerDr. David Alan Gilbert <dgilbert@redhat.com>
Tue, 16 Feb 2021 17:03:09 +0000 (16 17:03 +0000)
tree349205ed8eae178e84aa315605ec4a43bff6a260
parent0958ee89b6fb8542867ca68203626d6aef522e8f
virtiofsd: vu_dispatch locking should never fail

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>
Message-Id: <20210203182434.93870-1-groug@kaod.org>
Reviewed-by: Vivek Goyal <vgoyal@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
tools/virtiofsd/fuse_virtio.c