Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 May 2016 17:20:20 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r299469 - head/sys/compat/linuxkpi/common/src
Message-ID:  <201605111720.u4BHKKFX043157@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Wed May 11 17:20:20 2016
New Revision: 299469
URL: https://svnweb.freebsd.org/changeset/base/299469

Log:
  Match Linux behaviour and iterate the IDR tree unlocked. The caller is
  responsible the IDR tree stays unmodified while iterating.
  
  MFC after:	1 week
  Sponsored by:	Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/src/linux_idr.c

Modified: head/sys/compat/linuxkpi/common/src/linux_idr.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_idr.c	Wed May 11 17:17:48 2016	(r299468)
+++ head/sys/compat/linuxkpi/common/src/linux_idr.c	Wed May 11 17:20:20 2016	(r299469)
@@ -593,15 +593,11 @@ idr_for_each_layer(struct idr_layer *il,
 	return (0);
 }
 
+/* NOTE: It is not allowed to modify the IDR tree while it is being iterated */
 int
 idr_for_each(struct idr *idp, int (*f)(int id, void *p, void *data), void *data)
 {
-	int err;
-
-	mtx_lock(&idp->lock);
-	err = idr_for_each_layer(idp->top, idp->layers - 1, f, data);
-	mtx_unlock(&idp->lock);
-	return (err);
+	return (idr_for_each_layer(idp->top, idp->layers - 1, f, data));
 }
 
 int



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605111720.u4BHKKFX043157>