QEMU-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [Qemu-devel] [PATCH v2] ivshmem-server: Clean up shmem on shutdown
@ 2019-08-05  5:54 Jan Kiszka
  2019-08-06 13:01 ` Claudio Fontana
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2019-08-05  5:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: Claudio Fontana

From: Jan Kiszka <jan.kiszka@siemens.com>

So far, the server leaves the posix shared memory object behind when
terminating, requiring the user to explicitly remove it in order to
start a new instance.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Changes in v2:
 - respect use_shm_open
 - also clean up in ivshmem_server_start error path

 contrib/ivshmem-server/ivshmem-server.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/contrib/ivshmem-server/ivshmem-server.c b/contrib/ivshmem-server/ivshmem-server.c
index 77f97b209c..88daee812d 100644
--- a/contrib/ivshmem-server/ivshmem-server.c
+++ b/contrib/ivshmem-server/ivshmem-server.c
@@ -353,6 +353,9 @@ ivshmem_server_start(IvshmemServer *server)
 err_close_sock:
     close(sock_fd);
 err_close_shm:
+    if (server->use_shm_open) {
+        shm_unlink(server->shm_path);
+    }
     close(shm_fd);
     return -1;
 }
@@ -370,6 +373,9 @@ ivshmem_server_close(IvshmemServer *server)
     }

     unlink(server->unix_sock_path);
+    if (server->use_shm_open) {
+        shm_unlink(server->shm_path);
+    }
     close(server->sock_fd);
     close(server->shm_fd);
     server->sock_fd = -1;
--
2.16.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH v2] ivshmem-server: Clean up shmem on shutdown
  2019-08-05  5:54 [Qemu-devel] [PATCH v2] ivshmem-server: Clean up shmem on shutdown Jan Kiszka
@ 2019-08-06 13:01 ` Claudio Fontana
  2019-11-08  9:08   ` Jan Kiszka
  0 siblings, 1 reply; 5+ messages in thread
From: Claudio Fontana @ 2019-08-06 13:01 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: qemu-devel

On 8/5/19 7:54 AM, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> So far, the server leaves the posix shared memory object behind when
> terminating, requiring the user to explicitly remove it in order to
> start a new instance.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> 
> Changes in v2:
>  - respect use_shm_open
>  - also clean up in ivshmem_server_start error path
> 
>  contrib/ivshmem-server/ivshmem-server.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/contrib/ivshmem-server/ivshmem-server.c b/contrib/ivshmem-server/ivshmem-server.c
> index 77f97b209c..88daee812d 100644
> --- a/contrib/ivshmem-server/ivshmem-server.c
> +++ b/contrib/ivshmem-server/ivshmem-server.c
> @@ -353,6 +353,9 @@ ivshmem_server_start(IvshmemServer *server)
>  err_close_sock:
>      close(sock_fd);
>  err_close_shm:
> +    if (server->use_shm_open) {
> +        shm_unlink(server->shm_path);
> +    }
>      close(shm_fd);
>      return -1;
>  }
> @@ -370,6 +373,9 @@ ivshmem_server_close(IvshmemServer *server)
>      }
> 
>      unlink(server->unix_sock_path);
> +    if (server->use_shm_open) {
> +        shm_unlink(server->shm_path);
> +    }
>      close(server->sock_fd);
>      close(server->shm_fd);
>      server->sock_fd = -1;
> --
> 2.16.4
> 
> 

Reviewed-by: Claudio Fontana <claudio.fontana@suse.com>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] ivshmem-server: Clean up shmem on shutdown
  2019-08-06 13:01 ` Claudio Fontana
@ 2019-11-08  9:08   ` Jan Kiszka
  2019-11-08 15:14     ` Markus Armbruster
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2019-11-08  9:08 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: Claudio Fontana, qemu-devel

On 06.08.19 15:01, Claudio Fontana wrote:
> On 8/5/19 7:54 AM, Jan Kiszka wrote:
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> So far, the server leaves the posix shared memory object behind when
>> terminating, requiring the user to explicitly remove it in order to
>> start a new instance.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>>
>> Changes in v2:
>>   - respect use_shm_open
>>   - also clean up in ivshmem_server_start error path
>>
>>   contrib/ivshmem-server/ivshmem-server.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/contrib/ivshmem-server/ivshmem-server.c b/contrib/ivshmem-server/ivshmem-server.c
>> index 77f97b209c..88daee812d 100644
>> --- a/contrib/ivshmem-server/ivshmem-server.c
>> +++ b/contrib/ivshmem-server/ivshmem-server.c
>> @@ -353,6 +353,9 @@ ivshmem_server_start(IvshmemServer *server)
>>   err_close_sock:
>>       close(sock_fd);
>>   err_close_shm:
>> +    if (server->use_shm_open) {
>> +        shm_unlink(server->shm_path);
>> +    }
>>       close(shm_fd);
>>       return -1;
>>   }
>> @@ -370,6 +373,9 @@ ivshmem_server_close(IvshmemServer *server)
>>       }
>>
>>       unlink(server->unix_sock_path);
>> +    if (server->use_shm_open) {
>> +        shm_unlink(server->shm_path);
>> +    }
>>       close(server->sock_fd);
>>       close(server->shm_fd);
>>       server->sock_fd = -1;
>> --
>> 2.16.4
>>
>>
> 
> Reviewed-by: Claudio Fontana <claudio.fontana@suse.com>
> 
> 
> 

