mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [merged] tmpfs-fix-off-by-one-in-max_blocks-checks.patch removed from -mm tree
@ 2011-04-18 18:02 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2011-04-18 18:02 UTC (permalink / raw)
  To: hughd, tim.c.chen, mm-commits


The patch titled
     tmpfs: fix off-by-one in max_blocks checks
has been removed from the -mm tree.  Its filename was
     tmpfs-fix-off-by-one-in-max_blocks-checks.patch

This patch was dropped because it was merged into mainline or a subsystem tree

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: tmpfs: fix off-by-one in max_blocks checks
From: Hugh Dickins <hughd@google.com>

If you fill up a tmpfs, df was showing
tmpfs                   460800         -         -   -  /tmp
because of an off-by-one in the max_blocks checks.  Fix it so df shows
tmpfs                   460800    460800         0 100% /tmp

Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/shmem.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff -puN mm/shmem.c~tmpfs-fix-off-by-one-in-max_blocks-checks mm/shmem.c
--- a/mm/shmem.c~tmpfs-fix-off-by-one-in-max_blocks-checks
+++ a/mm/shmem.c
@@ -421,7 +421,8 @@ static swp_entry_t *shmem_swp_alloc(stru
 		 * a waste to allocate index if we cannot allocate data.
 		 */
 		if (sbinfo->max_blocks) {
-			if (percpu_counter_compare(&sbinfo->used_blocks, (sbinfo->max_blocks - 1)) > 0)
+			if (percpu_counter_compare(&sbinfo->used_blocks,
+						sbinfo->max_blocks - 1) >= 0)
 				return ERR_PTR(-ENOSPC);
 			percpu_counter_inc(&sbinfo->used_blocks);
 			spin_lock(&inode->i_lock);
@@ -1397,7 +1398,8 @@ repeat:
 		shmem_swp_unmap(entry);
 		sbinfo = SHMEM_SB(inode->i_sb);
 		if (sbinfo->max_blocks) {
-			if ((percpu_counter_compare(&sbinfo->used_blocks, sbinfo->max_blocks) > 0) ||
+			if (percpu_counter_compare(&sbinfo->used_blocks,
+						sbinfo->max_blocks) >= 0 ||
 			    shmem_acct_block(info->flags)) {
 				spin_unlock(&info->lock);
 				error = -ENOSPC;
_

Patches currently in -mm which might be from hughd@google.com are

origin.patch
mmap-add-alignment-for-some-variables.patch
mmap-avoid-unnecessary-anon_vma-lock.patch
mmap-avoid-merging-cloned-vmas.patch
mm-convert-vma-vm_flags-to-64-bit.patch
mm-add-__nocast-attribute-to-vm_flags.patch
fremap-convert-vm_flags-to-unsigned-long-long.patch
procfs-convert-vm_flags-to-unsigned-long-long.patch
oom-replace-pf_oom_origin-with-toggling-oom_score_adj.patch
oom-replace-pf_oom_origin-with-toggling-oom_score_adj-update.patch
mm-batch-activate_page-to-reduce-lock-contention.patch
prio_tree-debugging-patch.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-04-18 18:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-18 18:02 [merged] tmpfs-fix-off-by-one-in-max_blocks-checks.patch removed from -mm tree akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).