|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] xl: track size of diskws with a dedicated counter
commit ffe2aae4b27ee5248fb1f33ac524290d6831cbcc
Author: Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Thu Feb 2 16:16:53 2017 +0000
Commit: Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Fri Feb 3 12:02:57 2017 +0000
xl: track size of diskws with a dedicated counter
The num_disks field can change during guest lifetime. Don't use that as
the size of diskws, use a dedicated counter instead.
Also free diskws and reset diskws to NULL after disabling events so that
it will be automatically re-created when the guest reboots.
Reported-by: Fatih Acar <fatih.acar@xxxxxxxxx>
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Tested-by: Fatih Acar <fatih.acar@xxxxxxxxx>
---
tools/libxl/xl_cmdimpl.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index b25ac6e..358757f 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -2811,6 +2811,7 @@ static int create_domain(struct domain_create *dom_info)
int ret, rc;
libxl_evgen_domain_death *deathw = NULL;
libxl_evgen_disk_eject **diskws = NULL; /* one per disk */
+ unsigned int num_diskws = 0;
void *config_data = 0;
int config_len = 0;
int restore_fd = -1;
@@ -3119,8 +3120,9 @@ start:
diskws = xmalloc(sizeof(*diskws) * d_config.num_disks);
for (i = 0; i < d_config.num_disks; i++)
diskws[i] = NULL;
+ num_diskws = d_config.num_disks;
}
- for (i = 0; i < d_config.num_disks; i++) {
+ for (i = 0; i < num_diskws; i++) {
if (d_config.disks[i].removable) {
ret = libxl_evenable_disk_eject(ctx, domid, d_config.disks[i].vdev,
0, &diskws[i]);
@@ -3157,7 +3159,10 @@ start:
libxl_event_free(ctx, event);
libxl_evdisable_domain_death(ctx, deathw);
deathw = NULL;
- evdisable_disk_ejects(diskws, d_config.num_disks);
+ evdisable_disk_ejects(diskws, num_diskws);
+ free(diskws);
+ diskws = NULL;
+ num_diskws = 0;
/* discard any other events which may have been generated */
while (!(ret = libxl_event_check(ctx, &event,
LIBXL_EVENTMASK_ALL, 0,0))) {
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |