kernel-ark/fs
Nick Piggin ad576e63e0 [PATCH] __block_write_full_page race fix
When running
	fsstress -v -d $DIR/tmp -n 1000 -p 1000 -l 2
on an ext2 filesystem with 1024 byte block size, on SMP i386 with 4096 byte
page size over loopback to an image file on a tmpfs filesystem, I would
very quickly hit
	BUG_ON(!buffer_async_write(bh));
in fs/buffer.c:end_buffer_async_write

It seems that more than one request would be submitted for a given bh
at a time.

What would happen is the following:
2 threads doing __mpage_writepages on the same page.
Thread 1 - lock the page first, and enter __block_write_full_page.
Thread 1 - (eg.) mark_buffer_async_write on the first 2 buffers.
Thread 1 - set page writeback, unlock page.
Thread 2 - lock page, wait on page writeback
Thread 1 - submit_bh on the first 2 buffers.
=> both requests complete, none of the page buffers are async_write,
   end_page_writeback is called.
Thread 2 - wakes up. enters __block_write_full_page.
Thread 2 - mark_buffer_async_write on (eg.) the last buffer
Thread 1 - finds the last buffer has async_write set, submit_bh on that.
Thread 2 - submit_bh on the last buffer.
=> oops.

So change __block_write_full_page to explicitly keep track of the last bh
we need to issue, so we don't touch anything after issuing the last
request.

Signed-off-by: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-05 16:36:40 -07:00
..
adfs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
affs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
afs [PATCH] Exterminate PAGE_BUG 2005-05-01 08:59:01 -07:00
autofs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
autofs4 [PATCH] autofs4: tree race fix 2005-05-01 08:59:17 -07:00
befs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
bfs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cifs [PATCH] cifs: Update cifs todo list 2005-04-30 11:10:58 -07:00
coda Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cramfs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
debugfs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
devfs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
devpts Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
efs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
exportfs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ext2 [PATCH] ext2 corruption - regression between 2.6.9 and 2.6.10 2005-04-16 15:25:45 -07:00
ext3 [PATCH] ext3: remove unnecessary race then retry in ext3_get_block 2005-05-01 08:59:20 -07:00
fat Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
freevxfs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hfs [PATCH] hfs, hfsplus: don't leak s_fs_info and fix an oops 2005-05-01 08:59:16 -07:00
hfsplus [PATCH] hfs, hfsplus: don't leak s_fs_info and fix an oops 2005-05-01 08:59:16 -07:00
hostfs [PATCH] uml: hostfs failed mount handling 2005-05-05 16:36:37 -07:00
hpfs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hppfs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hugetlbfs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
isofs [PATCH] isofs includes sanitized 2005-04-25 18:32:12 -07:00
jbd [PATCH] jbd dirty buffer leak fix 2005-04-16 15:26:36 -07:00
jffs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
jffs2 [PATCH] Exterminate PAGE_BUG 2005-05-01 08:59:01 -07:00
jfs JFS: Endian errors 2005-05-04 09:11:49 -05:00
lockd Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
minix Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
msdos Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ncpfs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
nfs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
nfsd [PATCH] nfsd4: fix struct file leak 2005-04-16 15:26:38 -07:00
nls Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ntfs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
openpromfs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
partitions [PATCH] kobject/hotplug split - block core 2005-04-18 21:57:36 -07:00
proc Merge with master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6.git 2005-05-03 08:14:09 +01:00
qnx4 Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ramfs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
reiserfs [PATCH] reiserfs endianness: comp_short_keys() cleanup 2005-05-01 08:59:19 -07:00
romfs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
smbfs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sysfs [PATCH] DocBook: fix some descriptions 2005-05-01 08:59:26 -07:00
sysv Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
udf [PATCH] Exterminate PAGE_BUG 2005-05-01 08:59:01 -07:00
ufs Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
umsdos Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
vfat Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
xfs [XFS] Cleanup use of loff_t vs xfs_off_t in the core code. 2005-05-05 13:33:40 -07:00
aio.c [PATCH] aio: optimize io_submit_one() 2005-05-01 08:59:16 -07:00
attr.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
bad_inode.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
binfmt_aout.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
binfmt_elf_fdpic.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
binfmt_elf.c [PATCH] Fix error recovery path for arch_setup_additional_pages 2005-04-28 15:17:19 -07:00
binfmt_em86.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
binfmt_flat.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
binfmt_misc.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
binfmt_script.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
binfmt_som.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
bio.c [PATCH] DocBook: fix some descriptions 2005-05-01 08:59:26 -07:00
block_dev.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
buffer.c [PATCH] __block_write_full_page race fix 2005-05-05 16:36:40 -07:00
char_dev.c [PATCH] revert fs/char_dev.c CONFIG_BASE_FULL change 2005-04-17 10:57:20 -07:00
compat_ioctl.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
compat.c [PATCH] NFS4: Don't use __user with compat_uptr_t 2005-04-27 15:39:03 -07:00
dcache.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
dcookies.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
direct-io.c [PATCH] Direct IO async short read fix 2005-04-16 15:25:50 -07:00
dnotify.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
dquot.c [PATCH] quota: fix possible oops on quotaoff 2005-04-16 15:25:46 -07:00
eventpoll.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
exec.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
fcntl.c [PATCH] convert that currently tests _NSIG directly to use valid_signal() 2005-05-01 08:59:14 -07:00
fifo.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
file_table.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
file.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
filesystems.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
fs-writeback.c [PATCH] DocBook: fix some descriptions 2005-05-01 08:59:26 -07:00
inode.c [PATCH] avoid -ENOMEM due reclaimable slab caches 2005-05-05 16:36:30 -07:00
ioctl.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Kconfig Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Kconfig.binfmt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
libfs.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
locks.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Makefile Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mbcache.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mpage.c [PATCH] DocBook: fix some descriptions 2005-05-01 08:59:26 -07:00
namei.c namei: add audit_inode to all branches in path_lookup 2005-04-29 16:00:17 +01:00
namespace.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
nfsctl.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
open.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
pipe.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
posix_acl.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
quota_v1.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
quota_v2.c [PATCH] quota: possible bug in quota format v2 support 2005-04-16 15:25:47 -07:00
quota.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
read_write.c [PATCH] undo do_readv_writev() behavior change 2005-04-16 15:25:49 -07:00
readdir.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
select.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
seq_file.c [PATCH] DocBook: fix some descriptions 2005-05-01 08:59:26 -07:00
stat.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
super.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
xattr_acl.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
xattr.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00