Richard W.M. Jones
2020-Apr-28 15:19 UTC
[Libguestfs] [PATCH nbdkit] server: Fix parameters of lock_request, unlock_request
Patch itself is not controversial.
However I do wonder if we want to change all these constructs so that
instead of using #ifdef we use something like:
if (HAVE_PIPE2) {
// normal path
}
else {
// fallback
}
(It wouldn't actually work as written above because HAVE_PIPE2 is not
always defined, but you get the idea.)
This would allow us to test that the fallback paths still compile.
Rich.
Richard W.M. Jones
2020-Apr-28 15:19 UTC
[Libguestfs] [PATCH nbdkit] server: Fix parameters of lock_request, unlock_request on fallback path.
On Haiku which doesn't have pipe2 we were using the fallback path.
However a previous change to remove the conn parameter of lock_request
and unlock_request had not been made to this code and so it failed to
compile.
Fixes: commit 91023f269d4cea56f573a1aa0d880b12052f6e1e
---
server/connections.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/server/connections.c b/server/connections.c
index c7b55ca1..cc552b90 100644
--- a/server/connections.c
+++ b/server/connections.c
@@ -277,25 +277,25 @@ new_connection (int sockin, int sockout, int nworkers)
* non-atomicity okay.
*/
assert (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS);
- lock_request (NULL);
+ lock_request ();
if (pipe (conn->status_pipe)) {
perror ("pipe");
- unlock_request (NULL);
+ unlock_request ();
goto error2;
}
if (set_nonblock (set_cloexec (conn->status_pipe[0])) == -1) {
perror ("fcntl");
close (conn->status_pipe[1]);
- unlock_request (NULL);
+ unlock_request ();
goto error2;
}
if (set_nonblock (set_cloexec (conn->status_pipe[1])) == -1) {
perror ("fcntl");
close (conn->status_pipe[0]);
- unlock_request (NULL);
+ unlock_request ();
goto error2;
}
- unlock_request (NULL);
+ unlock_request ();
#endif
}
--
2.25.0
Eric Blake
2020-Apr-28 15:58 UTC
Re: [Libguestfs] [PATCH nbdkit] server: Fix parameters of lock_request, unlock_request on fallback path.
On 4/28/20 10:19 AM, Richard W.M. Jones wrote:> On Haiku which doesn't have pipe2 we were using the fallback path. > However a previous change to remove the conn parameter of lock_request > and unlock_request had not been made to this code and so it failed to > compile. > > Fixes: commit 91023f269d4cea56f573a1aa0d880b12052f6e1e > --- > server/connections.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-)D'oh - we've already had a couple of fixes to 91023f26 and friends: edb9aeae, 6a0dee192, and now this. ACK. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Reasonably Related Threads
- [PATCH nbdkit] server: Fix parameters of lock_request, unlock_request
- [PATCH nbdkit] server/locks: Allow lock_request to be called when there is no current conn.
- Re: [PATCH nbdkit] server/locks: Allow lock_request to be called when there is no current conn.
- [PATCH nbdkit] server: Remove useless thread local sockaddr.
- [PATCH 1/9] plugins: Move locking to a new file.