Print this page
7178 tmpfs incorrectly calculates amount of free space

@@ -19,10 +19,11 @@
  * CDDL HEADER END
  */
 /*
  * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ * Copyright 2016 RackTop Systems.
  */
 
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/sysmacros.h>

@@ -587,11 +588,11 @@
 
         /*
          * If tm_anonmax for this mount is less than the available swap space
          * (minus the amount tmpfs can't use), use that instead
          */
-        if (blocks > tmpfs_minfree)
+        if (blocks > tmpfs_minfree && tm->tm_anonmax > tm->tm_anonmem)
                 sbp->f_bfree = MIN(blocks - tmpfs_minfree,
                     tm->tm_anonmax - tm->tm_anonmem);
         else
                 sbp->f_bfree = 0;