linux/fs
Nick Piggin a4b0672db3 fs: fix nobh error handling
nobh mode error handling is not just pretty slack, it's wrong.

One cannot zero out the whole page to ensure new blocks are zeroed, because
it just brings the whole page "uptodate" with zeroes even if that may not
be the correct uptodate data.  Also, other parts of the page may already
contain dirty data which would get lost by zeroing it out.  Thirdly, the
writeback of zeroes to the new blocks will also erase existing blocks.  All
these conditions are pagecache and/or filesystem corruption.

The problem comes about because we didn't keep track of which buffers
actually are new or old.  However it is not enough just to keep only this
state, because at the point we start dirtying parts of the page (new
blocks, with zeroes), the handling of IO errors becomes impossible without
buffers because the page may only be partially uptodate, in which case the
page flags allone cannot capture the state of the parts of the page.

So allocate all buffers for the page upfront, but leave them unattached so
that they don't pick up any other references and can be freed when we're
done.  If the error path is hit, then zero the new buffers as the regular
buffer path does, then attach the buffers to the page so that it can
actually be written out correctly and be subject to the normal IO error
handling paths.

As an upshot, we save 1K of kernel stack on ia64 or powerpc 64K page
systems.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-16 09:42:54 -07:00
..
9p 9PFS: clean up explicit check for mandatory locks 2007-10-09 18:32:46 -04:00
adfs
affs
afs Merge branch 'locks' of git://linux-nfs.org/~bfields/linux 2007-10-15 16:07:40 -07:00
autofs
autofs4 autofs4: deadlock during create 2007-08-22 19:52:46 -07:00
befs
bfs
cifs [CIFS] Check return code on failed alloc 2007-08-18 00:15:20 +00:00
coda
configfs
cramfs
debugfs docbook: fix filesystems content 2007-10-15 17:56:36 -07:00
devpts
dlm Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6 2007-10-12 15:49:37 -07:00
ecryptfs [NET]: make netlink user -> kernel interface synchronious 2007-10-10 21:15:29 -07:00
efs
exportfs
ext2
ext3 readahead: combine file_ra_state.prev_index/prev_offset into prev_pos 2007-10-16 09:42:52 -07:00
ext4 readahead: combine file_ra_state.prev_index/prev_offset into prev_pos 2007-10-16 09:42:52 -07:00
fat
freevxfs
fuse
gfs2 Merge branch 'locks' of git://linux-nfs.org/~bfields/linux 2007-10-15 16:07:40 -07:00
hfs
hfsplus
hostfs
hpfs
hppfs
hugetlbfs hugepage: fix broken check for offset alignment in hugepage mappings 2007-08-31 01:42:23 -07:00
isofs
jbd lockdep: annotate journal_start() 2007-10-11 22:11:12 +02:00
jbd2
jffs2 Merge Linux 2.6.23 2007-10-13 14:43:54 +01:00
jfs more low-hanging fruits - kernel, fs, lib signedness 2007-10-14 12:41:52 -07:00
lockd NFS/SUNRPC: use transport protocol naming 2007-10-09 17:17:53 -04:00
minix
msdos
ncpfs
nfs Merge branch 'locks' of git://linux-nfs.org/~bfields/linux 2007-10-15 16:07:40 -07:00
nfs_common
nfsd Merge branch 'locks' of git://linux-nfs.org/~bfields/linux 2007-10-15 16:07:40 -07:00
nls
ntfs NTFS: Fix a mount time deadlock. 2007-10-12 09:16:30 -07:00
ocfs2 Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6 2007-10-12 15:49:37 -07:00
openpromfs
partitions fs/partitions/sun.c endianness annotations 2007-10-14 12:41:51 -07:00
proc Merge branch 'locks' of git://linux-nfs.org/~bfields/linux 2007-10-15 16:07:40 -07:00
qnx4
ramfs
reiserfs quota: fix infinite loop 2007-09-11 17:21:19 -07:00
romfs
smbfs more low-hanging fruits - kernel, fs, lib signedness 2007-10-14 12:41:52 -07:00
sysfs sysfs: add copyrights 2007-10-12 14:51:12 -07:00
sysv
udf Fix possible NULL pointer dereference in udf_table_free_blocks() 2007-08-31 01:42:22 -07:00
ufs ufs: fix sun state 2007-09-25 08:51:04 -07:00
vfat
xfs Fix up more bio fallout 2007-10-12 00:29:50 -07:00
aio.c AIO: fix cleanup in io_submit_one(...) 2007-10-08 12:58:14 -07:00
anon_inodes.c
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf.c remove ZERO_PAGE 2007-10-16 09:42:53 -07:00
binfmt_elf_fdpic.c remove ZERO_PAGE 2007-10-16 09:42:53 -07:00
binfmt_em86.c
binfmt_flat.c binfmt_flat: checkpatch fixing minimum support for the blackfin relocations 2007-10-03 23:43:57 +08:00
binfmt_misc.c
binfmt_script.c
binfmt_som.c
bio.c Drop 'size' argument from bio_endio and bi_end_io 2007-10-10 09:25:57 +02:00
block_dev.c Drop 'size' argument from bio_endio and bi_end_io 2007-10-10 09:25:57 +02:00
buffer.c fs: fix nobh error handling 2007-10-16 09:42:54 -07:00
char_dev.c
compat.c
compat_ioctl.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2007-10-11 19:40:14 -07:00
dcache.c
dcookies.c
direct-io.c remove ZERO_PAGE 2007-10-16 09:42:53 -07:00
dnotify.c
dquot.c
drop_caches.c
eventfd.c
eventpoll.c
exec.c signalfd simplification 2007-09-20 13:19:59 -07:00
fcntl.c
fifo.c
file.c
file_table.c
filesystems.c
fs-writeback.c Fix warnings with !CONFIG_BLOCK 2007-10-10 09:25:57 +02:00
generic_acl.c
inode.c lockdep: per filesystem inode lock class 2007-10-15 14:51:31 +02:00
inotify.c
inotify_user.c
internal.h
ioctl.c
ioprio.c
Kconfig Merge git://git.linux-nfs.org/pub/linux/nfs-2.6 2007-10-15 10:47:35 -07:00
Kconfig.binfmt
libfs.c
locks.c Rework /proc/locks via seq_files and seq_list helpers 2007-10-09 18:32:46 -04:00
Makefile
mbcache.c
mpage.c Drop 'size' argument from bio_endio and bi_end_io 2007-10-10 09:25:57 +02:00
namei.c
namespace.c
nfsctl.c
no-block.c
open.c
pipe.c sched: affine sync wakeups 2007-10-15 17:00:19 +02:00
pnode.c
pnode.h
posix_acl.c
quota.c
quota_v1.c
quota_v2.c
read_write.c Cleanup macros for distinguishing mandatory locks 2007-10-09 18:32:46 -04:00
read_write.h
readdir.c
select.c Fix select on /proc files without ->poll 2007-09-11 17:21:20 -07:00
seq_file.c [FS] seq_file: Introduce the seq_open_private() 2007-10-10 16:55:33 -07:00
signalfd.c signalfd simplification 2007-09-20 13:19:59 -07:00
splice.c readahead: combine file_ra_state.prev_index/prev_offset into prev_pos 2007-10-16 09:42:52 -07:00
stack.c
stat.c
super.c
sync.c
timerfd.c
utimes.c
xattr.c
xattr_acl.c