linux/fs/ext3
Arthur Jones c87591b719 ext3: wait on all pending commits in ext3_sync_fs
In ext3_sync_fs, we only wait for a commit to finish if we started it, but
there may be one already in progress which will not be synced.

In the case of a data=ordered umount with pending long symlinks which are
delayed due to a long list of other I/O on the backing block device, this
causes the buffer associated with the long symlinks to not be moved to the
inode dirty list in the second phase of fsync_super.  Then, before they
can be dirtied again, kjournald exits, seeing the UMOUNT flag and the
dirty pages are never written to the backing block device, causing long
symlink corruption and exposing new or previously freed block data to
userspace.

This can be reproduced with a script created
by Eric Sandeen <sandeen@redhat.com>:

	#!/bin/bash

	umount /mnt/test2
	mount /dev/sdb4 /mnt/test2
	rm -f /mnt/test2/*
	dd if=/dev/zero of=/mnt/test2/bigfile bs=1M count=512
	touch
	/mnt/test2/thisisveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryverylongfilename
	ln -s
	/mnt/test2/thisisveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryverylongfilename
	/mnt/test2/link
	umount /mnt/test2
	mount /dev/sdb4 /mnt/test2
	ls /mnt/test2/
	umount /mnt/test2

To ensure all commits are synced, we flush all journal commits now when
sync_fs'ing ext3.

Signed-off-by: Arthur Jones <ajones@riverbed.com>
Cc: Eric Sandeen <sandeen@redhat.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: <linux-ext4@vger.kernel.org>
Cc: <stable@kernel.org>		[2.6.everything]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-11-06 15:41:19 -08:00
..
Kconfig fs/Kconfig: move ext2, ext3, ext4, JBD, JBD2 out 2008-10-20 11:43:59 -07:00
Makefile [PATCH] ext3: uninline large functions 2006-12-07 08:39:35 -08:00
acl.c [PATCH] sanitize ->permission() prototype 2008-07-26 20:53:14 -04:00
acl.h [PATCH] sanitize ->permission() prototype 2008-07-26 20:53:14 -04:00
balloc.c ext3: fix ext3 block reservation early ENOSPC issue 2008-10-20 08:52:37 -07:00
bitmap.c fs: mark nibblemap const 2007-10-17 08:42:47 -07:00
dir.c ext3: Fix duplicate entries returned from getdents() system call 2008-10-25 22:37:44 -04:00
ext3_jbd.c ext3: replace remaining __FUNCTION__ occurrences 2008-04-28 08:58:45 -07:00
file.c generic block based fiemap implementation 2008-10-03 17:32:43 -04:00
fsync.c ext3: fdatasync should skip metadata writeout when overwriting 2008-04-28 08:58:43 -07:00
hash.c [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
ialloc.c ext3: handle corrupted orphan list at mount 2008-07-25 10:53:32 -07:00
inode.c ext3: truncate block allocated on a failed ext3_write_begin 2008-10-20 08:52:38 -07:00
ioctl.c ext3: add checks for errors from jbd 2008-10-23 08:55:01 -07:00
namei.c [PATCH] get rid of on-stack fake dentry in ext3_get_parent() 2008-10-23 05:13:08 -04:00
namei.h [PATCH] ext3: sparse fixes 2005-10-30 17:37:25 -08:00
resize.c ext3: don't try to resize if there are no reserved gdt blocks left 2008-10-20 08:52:37 -07:00
super.c ext3: wait on all pending commits in ext3_sync_fs 2008-11-06 15:41:19 -08:00
symlink.c [PATCH] mark struct inode_operations const 1 2007-02-12 09:48:46 -08:00
xattr.c ext3/4: fix uninitialized bs in ext3/4_xattr_set_handle() 2008-05-14 19:11:14 -07:00
xattr.h make ext3_xattr_list() static 2008-04-28 08:58:44 -07:00
xattr_security.c ext3: remove double definitions of xattr macros 2008-07-25 10:53:32 -07:00
xattr_trusted.c ext3: remove double definitions of xattr macros 2008-07-25 10:53:32 -07:00
xattr_user.c ext3: remove double definitions of xattr macros 2008-07-25 10:53:32 -07:00