Author: avg
Date: Sat Nov 10 12:06:36 2012
New Revision: 242859
URL: http://svnweb.freebsd.org/changeset/base/242859

Log:
  MFC r241773: zfs: wait in arc_lowmem only if curproc == pageproc

Modified:
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/cddl/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)

Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==============================================================================
--- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c       Sat Nov 
10 12:06:24 2012        (r242858)
+++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c       Sat Nov 
10 12:06:36 2012        (r242859)
@@ -3718,8 +3718,16 @@ arc_lowmem(void *arg __unused, int howto
        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);
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to