From nobody Wed Nov 27 18:49:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1542200599262232.2272198135082; Wed, 14 Nov 2018 05:03:19 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C14988AE71; Wed, 14 Nov 2018 13:03:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 52989608EE; Wed, 14 Nov 2018 13:03:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E983718005AD; Wed, 14 Nov 2018 13:03:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wAECjCdH026324 for ; Wed, 14 Nov 2018 07:45:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id BEEF36E727; Wed, 14 Nov 2018 12:45:12 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 44AD56E731 for ; Wed, 14 Nov 2018 12:45:04 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 14 Nov 2018 13:44:43 +0100 Message-Id: <1d4e0960113d1953c77e22408eb5ba7765935973.1542193371.git.mprivozn@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 15/15] Revert "virlockspace: Allow caller to specify start and length offset in virLockSpaceAcquireResource" X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 14 Nov 2018 13:03:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This reverts commit afd5a27575e8b6a494d2728552fe0e89c71e32b4. Signed-off-by: Michal Privoznik --- src/locking/lock_daemon_dispatch.c | 3 --- src/util/virlockspace.c | 15 +++++---------- src/util/virlockspace.h | 4 ---- tests/virlockspacetest.c | 29 +++++------------------------ 4 files changed, 10 insertions(+), 41 deletions(-) diff --git a/src/locking/lock_daemon_dispatch.c b/src/locking/lock_daemon_d= ispatch.c index 10248ec0b5..1b479db55d 100644 --- a/src/locking/lock_daemon_dispatch.c +++ b/src/locking/lock_daemon_dispatch.c @@ -50,8 +50,6 @@ virLockSpaceProtocolDispatchAcquireResource(virNetServerP= tr server ATTRIBUTE_UNU virNetServerClientGetPrivateData(client); virLockSpacePtr lockspace; unsigned int newFlags; - off_t start =3D 0; - off_t len =3D 1; =20 virMutexLock(&priv->lock); =20 @@ -86,7 +84,6 @@ virLockSpaceProtocolDispatchAcquireResource(virNetServerP= tr server ATTRIBUTE_UNU if (virLockSpaceAcquireResource(lockspace, args->name, priv->ownerPid, - start, len, newFlags) < 0) goto cleanup; =20 diff --git a/src/util/virlockspace.c b/src/util/virlockspace.c index 79fa48d365..0736b4b85b 100644 --- a/src/util/virlockspace.c +++ b/src/util/virlockspace.c @@ -115,10 +115,8 @@ static void virLockSpaceResourceFree(virLockSpaceResou= rcePtr res) static virLockSpaceResourcePtr virLockSpaceResourceNew(virLockSpacePtr lockspace, const char *resname, - pid_t owner, - off_t start, - off_t len, - unsigned int flags) + unsigned int flags, + pid_t owner) { virLockSpaceResourcePtr res; bool shared =3D !!(flags & VIR_LOCK_SPACE_ACQUIRE_SHARED); @@ -159,7 +157,7 @@ virLockSpaceResourceNew(virLockSpacePtr lockspace, goto error; } =20 - if (virFileLock(res->fd, shared, start, len, false) < 0) { + if (virFileLock(res->fd, shared, 0, 1, false) < 0) { if (errno =3D=3D EACCES || errno =3D=3D EAGAIN) { virReportError(VIR_ERR_RESOURCE_BUSY, _("Lockspace resource '%s' is locked"), @@ -206,7 +204,7 @@ virLockSpaceResourceNew(virLockSpacePtr lockspace, goto error; } =20 - if (virFileLock(res->fd, shared, start, len, false) < 0) { + if (virFileLock(res->fd, shared, 0, 1, false) < 0) { if (errno =3D=3D EACCES || errno =3D=3D EAGAIN) { virReportError(VIR_ERR_RESOURCE_BUSY, _("Lockspace resource '%s' is locked"), @@ -614,8 +612,6 @@ int virLockSpaceDeleteResource(virLockSpacePtr lockspac= e, int virLockSpaceAcquireResource(virLockSpacePtr lockspace, const char *resname, pid_t owner, - off_t start, - off_t len, unsigned int flags) { int ret =3D -1; @@ -645,8 +641,7 @@ int virLockSpaceAcquireResource(virLockSpacePtr lockspa= ce, goto cleanup; } =20 - if (!(res =3D virLockSpaceResourceNew(lockspace, resname, - owner, start, len, flags))) + if (!(res =3D virLockSpaceResourceNew(lockspace, resname, flags, owner= ))) goto cleanup; =20 if (virHashAddEntry(lockspace->resources, resname, res) < 0) { diff --git a/src/util/virlockspace.h b/src/util/virlockspace.h index 24f2c89be6..041cf20396 100644 --- a/src/util/virlockspace.h +++ b/src/util/virlockspace.h @@ -22,8 +22,6 @@ #ifndef __VIR_LOCK_SPACE_H__ # define __VIR_LOCK_SPACE_H__ =20 -# include - # include "internal.h" # include "virjson.h" =20 @@ -52,8 +50,6 @@ typedef enum { int virLockSpaceAcquireResource(virLockSpacePtr lockspace, const char *resname, pid_t owner, - off_t start, - off_t len, unsigned int flags); =20 int virLockSpaceReleaseResource(virLockSpacePtr lockspace, diff --git a/tests/virlockspacetest.c b/tests/virlockspacetest.c index 3c621e7eb0..93353be285 100644 --- a/tests/virlockspacetest.c +++ b/tests/virlockspacetest.c @@ -98,8 +98,6 @@ static int testLockSpaceResourceLockExcl(const void *args= ATTRIBUTE_UNUSED) { virLockSpacePtr lockspace; int ret =3D -1; - const off_t start =3D 0; - const off_t len =3D 1; =20 rmdir(LOCKSPACE_DIR); =20 @@ -112,13 +110,13 @@ static int testLockSpaceResourceLockExcl(const void *= args ATTRIBUTE_UNUSED) if (virLockSpaceCreateResource(lockspace, "foo") < 0) goto cleanup; =20 - if (virLockSpaceAcquireResource(lockspace, "foo", geteuid(), start, le= n, 0) < 0) + if (virLockSpaceAcquireResource(lockspace, "foo", geteuid(), 0) < 0) goto cleanup; =20 if (!virFileExists(LOCKSPACE_DIR "/foo")) goto cleanup; =20 - if (virLockSpaceAcquireResource(lockspace, "foo", geteuid(), start, le= n, 0) =3D=3D 0) + if (virLockSpaceAcquireResource(lockspace, "foo", geteuid(), 0) =3D=3D= 0) goto cleanup; =20 if (virLockSpaceDeleteResource(lockspace, "foo") =3D=3D 0) @@ -146,8 +144,6 @@ static int testLockSpaceResourceLockExclAuto(const void= *args ATTRIBUTE_UNUSED) { virLockSpacePtr lockspace; int ret =3D -1; - const off_t start =3D 0; - const off_t len =3D 1; =20 rmdir(LOCKSPACE_DIR); =20 @@ -161,7 +157,6 @@ static int testLockSpaceResourceLockExclAuto(const void= *args ATTRIBUTE_UNUSED) goto cleanup; =20 if (virLockSpaceAcquireResource(lockspace, "foo", geteuid(), - start, len, VIR_LOCK_SPACE_ACQUIRE_AUTOCREATE) < 0) goto cleanup; =20 @@ -187,8 +182,6 @@ static int testLockSpaceResourceLockShr(const void *arg= s ATTRIBUTE_UNUSED) { virLockSpacePtr lockspace; int ret =3D -1; - const off_t start =3D 0; - const off_t len =3D 1; =20 rmdir(LOCKSPACE_DIR); =20 @@ -202,16 +195,13 @@ static int testLockSpaceResourceLockShr(const void *a= rgs ATTRIBUTE_UNUSED) goto cleanup; =20 if (virLockSpaceAcquireResource(lockspace, "foo", geteuid(), - start, len, VIR_LOCK_SPACE_ACQUIRE_SHARED) < 0) goto cleanup; =20 - if (virLockSpaceAcquireResource(lockspace, "foo", - geteuid(), start, len, 0) =3D=3D 0) + if (virLockSpaceAcquireResource(lockspace, "foo", geteuid(), 0) =3D=3D= 0) goto cleanup; =20 if (virLockSpaceAcquireResource(lockspace, "foo", geteuid(), - start, len, VIR_LOCK_SPACE_ACQUIRE_SHARED) < 0) goto cleanup; =20 @@ -246,8 +236,6 @@ static int testLockSpaceResourceLockShrAuto(const void = *args ATTRIBUTE_UNUSED) { virLockSpacePtr lockspace; int ret =3D -1; - const off_t start =3D 0; - const off_t len =3D 1; =20 rmdir(LOCKSPACE_DIR); =20 @@ -261,7 +249,6 @@ static int testLockSpaceResourceLockShrAuto(const void = *args ATTRIBUTE_UNUSED) goto cleanup; =20 if (virLockSpaceAcquireResource(lockspace, "foo", geteuid(), - start, len, VIR_LOCK_SPACE_ACQUIRE_SHARED | VIR_LOCK_SPACE_ACQUIRE_AUTOCREATE) < 0) goto cleanup; @@ -270,7 +257,6 @@ static int testLockSpaceResourceLockShrAuto(const void = *args ATTRIBUTE_UNUSED) goto cleanup; =20 if (virLockSpaceAcquireResource(lockspace, "foo", geteuid(), - start, len, VIR_LOCK_SPACE_ACQUIRE_AUTOCREATE) =3D= =3D 0) goto cleanup; =20 @@ -278,7 +264,6 @@ static int testLockSpaceResourceLockShrAuto(const void = *args ATTRIBUTE_UNUSED) goto cleanup; =20 if (virLockSpaceAcquireResource(lockspace, "foo", geteuid(), - start, len, VIR_LOCK_SPACE_ACQUIRE_SHARED | VIR_LOCK_SPACE_ACQUIRE_AUTOCREATE) < 0) goto cleanup; @@ -311,8 +296,6 @@ static int testLockSpaceResourceLockPath(const void *ar= gs ATTRIBUTE_UNUSED) { virLockSpacePtr lockspace; int ret =3D -1; - const off_t start =3D 0; - const off_t len =3D 1; =20 rmdir(LOCKSPACE_DIR); =20 @@ -325,15 +308,13 @@ static int testLockSpaceResourceLockPath(const void *= args ATTRIBUTE_UNUSED) if (virLockSpaceCreateResource(lockspace, LOCKSPACE_DIR "/foo") < 0) goto cleanup; =20 - if (virLockSpaceAcquireResource(lockspace, LOCKSPACE_DIR "/foo", - geteuid(), start, len, 0) < 0) + if (virLockSpaceAcquireResource(lockspace, LOCKSPACE_DIR "/foo", geteu= id(), 0) < 0) goto cleanup; =20 if (!virFileExists(LOCKSPACE_DIR "/foo")) goto cleanup; =20 - if (virLockSpaceAcquireResource(lockspace, LOCKSPACE_DIR "/foo", - geteuid(), start, len, 0) =3D=3D 0) + if (virLockSpaceAcquireResource(lockspace, LOCKSPACE_DIR "/foo", geteu= id(), 0) =3D=3D 0) goto cleanup; =20 if (virLockSpaceDeleteResource(lockspace, LOCKSPACE_DIR "/foo") =3D=3D= 0) --=20 2.18.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list