* [PATCH] migration: Unlock mutex in error case
@ 2023-11-02 9:12 Juan Quintela
2023-11-02 12:50 ` Peter Maydell
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Juan Quintela @ 2023-11-02 9:12 UTC (permalink / raw)
To: qemu-devel; +Cc: Fabiano Rosas, Juan Quintela, Peter Xu, Leonardo Bras
We were not unlocking bitmap mutex on the error case.
Coverity discovered the problem.
Fixes: a2326705e5 ("migration: Stop migration immediately in RDMA error paths")
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
migration/ram.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/migration/ram.c b/migration/ram.c
index 34724e8fe8..8c4df60f29 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -3040,6 +3040,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
ret = rdma_registration_start(f, RAM_CONTROL_ROUND);
if (ret < 0) {
qemu_file_set_error(f, ret);
+ qemu_mutex_unlock(&rs->bitmap_mutex);
goto out;
}
--
2.41.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] migration: Unlock mutex in error case
2023-11-02 9:12 [PATCH] migration: Unlock mutex in error case Juan Quintela
@ 2023-11-02 12:50 ` Peter Maydell
2023-11-02 13:16 ` Alex Bennée
2023-11-02 13:41 ` Peter Xu
2 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2023-11-02 12:50 UTC (permalink / raw)
To: Juan Quintela; +Cc: qemu-devel, Fabiano Rosas, Peter Xu, Leonardo Bras
On Thu, 2 Nov 2023 at 09:13, Juan Quintela <quintela@redhat.com> wrote:
>
> We were not unlocking bitmap mutex on the error case.
> Coverity discovered the problem.
>
> Fixes: a2326705e5 ("migration: Stop migration immediately in RDMA error paths")
> Signed-off-by: Juan Quintela <quintela@redhat.com>
CID 1523750.
thanks
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] migration: Unlock mutex in error case
2023-11-02 9:12 [PATCH] migration: Unlock mutex in error case Juan Quintela
2023-11-02 12:50 ` Peter Maydell
@ 2023-11-02 13:16 ` Alex Bennée
2023-11-03 7:37 ` Juan Quintela
2023-11-02 13:41 ` Peter Xu
2 siblings, 1 reply; 5+ messages in thread
From: Alex Bennée @ 2023-11-02 13:16 UTC (permalink / raw)
To: Juan Quintela; +Cc: qemu-devel, Fabiano Rosas, Peter Xu, Leonardo Bras
Juan Quintela <quintela@redhat.com> writes:
> We were not unlocking bitmap mutex on the error case.
> Coverity discovered the problem.
>
> Fixes: a2326705e5 ("migration: Stop migration immediately in RDMA error paths")
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
> migration/ram.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/migration/ram.c b/migration/ram.c
> index 34724e8fe8..8c4df60f29 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -3040,6 +3040,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
> ret = rdma_registration_start(f, RAM_CONTROL_ROUND);
> if (ret < 0) {
> qemu_file_set_error(f, ret);
> + qemu_mutex_unlock(&rs->bitmap_mutex);
I see the function uses the WITH_RCU_READ_LOCK_GUARD() macro to autofree
the RCU lock so why not use WITH_QEMU_LOCK_GUARD() instead of manually
checking the error cases?
> goto out;
> }
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] migration: Unlock mutex in error case
2023-11-02 9:12 [PATCH] migration: Unlock mutex in error case Juan Quintela
2023-11-02 12:50 ` Peter Maydell
2023-11-02 13:16 ` Alex Bennée
@ 2023-11-02 13:41 ` Peter Xu
2 siblings, 0 replies; 5+ messages in thread
From: Peter Xu @ 2023-11-02 13:41 UTC (permalink / raw)
To: Juan Quintela; +Cc: qemu-devel, Fabiano Rosas, Leonardo Bras
On Thu, Nov 02, 2023 at 10:12:45AM +0100, Juan Quintela wrote:
> We were not unlocking bitmap mutex on the error case.
> Coverity discovered the problem.
>
> Fixes: a2326705e5 ("migration: Stop migration immediately in RDMA error paths")
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
> migration/ram.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/migration/ram.c b/migration/ram.c
> index 34724e8fe8..8c4df60f29 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -3040,6 +3040,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
> ret = rdma_registration_start(f, RAM_CONTROL_ROUND);
> if (ret < 0) {
> qemu_file_set_error(f, ret);
> + qemu_mutex_unlock(&rs->bitmap_mutex);
> goto out;
> }
Reviewed-by: Peter Xu <peterx@redhat.com>
--
Peter Xu
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] migration: Unlock mutex in error case
2023-11-02 13:16 ` Alex Bennée
@ 2023-11-03 7:37 ` Juan Quintela
0 siblings, 0 replies; 5+ messages in thread
From: Juan Quintela @ 2023-11-03 7:37 UTC (permalink / raw)
To: Alex Bennée; +Cc: qemu-devel, Fabiano Rosas, Peter Xu, Leonardo Bras
Alex Bennée <alex.bennee@linaro.org> wrote:
> Juan Quintela <quintela@redhat.com> writes:
>
>> We were not unlocking bitmap mutex on the error case.
>> Coverity discovered the problem.
>>
>> Fixes: a2326705e5 ("migration: Stop migration immediately in RDMA error paths")
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>> migration/ram.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/migration/ram.c b/migration/ram.c
>> index 34724e8fe8..8c4df60f29 100644
>> --- a/migration/ram.c
>> +++ b/migration/ram.c
>> @@ -3040,6 +3040,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
>> ret = rdma_registration_start(f, RAM_CONTROL_ROUND);
>> if (ret < 0) {
>> qemu_file_set_error(f, ret);
>> + qemu_mutex_unlock(&rs->bitmap_mutex);
>
> I see the function uses the WITH_RCU_READ_LOCK_GUARD() macro to autofree
> the RCU lock so why not use WITH_QEMU_LOCK_GUARD() instead of manually
> checking the error cases?
You are right.
Changing to that.
Later, Juan.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-11-03 7:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-02 9:12 [PATCH] migration: Unlock mutex in error case Juan Quintela
2023-11-02 12:50 ` Peter Maydell
2023-11-02 13:16 ` Alex Bennée
2023-11-03 7:37 ` Juan Quintela
2023-11-02 13:41 ` Peter Xu
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).