Markus, would you take this?

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] ivshmem-server: Clean up shmem on shutdown
  2019-11-08  9:08   ` Jan Kiszka
@ 2019-11-08 15:14     ` Markus Armbruster
  2019-11-12  9:36       ` Laurent Vivier
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Armbruster @ 2019-11-08 15:14 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: qemu-trivial, Claudio Fontana, qemu-devel

Jan Kiszka <jan.kiszka@siemens.com> writes:

> On 06.08.19 15:01, Claudio Fontana wrote:
>> On 8/5/19 7:54 AM, Jan Kiszka wrote:
>>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>>
>>> So far, the server leaves the posix shared memory object behind when
>>> terminating, requiring the user to explicitly remove it in order to
>>> start a new instance.
>>>
>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>> ---
>>>
>>> Changes in v2:
>>>   - respect use_shm_open
>>>   - also clean up in ivshmem_server_start error path
>>>
>>>   contrib/ivshmem-server/ivshmem-server.c | 6 ++++++
>>>   1 file changed, 6 insertions(+)
>>>
>>> diff --git a/contrib/ivshmem-server/ivshmem-server.c b/contrib/ivshmem-server/ivshmem-server.c
>>> index 77f97b209c..88daee812d 100644
>>> --- a/contrib/ivshmem-server/ivshmem-server.c
>>> +++ b/contrib/ivshmem-server/ivshmem-server.c
>>> @@ -353,6 +353,9 @@ ivshmem_server_start(IvshmemServer *server)
>>>   err_close_sock:
>>>       close(sock_fd);
>>>   err_close_shm:
>>> +    if (server->use_shm_open) {
>>> +        shm_unlink(server->shm_path);
>>> +    }
>>>       close(shm_fd);
>>>       return -1;
>>>   }
>>> @@ -370,6 +373,9 @@ ivshmem_server_close(IvshmemServer *server)
>>>       }
>>>
>>>       unlink(server->unix_sock_path);
>>> +    if (server->use_shm_open) {
>>> +        shm_unlink(server->shm_path);
>>> +    }
>>>       close(server->sock_fd);
>>>       close(server->shm_fd);
>>>       server->sock_fd = -1;
>>> --
>>> 2.16.4
>>>
>>>
>>
>> Reviewed-by: Claudio Fontana <claudio.fontana@suse.com>
>
> Markus, would you take this?

ivshmem has no maintainer.  I you need me to serve as a pull request
monkey of last resort, I can do that.  However, for this one,
qemu-trivial (cc'ed) should do.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] ivshmem-server: Clean up shmem on shutdown
  2019-11-08 15:14     ` Markus Armbruster
@ 2019-11-12  9:36       ` Laurent Vivier
  0 siblings, 0 replies; 5+ messages in thread
From: Laurent Vivier @ 2019-11-12  9:36 UTC (permalink / raw)
  To: Markus Armbruster, Jan Kiszka; +Cc: qemu-trivial, Claudio Fontana, qemu-devel

Le 08/11/2019 à 16:14, Markus Armbruster a écrit :
> Jan Kiszka <jan.kiszka@siemens.com> writes:
> 
>> On 06.08.19 15:01, Claudio Fontana wrote:
>>> On 8/5/19 7:54 AM, Jan Kiszka wrote:
>>>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>>>
>>>> So far, the server leaves the posix shared memory object behind when
>>>> terminating, requiring the user to explicitly remove it in order to
>>>> start a new instance.
>>>>
>>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>>> ---
>>>>
>>>> Changes in v2:
>>>>   - respect use_shm_open
>>>>   - also clean up in ivshmem_server_start error path
>>>>
>>>>   contrib/ivshmem-server/ivshmem-server.c | 6 ++++++
>>>>   1 file changed, 6 insertions(+)
>>>>
>>>> diff --git a/contrib/ivshmem-server/ivshmem-server.c b/contrib/ivshmem-server/ivshmem-server.c
>>>> index 77f97b209c..88daee812d 100644
>>>> --- a/contrib/ivshmem-server/ivshmem-server.c
>>>> +++ b/contrib/ivshmem-server/ivshmem-server.c
>>>> @@ -353,6 +353,9 @@ ivshmem_server_start(IvshmemServer *server)
>>>>   err_close_sock:
>>>>       close(sock_fd);
>>>>   err_close_shm:
>>>> +    if (server->use_shm_open) {
>>>> +        shm_unlink(server->shm_path);
>>>> +    }
>>>>       close(shm_fd);
>>>>       return -1;
>>>>   }
>>>> @@ -370,6 +373,9 @@ ivshmem_server_close(IvshmemServer *server)
>>>>       }
>>>>
>>>>       unlink(server->unix_sock_path);
>>>> +    if (server->use_shm_open) {
>>>> +        shm_unlink(server->shm_path);
>>>> +    }
>>>>       close(server->sock_fd);
>>>>       close(server->shm_fd);
>>>>       server->sock_fd = -1;
>>>> --
>>>> 2.16.4
>>>>
>>>>
>>>
>>> Reviewed-by: Claudio Fontana <claudio.fontana@suse.com>
>>
>> Markus, would you take this?
> 
> ivshmem has no maintainer.  I you need me to serve as a pull request
> monkey of last resort, I can do that.  However, for this one,
> qemu-trivial (cc'ed) should do.
> 
> 

Applied to my trivial-patches branch.

Thanks,
Laurent


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-05  5:54 [Qemu-devel] [PATCH v2] ivshmem-server: Clean up shmem on shutdown Jan Kiszka
2019-08-06 13:01 ` Claudio Fontana
2019-11-08  9:08   ` Jan Kiszka
2019-11-08 15:14     ` Markus Armbruster
2019-11-12  9:36       ` Laurent Vivier

QEMU-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/qemu-devel/0 qemu-devel/git/0.git
	git clone --mirror https://lore.kernel.org/qemu-devel/1 qemu-devel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 qemu-devel qemu-devel/ https://lore.kernel.org/qemu-devel \
		qemu-devel@nongnu.org
	public-inbox-index qemu-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.nongnu.qemu-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git