linux-kernel-test/fs/ext4
Andrew Morton 71c5576fbd revert "percpu counter: clean up percpu_counter_sum_and_set()"
Revert

    commit 1f7c14c62c
    Author: Mingming Cao <cmm@us.ibm.com>
    Date:   Thu Oct 9 12:50:59 2008 -0400

        percpu counter: clean up percpu_counter_sum_and_set()

Before this patch we had the following:

percpu_counter_sum(): return the percpu_counter's value

percpu_counter_sum_and_set(): return the percpu_counter's value, copying
that value into the central value and zeroing the per-cpu counters before
returning.

After this patch, percpu_counter_sum_and_set() has gone, and
percpu_counter_sum() gets the old percpu_counter_sum_and_set()
functionality.

Problem is, as Eric points out, the old percpu_counter_sum_and_set()
functionality was racy and wrong.  It zeroes out counters on "other" cpus,
without holding any locks which will prevent races agaist updates from
those other CPUS.

This patch reverts 1f7c14c62c.  This means
that percpu_counter_sum_and_set() still has the race, but
percpu_counter_sum() does not.

Note that this is not a simple revert - ext4 has since started using
percpu_counter_sum() for its dirty_blocks counter as well.

Note that this revert patch changes percpu_counter_sum() semantics.

Before the patch, a call to percpu_counter_sum() will bring the counter's
central counter mostly up-to-date, so a following percpu_counter_read()
will return a close value.

After this patch, a call to percpu_counter_sum() will leave the counter's
central accumulator unaltered, so a subsequent call to
percpu_counter_read() can now return a significantly inaccurate result.

If there is any code in the tree which was introduced after
e8ced39d5e was merged, and which depends
upon the new percpu_counter_sum() semantics, that code will break.

Reported-by: Eric Dumazet <dada1@cosmosbay.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mingming Cao <cmm@us.ibm.com>
Cc: <linux-ext4@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-12-10 08:01:52 -08:00
..
acl.c [PATCH] sanitize ->permission() prototype 2008-07-26 20:53:14 -04:00
acl.h ext4: Rename ext4dev to ext4 2008-10-10 20:02:48 -04:00
balloc.c revert "percpu counter: clean up percpu_counter_sum_and_set()" 2008-12-10 08:01:52 -08:00
bitmap.c ext4: Fix whitespace checkpatch warnings/errors 2008-09-08 22:25:24 -04:00
dir.c ext4: Fix duplicate entries returned from getdents() system call 2008-10-25 22:37:55 -04:00
ext4_extents.h Hook ext4 to the vfs fiemap interface. 2008-10-07 00:46:36 -04:00
ext4_i.h ext4: Rename ext4dev to ext4 2008-10-10 20:02:48 -04:00
ext4_jbd2.c ext4: move headers out of include/linux 2008-04-29 18:13:32 -04:00
ext4_jbd2.h ext4: journal credits calulation cleanup and fix for non-extent writepage 2008-08-19 22:16:07 -04:00
ext4_sb.h ext4: Replace hackish ext4_mb_poll_new_transaction with commit callback 2008-10-16 20:00:24 -04:00
ext4.h merge ext4_claim_free_blocks & ext4_has_free_blocks 2008-10-28 00:08:12 -04:00
extents.c Hook ext4 to the vfs fiemap interface. 2008-10-07 00:46:36 -04:00
file.c ext4: Rename ext4dev to ext4 2008-10-10 20:02:48 -04:00
fsync.c ext4: Add debugging markers that can be used by systemtap 2008-10-05 20:50:06 -04:00
group.h ext4: Rename read_block_bitmap() to ext4_read_block_bitmap() 2008-07-11 19:27:31 -04:00
hash.c ext4: Fix whitespace checkpatch warnings/errors 2008-09-08 22:25:24 -04:00
ialloc.c ext4: add checksum calculation when clearing UNINIT flag in ext4_new_inode 2008-11-07 09:21:01 -05:00
inode.c ext4: Mark the buffer_heads as dirty and uptodate after prepare_write 2008-11-07 09:06:45 -05:00
ioctl.c ext4: add checks for errors from jbd2 2008-10-10 20:29:21 -04:00
Kconfig fs/Kconfig: move ext2, ext3, ext4, JBD, JBD2 out 2008-10-20 11:43:59 -07:00
Makefile ext4: Rename ext4dev to ext4 2008-10-10 20:02:48 -04:00
mballoc.c ext4: fix missing ext4_unlock_group in error path 2008-11-04 09:10:50 -05:00
mballoc.h ext4: Replace hackish ext4_mb_poll_new_transaction with commit callback 2008-10-16 20:00:24 -04:00
migrate.c ext4: elevate write count for migrate ioctl 2008-09-13 12:52:26 -04:00
namei.c ext4: remove unused variable in ext4_get_parent 2008-10-23 12:03:23 -07:00
namei.h
resize.c ext4: Remove old legacy block allocator 2008-10-10 09:40:52 -04:00
super.c ext4: Convert to host order before using the values. 2008-11-04 09:11:26 -05:00
symlink.c ext4: Rename ext4dev to ext4 2008-10-10 20:02:48 -04:00
xattr_security.c ext4: move headers out of include/linux 2008-04-29 18:13:32 -04:00
xattr_trusted.c ext4: remove double definitions of xattr macros 2008-07-11 19:27:31 -04:00
xattr_user.c ext4: remove double definitions of xattr macros 2008-07-11 19:27:31 -04:00
xattr.c ext4: Rename ext4dev to ext4 2008-10-10 20:02:48 -04:00
xattr.h ext4: Rename ext4dev to ext4 2008-10-10 20:02:48 -04:00