Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Maintenance:9835
qemu.openSUSE_Leap_42.3_Update
0119-xen-dont-try-setting-max-grants-mul.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0119-xen-dont-try-setting-max-grants-mul.patch of Package qemu.openSUSE_Leap_42.3_Update
From 334e4a6e676ae7a90f5bd2cfe06020e23dac8598 Mon Sep 17 00:00:00 2001 From: Juergen Gross <jgross@suse.com> Date: Fri, 22 Sep 2017 14:07:25 +0200 Subject: [PATCH] xen: dont try setting max grants multiple times Trying to call xengnttab_set_max_grants() with the same file handle might fail on some kernels, as this operation is allowed only once. This is a problem for the qdisk backend as blk_connect() can be called multiple times for a domain, e.g. in case grub-xen is being used to boot it. So instead of letting the generic backend code open the gnttab device do it in blk_connect() and close it again in blk_disconnect. Signed-off-by: Juergen Gross <jgross@suse.com> Acked-by: Anthony PERARD <anthony.perard@citrix.com> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org> (cherry picked from commit e38c3e86dfffe3cc806d051b9deeab31836b196a) [LD: BSC#1100408] Signed-off-by: Larry Dewey <ldewey@suse.com> --- hw/block/xen_disk.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c index b76640407c..ef13528cb0 100644 --- a/hw/block/xen_disk.c +++ b/hw/block/xen_disk.c @@ -1243,6 +1243,12 @@ static int blk_connect(struct XenDevice *xendev) /* Add on the number needed for the ring pages */ max_grants += blkdev->nr_ring_ref; + blkdev->xendev.gnttabdev = xengnttab_open(NULL, 0); + if (blkdev->xendev.gnttabdev == NULL) { + xen_pv_printf(xendev, 0, "xengnttab_open failed: %s\n", + strerror(errno)); + return -1; + } if (xengnttab_set_max_grants(blkdev->xendev.gnttabdev, max_grants)) { xen_pv_printf(xendev, 0, "xengnttab_set_max_grants failed: %s\n", strerror(errno)); @@ -1351,6 +1357,11 @@ static void blk_disconnect(struct XenDevice *xendev) } blkdev->feature_persistent = false; } + + if (blkdev->xendev.gnttabdev) { + xengnttab_close(blkdev->xendev.gnttabdev); + blkdev->xendev.gnttabdev = NULL; + } } static int blk_free(struct XenDevice *xendev) @@ -1358,9 +1369,7 @@ static int blk_free(struct XenDevice *xendev) struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev); struct ioreq *ioreq; - if (blkdev->blk || blkdev->sring) { - blk_disconnect(xendev); - } + blk_disconnect(xendev); while (!QLIST_EMPTY(&blkdev->freelist)) { ioreq = QLIST_FIRST(&blkdev->freelist); @@ -1397,7 +1406,6 @@ void xen_blk_resize_update(void *dev) struct XenDevOps xen_blkdev_ops = { .size = sizeof(struct XenBlkDev), - .flags = DEVOPS_FLAG_NEED_GNTDEV, .alloc = blk_alloc, .init = blk_init, .initialise = blk_connect,
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor