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
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to