Author: mjg
Date: Sun May 12 07:56:01 2019
New Revision: 347510
URL: https://svnweb.freebsd.org/changeset/base/347510

Log:
  cache: fix a brainfart in r347505
  
  If bumping over the counter goes over the limit we have to decrement it back.
  
  Previous code would only bump the counter after adding the entry (thus 
allowing
  the cache to go over the limit).
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==============================================================================
--- head/sys/kern/vfs_cache.c   Sun May 12 07:55:25 2019        (r347509)
+++ head/sys/kern/vfs_cache.c   Sun May 12 07:56:01 2019        (r347510)
@@ -1647,8 +1647,10 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, 
         * Avoid blowout in namecache entries.
         */
        lnumcache = atomic_fetchadd_long(&numcache, 1) + 1;
-       if (__predict_false(lnumcache >= desiredvnodes * ncsizefactor))
+       if (__predict_false(lnumcache >= desiredvnodes * ncsizefactor)) {
+               atomic_add_long(&numcache, -1);
                return;
+       }
 
        cache_celockstate_init(&cel);
        ndd = NULL;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to