From patchwork Wed Jan 22 14:44:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 11345859 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E5C2413A4 for ; Wed, 22 Jan 2020 14:46:08 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B6C1921835 for ; Wed, 22 Jan 2020 14:46:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="ThY0VgR8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B6C1921835 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iuHFg-0000Yp-4o; Wed, 22 Jan 2020 14:45:04 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iuHFe-0000Xr-Ov for xen-devel@lists.xenproject.org; Wed, 22 Jan 2020 14:45:02 +0000 X-Inumbo-ID: c2defb82-3d25-11ea-b833-bc764e2007e4 Received: from smtp-fw-2101.amazon.com (unknown [72.21.196.25]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id c2defb82-3d25-11ea-b833-bc764e2007e4; Wed, 22 Jan 2020 14:44:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1579704298; x=1611240298; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VY+t0g5bMV0wHRoLUTZQyG6LKBN/XosYy5gpoI6DSvc=; b=ThY0VgR8VrRKDlYlh2kkvs8X4bjR4ug8OnUnXmoG3CCCumCU9iO+Bv/J Yc3vI55wetb7RKIguIIc1CA4d/8eDZliRrwqbpMI68Gm7xr6x/J/Z7koN v909hRfXWyCJCY6s4Yx/1hgIYwvV19CDWkhEp23DU+phueAClaZWURUC1 E=; IronPort-SDR: mhS0QrjEDsW7xg4iT1/FkmmLDaY/9p5luFSoZpWKbkNt4rr/jxkczES7vXFuuRXAsFd+TXDtN+ BcCLsrmhUQIA== X-IronPort-AV: E=Sophos;i="5.70,350,1574121600"; d="scan'208";a="13689442" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-1d-9ec21598.us-east-1.amazon.com) ([10.43.8.2]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP; 22 Jan 2020 14:44:57 +0000 Received: from EX13MTAUEA002.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1d-9ec21598.us-east-1.amazon.com (Postfix) with ESMTPS id 131F0A256B; Wed, 22 Jan 2020 14:44:55 +0000 (UTC) Received: from EX13D32EUB003.ant.amazon.com (10.43.166.165) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1236.3; Wed, 22 Jan 2020 14:44:55 +0000 Received: from EX13MTAUEE002.ant.amazon.com (10.43.62.24) by EX13D32EUB003.ant.amazon.com (10.43.166.165) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 22 Jan 2020 14:44:54 +0000 Received: from u2f063a87eabd5f.cbg10.amazon.com (10.125.106.135) by mail-relay.amazon.com (10.43.62.224) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Wed, 22 Jan 2020 14:44:52 +0000 From: Paul Durrant To: Date: Wed, 22 Jan 2020 14:44:42 +0000 Message-ID: <20200122144446.919-4-pdurrant@amazon.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200122144446.919-1-pdurrant@amazon.com> References: <20200122144446.919-1-pdurrant@amazon.com> MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [PATCH v4 3/7] libxl: generalise libxl__domain_userdata_lock() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Paul Durrant , Ian Jackson , Wei Liu Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" This function implements a file-based lock with a file name generated from a domid. This patch splits it into two, generalising the core of the locking code into a new libxl__lock_file() function which operates on a specified file, leaving just the file name generation in libxl__domain_userdata_lock(). This patch also generalises libxl__unlock_domain_userdata() to libxl__unlock_file() and modifies all call-sites. Suggested-by: Ian Jackson Signed-off-by: Paul Durrant Acked-by: Ian Jackson --- Cc: Ian Jackson Cc: Wei Liu Cc: Anthony PERARD v4: - New in v4. --- tools/libxl/libxl_create.c | 4 +-- tools/libxl/libxl_device.c | 4 +-- tools/libxl/libxl_disk.c | 12 ++++---- tools/libxl/libxl_dom.c | 12 ++++---- tools/libxl/libxl_domain.c | 14 ++++----- tools/libxl/libxl_internal.c | 55 +++++++++++++++++++++--------------- tools/libxl/libxl_internal.h | 10 ++++--- tools/libxl/libxl_mem.c | 8 +++--- tools/libxl/libxl_pci.c | 4 +-- tools/libxl/libxl_usb.c | 8 +++--- 10 files changed, 72 insertions(+), 59 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 73a2883357..e4aab4fd1c 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1755,7 +1755,7 @@ static void domcreate_complete(libxl__egc *egc, bool retain_domain = !rc || rc == ERROR_ABORTED; if (retain_domain) { - libxl__domain_userdata_lock *lock; + libxl__flock *lock; /* Note that we hold CTX lock at this point so only need to * take data store lock @@ -1769,7 +1769,7 @@ static void domcreate_complete(libxl__egc *egc, (gc, dcs->guest_domid, d_config_saved); if (!rc) rc = cfg_rc; - libxl__unlock_domain_userdata(lock); + libxl__unlock_file(lock); } } diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c index 9d05d2fd13..0381c5d509 100644 --- a/tools/libxl/libxl_device.c +++ b/tools/libxl/libxl_device.c @@ -1850,7 +1850,7 @@ void libxl__device_add_async(libxl__egc *egc, uint32_t domid, xs_transaction_t t = XBT_NULL; libxl_domain_config d_config; void *type_saved; - libxl__domain_userdata_lock *lock = NULL; + libxl__flock *lock = NULL; int rc; libxl_domain_config_init(&d_config); @@ -1946,7 +1946,7 @@ void libxl__device_add_async(libxl__egc *egc, uint32_t domid, out: libxl__xs_transaction_abort(gc, &t); - if (lock) libxl__unlock_domain_userdata(lock); + if (lock) libxl__unlock_file(lock); dt->dispose(type_saved); libxl_domain_config_dispose(&d_config); aodev->rc = rc; diff --git a/tools/libxl/libxl_disk.c b/tools/libxl/libxl_disk.c index 64a6691424..e0de1c5781 100644 --- a/tools/libxl/libxl_disk.c +++ b/tools/libxl/libxl_disk.c @@ -245,7 +245,7 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid, xs_transaction_t t = XBT_NULL; libxl_domain_config d_config; libxl_device_disk disk_saved; - libxl__domain_userdata_lock *lock = NULL; + libxl__flock *lock = NULL; libxl_domain_config_init(&d_config); libxl_device_disk_init(&disk_saved); @@ -436,7 +436,7 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid, out: libxl__xs_transaction_abort(gc, &t); - if (lock) libxl__unlock_domain_userdata(lock); + if (lock) libxl__unlock_file(lock); libxl_device_disk_dispose(&disk_saved); libxl_domain_config_dispose(&d_config); aodev->rc = rc; @@ -794,7 +794,7 @@ static void cdrom_insert_ejected(libxl__egc *egc, { EGC_GC; libxl__cdrom_insert_state *cis = CONTAINER_OF(qmp, *cis, qmp); - libxl__domain_userdata_lock *data_lock = NULL; + libxl__flock *data_lock = NULL; libxl__device device; const char *be_path, *libxl_path; flexarray_t *empty = NULL; @@ -896,7 +896,7 @@ static void cdrom_insert_ejected(libxl__egc *egc, out: libxl__xs_transaction_abort(gc, &t); libxl_domain_config_dispose(&d_config); - if (data_lock) libxl__unlock_domain_userdata(data_lock); + if (data_lock) libxl__unlock_file(data_lock); if (rc) { cdrom_insert_done(egc, cis, rc); /* must be last */ } else if (!has_callback) { @@ -951,7 +951,7 @@ static void cdrom_insert_inserted(libxl__egc *egc, { EGC_GC; libxl__cdrom_insert_state *cis = CONTAINER_OF(qmp, *cis, qmp); - libxl__domain_userdata_lock *data_lock = NULL; + libxl__flock *data_lock = NULL; libxl_domain_config d_config; flexarray_t *insert = NULL; xs_transaction_t t = XBT_NULL; @@ -1029,7 +1029,7 @@ static void cdrom_insert_inserted(libxl__egc *egc, out: libxl__xs_transaction_abort(gc, &t); libxl_domain_config_dispose(&d_config); - if (data_lock) libxl__unlock_domain_userdata(data_lock); + if (data_lock) libxl__unlock_file(data_lock); cdrom_insert_done(egc, cis, rc); /* must be last */ } diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index e0b6d4a8d3..021cbb4e1c 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -1520,7 +1520,7 @@ int libxl_userdata_store(libxl_ctx *ctx, uint32_t domid, { GC_INIT(ctx); int rc; - libxl__domain_userdata_lock *lock; + libxl__flock *lock; CTX_LOCK; lock = libxl__lock_domain_userdata(gc, domid); @@ -1532,7 +1532,7 @@ int libxl_userdata_store(libxl_ctx *ctx, uint32_t domid, rc = libxl__userdata_store(gc, domid, userdata_userid, data, datalen); - libxl__unlock_domain_userdata(lock); + libxl__unlock_file(lock); out: CTX_UNLOCK; @@ -1581,7 +1581,7 @@ int libxl_userdata_retrieve(libxl_ctx *ctx, uint32_t domid, { GC_INIT(ctx); int rc; - libxl__domain_userdata_lock *lock; + libxl__flock *lock; CTX_LOCK; lock = libxl__lock_domain_userdata(gc, domid); @@ -1594,7 +1594,7 @@ int libxl_userdata_retrieve(libxl_ctx *ctx, uint32_t domid, data_r, datalen_r); - libxl__unlock_domain_userdata(lock); + libxl__unlock_file(lock); out: CTX_UNLOCK; GC_FREE; @@ -1608,7 +1608,7 @@ int libxl_userdata_unlink(libxl_ctx *ctx, uint32_t domid, CTX_LOCK; int rc; - libxl__domain_userdata_lock *lock = NULL; + libxl__flock *lock = NULL; const char *filename; lock = libxl__lock_domain_userdata(gc, domid); @@ -1631,7 +1631,7 @@ int libxl_userdata_unlink(libxl_ctx *ctx, uint32_t domid, rc = 0; out: if (lock) - libxl__unlock_domain_userdata(lock); + libxl__unlock_file(lock); CTX_UNLOCK; GC_FREE; return rc; diff --git a/tools/libxl/libxl_domain.c b/tools/libxl/libxl_domain.c index 5714501778..1bdb1615d8 100644 --- a/tools/libxl/libxl_domain.c +++ b/tools/libxl/libxl_domain.c @@ -1278,7 +1278,7 @@ static void devices_destroy_cb(libxl__egc *egc, uint32_t domid = dis->domid; char *dom_path; char *vm_path; - libxl__domain_userdata_lock *lock; + libxl__flock *lock; dom_path = libxl__xs_get_dompath(gc, domid); if (!dom_path) { @@ -1308,7 +1308,7 @@ static void devices_destroy_cb(libxl__egc *egc, } libxl__userdata_destroyall(gc, domid); - libxl__unlock_domain_userdata(lock); + libxl__unlock_file(lock); /* Clean up qemu-save and qemu-resume files. They are * intermediate files created by libxc. Unfortunately they @@ -1917,7 +1917,7 @@ static void retrieve_domain_configuration_lock_acquired( retrieve_domain_configuration_state *rdcs = CONTAINER_OF(devlock, *rdcs, devlock); STATE_AO_GC(rdcs->qmp.ao); - libxl__domain_userdata_lock *lock = NULL; + libxl__flock *lock = NULL; bool has_callback = false; /* Convenience aliases */ @@ -1939,7 +1939,7 @@ static void retrieve_domain_configuration_lock_acquired( goto out; } - libxl__unlock_domain_userdata(lock); + libxl__unlock_file(lock); lock = NULL; /* We start by querying QEMU, if it is running, for its cpumap as this @@ -1964,7 +1964,7 @@ static void retrieve_domain_configuration_lock_acquired( } out: - if (lock) libxl__unlock_domain_userdata(lock); + if (lock) libxl__unlock_file(lock); if (!has_callback) retrieve_domain_configuration_end(egc, rdcs, rc); } @@ -1998,7 +1998,7 @@ static void retrieve_domain_configuration_end(libxl__egc *egc, retrieve_domain_configuration_state *rdcs, int rc) { STATE_AO_GC(rdcs->qmp.ao); - libxl__domain_userdata_lock *lock = NULL; + libxl__flock *lock = NULL; /* Convenience aliases */ libxl_domain_config *const d_config = rdcs->d_config; @@ -2205,7 +2205,7 @@ static void retrieve_domain_configuration_end(libxl__egc *egc, out: libxl__ev_slowlock_unlock(gc, &rdcs->devlock); - if (lock) libxl__unlock_domain_userdata(lock); + if (lock) libxl__unlock_file(lock); libxl_bitmap_dispose(&rdcs->qemuu_cpus); libxl__ev_qmp_dispose(gc, &rdcs->qmp); libxl__ev_time_deregister(gc, &rdcs->timeout); diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c index ba5637358e..211236dc99 100644 --- a/tools/libxl/libxl_internal.c +++ b/tools/libxl/libxl_internal.c @@ -400,26 +400,22 @@ int libxl__device_model_version_running(libxl__gc *gc, uint32_t domid) /* Portability note: this lock utilises flock(2) so a proper implementation of * flock(2) is required. */ -libxl__domain_userdata_lock *libxl__lock_domain_userdata(libxl__gc *gc, - uint32_t domid) +libxl__flock *libxl__lock_file(libxl__gc *gc, const char *lockfile) { - libxl__domain_userdata_lock *lock = NULL; - const char *lockfile; + libxl__flock *lock; int fd; struct stat stab, fstab; - lockfile = libxl__userdata_path(gc, domid, "domain-userdata-lock", "l"); - if (!lockfile) goto out; - - lock = libxl__zalloc(NOGC, sizeof(libxl__domain_userdata_lock)); + lock = libxl__zalloc(NOGC, sizeof(libxl__flock)); lock->path = libxl__strdup(NOGC, lockfile); while (true) { libxl__carefd_begin(); fd = open(lockfile, O_RDWR|O_CREAT, 0666); if (fd < 0) - LOGED(ERROR, domid, - "cannot open lockfile %s, errno=%d", lockfile, errno); + LOGE(ERROR, + "cannot open lockfile %s, errno=%d", + lockfile, errno); lock->carefd = libxl__carefd_opened(CTX, fd); if (fd < 0) goto out; @@ -433,21 +429,21 @@ libxl__domain_userdata_lock *libxl__lock_domain_userdata(libxl__gc *gc, continue; default: /* All other errno: EBADF, EINVAL, ENOLCK, EWOULDBLOCK */ - LOGED(ERROR, domid, - "unexpected error while trying to lock %s, fd=%d, errno=%d", + LOGE(ERROR, + "unexpected error while trying to lock %s, fd=%d, errno=%d", lockfile, fd, errno); goto out; } } if (fstat(fd, &fstab)) { - LOGED(ERROR, domid, "cannot fstat %s, fd=%d, errno=%d", + LOGE(ERROR, "cannot fstat %s, fd=%d, errno=%d", lockfile, fd, errno); goto out; } if (stat(lockfile, &stab)) { if (errno != ENOENT) { - LOGED(ERROR, domid, "cannot stat %s, errno=%d", lockfile, errno); + LOGE(ERROR, "cannot stat %s, errno=%d", lockfile, errno); goto out; } } else { @@ -458,20 +454,14 @@ libxl__domain_userdata_lock *libxl__lock_domain_userdata(libxl__gc *gc, libxl__carefd_close(lock->carefd); } - /* Check the domain is still there, if not we should release the - * lock and clean up. - */ - if (libxl_domain_info(CTX, NULL, domid)) - goto out; - return lock; out: - if (lock) libxl__unlock_domain_userdata(lock); + if (lock) libxl__unlock_file(lock); return NULL; } -void libxl__unlock_domain_userdata(libxl__domain_userdata_lock *lock) +void libxl__unlock_file(libxl__flock *lock) { /* It's important to unlink the file before closing fd to avoid * the following race (if close before unlink): @@ -493,6 +483,27 @@ void libxl__unlock_domain_userdata(libxl__domain_userdata_lock *lock) free(lock); } +libxl__flock *libxl__lock_domain_userdata(libxl__gc *gc, uint32_t domid) +{ + const char *lockfile; + libxl__flock *lock; + + lockfile = libxl__userdata_path(gc, domid, "domain-userdata-lock", "l"); + if (!lockfile) return NULL; + + lock = libxl__lock_file(gc, lockfile); + + /* Check the domain is still there, if not we should release the + * lock and clean up. + */ + if (libxl_domain_info(CTX, NULL, domid)) { + libxl__unlock_file(lock); + return NULL; + } + + return lock; +} + int libxl__get_domain_configuration(libxl__gc *gc, uint32_t domid, libxl_domain_config *d_config) { diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 3a00bdb8b4..3fb38220e5 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -4624,11 +4624,13 @@ int libxl__cpuid_policy_is_empty(libxl_cpuid_policy_list *pl); typedef struct { libxl__carefd *carefd; char *path; /* path of the lock file itself */ -} libxl__domain_userdata_lock; +} libxl__flock; /* The CTX_LOCK must be held around uses of this lock */ -libxl__domain_userdata_lock *libxl__lock_domain_userdata(libxl__gc *gc, - uint32_t domid); -void libxl__unlock_domain_userdata(libxl__domain_userdata_lock *lock); + +libxl__flock *libxl__lock_file(libxl__gc *gc, const char *filename); +void libxl__unlock_file(libxl__flock *lock); + +libxl__flock *libxl__lock_domain_userdata(libxl__gc *gc, uint32_t domid); /* * Retrieve / store domain configuration from / to libxl private diff --git a/tools/libxl/libxl_mem.c b/tools/libxl/libxl_mem.c index 7c01fac7e5..bc7b95aa74 100644 --- a/tools/libxl/libxl_mem.c +++ b/tools/libxl/libxl_mem.c @@ -30,7 +30,7 @@ int libxl_domain_setmaxmem(libxl_ctx *ctx, uint32_t domid, uint64_t max_memkb) uint64_t memorykb, size; char *dompath = libxl__xs_get_dompath(gc, domid); int rc = 1; - libxl__domain_userdata_lock *lock = NULL; + libxl__flock *lock = NULL; libxl_domain_config d_config; libxl_domain_config_init(&d_config); @@ -85,7 +85,7 @@ int libxl_domain_setmaxmem(libxl_ctx *ctx, uint32_t domid, uint64_t max_memkb) rc = 0; out: libxl_domain_config_dispose(&d_config); - if (lock) libxl__unlock_domain_userdata(lock); + if (lock) libxl__unlock_file(lock); CTX_UNLOCK; GC_FREE; return rc; @@ -184,7 +184,7 @@ int libxl_set_memory_target(libxl_ctx *ctx, uint32_t domid, libxl_dominfo ptr; char *uuid; xs_transaction_t t; - libxl__domain_userdata_lock *lock; + libxl__flock *lock; libxl_domain_config d_config; libxl_domain_config_init(&d_config); @@ -338,7 +338,7 @@ out: out_no_transaction: libxl_domain_config_dispose(&d_config); - if (lock) libxl__unlock_domain_userdata(lock); + if (lock) libxl__unlock_file(lock); CTX_UNLOCK; GC_FREE; return rc; diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c index 664d74c478..f91bce07ec 100644 --- a/tools/libxl/libxl_pci.c +++ b/tools/libxl/libxl_pci.c @@ -125,7 +125,7 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc, xs_transaction_t t = XBT_NULL; int rc; libxl_domain_config d_config; - libxl__domain_userdata_lock *lock = NULL; + libxl__flock *lock = NULL; bool is_stubdomain = libxl_is_stubdom(CTX, domid, NULL); /* Stubdomain doesn't have own config. */ @@ -195,7 +195,7 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc, out: libxl__xs_transaction_abort(gc, &t); - if (lock) libxl__unlock_domain_userdata(lock); + if (lock) libxl__unlock_file(lock); if (!is_stubdomain) libxl_domain_config_dispose(&d_config); return rc; diff --git a/tools/libxl/libxl_usb.c b/tools/libxl/libxl_usb.c index da5e3708e6..171bb04439 100644 --- a/tools/libxl/libxl_usb.c +++ b/tools/libxl/libxl_usb.c @@ -202,7 +202,7 @@ static int libxl__device_usbctrl_add_xenstore(libxl__gc *gc, uint32_t domid, int i, rc; libxl_domain_config d_config; libxl_device_usbctrl usbctrl_saved; - libxl__domain_userdata_lock *lock = NULL; + libxl__flock *lock = NULL; libxl_domain_config_init(&d_config); libxl_device_usbctrl_init(&usbctrl_saved); @@ -291,7 +291,7 @@ static int libxl__device_usbctrl_add_xenstore(libxl__gc *gc, uint32_t domid, out: libxl__xs_transaction_abort(gc, &t); - if (lock) libxl__unlock_domain_userdata(lock); + if (lock) libxl__unlock_file(lock); libxl_device_usbctrl_dispose(&usbctrl_saved); libxl_domain_config_dispose(&d_config); return rc; @@ -1266,7 +1266,7 @@ static int libxl__device_usbdev_add_xenstore(libxl__gc *gc, uint32_t domid, xs_transaction_t t = XBT_NULL; libxl_domain_config d_config; libxl_device_usbdev usbdev_saved; - libxl__domain_userdata_lock *lock = NULL; + libxl__flock *lock = NULL; libxl_domain_config_init(&d_config); libxl_device_usbdev_init(&usbdev_saved); @@ -1323,7 +1323,7 @@ static int libxl__device_usbdev_add_xenstore(libxl__gc *gc, uint32_t domid, rc = 0; out: - if (lock) libxl__unlock_domain_userdata(lock); + if (lock) libxl__unlock_file(lock); libxl_device_usbdev_dispose(&usbdev_saved); libxl_domain_config_dispose(&d_config); return rc;