linux/fs/ext2
Josh Hunt db273d3463 ext2: Fix link count corruption under heavy link+rename load
commit e8a80c6f76 upstream.

vfs_rename_other() does not lock renamed inode with i_mutex. Thus changing
i_nlink in a non-atomic manner (which happens in ext2_rename()) can corrupt
it as reported and analyzed by Josh.

In fact, there is no good reason to mess with i_nlink of the moved file.
We did it presumably to simulate linking into the new directory and unlinking
from an old one. But the practical effect of this is disputable because fsck
can possibly treat file as being properly linked into both directories without
writing any error which is confusing. So we just stop increment-decrement
games with i_nlink which also fixes the corruption.

CC: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Josh Hunt <johunt@akamai.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-03-07 15:17:54 -08:00
..
acl.c ext[234]: move over to 'check_acl' permission model 2009-09-08 11:09:04 -07:00
acl.h ext[234]: move over to 'check_acl' permission model 2009-09-08 11:09:04 -07:00
balloc.c ext2: Use lowercase names of quota functions 2009-03-26 02:18:36 +01:00
dir.c ext2: Do not update mtime of a moved directory 2009-06-18 13:03:44 -07:00
ext2.h switch ext2 to inode->i_acl 2009-06-24 08:15:28 -04:00
file.c ext[234]: move over to 'check_acl' permission model 2009-09-08 11:09:04 -07:00
ialloc.c ext2: Use lowercase names of quota functions 2009-03-26 02:18:36 +01:00
inode.c HWPOISON: Enable .remove_error_page for migration aware file systems 2009-09-16 11:50:16 +02:00
ioctl.c headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
Kconfig fs/Kconfig: move ext2, ext3, ext4, JBD, JBD2 out 2008-10-20 11:43:59 -07:00
Makefile switch ext2 to simple_fsync() 2009-06-11 21:36:12 -04:00
namei.c ext2: Fix link count corruption under heavy link+rename load 2011-03-07 15:17:54 -08:00
super.c switch ext2 to inode->i_acl 2009-06-24 08:15:28 -04:00
symlink.c
xattr_security.c ext2: remove double definitions of xattr macros 2008-07-25 10:53:31 -07:00
xattr_trusted.c ext2: remove double definitions of xattr macros 2008-07-25 10:53:31 -07:00
xattr_user.c ext2: remove double definitions of xattr macros 2008-07-25 10:53:31 -07:00
xattr.c ext2: Use lowercase names of quota functions 2009-03-26 02:18:36 +01:00
xattr.h
xip.c const: make block_device_operations const 2009-09-22 07:17:25 -07:00
xip.h xip: support non-struct page backed memory 2008-04-28 08:58:23 -07:00