[Midnightbsd-cvs] src [8368] trunk/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c: zfs : wait in arc_lowmem only if curproc=pageproc

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Sep 18 15:00:53 EDT 2016


Revision: 8368
          http://svnweb.midnightbsd.org/src/?rev=8368
Author:   laffer1
Date:     2016-09-18 15:00:53 -0400 (Sun, 18 Sep 2016)
Log Message:
-----------
zfs: wait in arc_lowmem only if curproc=pageproc

Modified Paths:
--------------
    trunk/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c

Modified: trunk/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
===================================================================
--- trunk/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	2016-09-18 19:00:30 UTC (rev 8367)
+++ trunk/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	2016-09-18 19:00:53 UTC (rev 8368)
@@ -3729,8 +3729,16 @@
 	mutex_enter(&arc_reclaim_thr_lock);
 	needfree = 1;
 	cv_signal(&arc_reclaim_thr_cv);
-	while (needfree)
-		msleep(&needfree, &arc_reclaim_thr_lock, 0, "zfs:lowmem", 0);
+
+	/*
+	 * It is unsafe to block here in arbitrary threads, because we can come
+	 * here from ARC itself and may hold ARC locks and thus risk a deadlock
+	 * with ARC reclaim thread.
+	 */
+	if (curproc == pageproc) {
+		while (needfree)
+			msleep(&needfree, &arc_reclaim_thr_lock, 0, "zfs:lowmem", 0);
+	}
 	mutex_exit(&arc_reclaim_thr_lock);
 	mutex_exit(&arc_lowmem_lock);
 }



More information about the Midnightbsd-cvs mailing list