From nobody Mon Apr 29 01:42:32 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 152719158380993.39424954925767; Thu, 24 May 2018 12:53:03 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AB16430A6646; Thu, 24 May 2018 19:53:01 +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 0486FD1E6; Thu, 24 May 2018 19:53:01 +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 7E5E018033ED; Thu, 24 May 2018 19:52:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4OJquC2032262 for ; Thu, 24 May 2018 15:52:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id DDDE6308BDA4; Thu, 24 May 2018 19:52:56 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-137.phx2.redhat.com [10.3.116.137]) by smtp.corp.redhat.com (Postfix) with ESMTP id 755B6308BDA3 for ; Thu, 24 May 2018 19:52:54 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Thu, 24 May 2018 15:52:52 -0400 Message-Id: <20180524195252.10479-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] storage: Remove rwlocks during virStoragePoolObjListForEach 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Thu, 24 May 2018 19:53:02 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Remove the locks since they are unnecessary and would cause a hang for a driver reload/restart when a transient pool was previously active as a result of the call: virStoragePoolUpdateInactive: ... if (!virStoragePoolObjGetConfigFile(obj)) { virStoragePoolObjRemove(driver->pools, obj); ... stack trace: Thread 17 (Thread 0x7fffcc574700 (LWP 12465)): ...pthread_rwlock_wrlock ...virRWLockWrite ...virObjectRWLockWrite ...virStoragePoolObjRemove ...virStoragePoolUpdateInactive ...storagePoolUpdateStateCallback ...virStoragePoolObjListForEachCb ...virHashForEach ...virStoragePoolObjListForEach ...storagePoolUpdateAllState ...storageStateInitialize ...virStateInitialize ...daemonRunStateInit ...virThreadHelper ...start_thread ...clone Introduced by commit id 4b2e0ed6e3. Signed-off-by: John Ferlan --- src/conf/virstorageobj.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c index 6c937f105c..e66b2ebfb2 100644 --- a/src/conf/virstorageobj.c +++ b/src/conf/virstorageobj.c @@ -438,6 +438,12 @@ virStoragePoolObjListForEachCb(void *payload, * not as it's being used for Autostart and UpdateAllState callers * that want to iterate over all the @pools objects not stopping if * one happens to fail. + * + * NB: We cannot take the Storage Pool lock here because it's possible + * that some action as part of Autostart or UpdateAllState will need + * to modify/destroy a transient pool. Since these paths only occur + * during periods in which the storageDriverLock is held (Initializati= on, + * AutoStart, or Reload) this is OK. */ void virStoragePoolObjListForEach(virStoragePoolObjListPtr pools, @@ -447,9 +453,7 @@ virStoragePoolObjListForEach(virStoragePoolObjListPtr p= ools, struct _virStoragePoolObjListForEachData data =3D { .iter =3D iter, .opaque =3D opaque }; =20 - virObjectRWLockRead(pools); virHashForEach(pools->objs, virStoragePoolObjListForEachCb, &data); - virObjectRWUnlock(pools); } =20 =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list