Revision ad576e63e0c8b274a8558b8e05a6d0526e804dc0 authored by Nick Piggin on 05 May 2005, 23:15:46 UTC, committed by Linus Torvalds on 05 May 2005, 23:36:40 UTC
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>
1 parent f3ddbdc
History
File Mode Size
basic
genksyms
kconfig
ksymoops
lxdialog
mod
package
Lindent -rwxr-xr-x 54 bytes
Makefile -rw-r--r-- 801 bytes
Makefile.build -rw-r--r-- 9.8 KB
Makefile.clean -rw-r--r-- 2.9 KB
Makefile.host -rw-r--r-- 5.8 KB
Makefile.lib -rw-r--r-- 9.9 KB
Makefile.modinst -rw-r--r-- 825 bytes
Makefile.modpost -rw-r--r-- 3.4 KB
bin2c.c -rw-r--r-- 702 bytes
binoffset.c -rw-r--r-- 3.9 KB
checkconfig.pl -rwxr-xr-x 1.7 KB
checkincludes.pl -rwxr-xr-x 529 bytes
checkstack.pl -rw-r--r-- 3.5 KB
checkversion.pl -rwxr-xr-x 1.9 KB
conmakehash.c -rw-r--r-- 6.0 KB
extract-ikconfig -rwxr-xr-x 1.6 KB
gcc-version.sh -rw-r--r-- 338 bytes
gen_initramfs_list.sh -rw-r--r-- 4.7 KB
kallsyms.c -rw-r--r-- 17.7 KB
kernel-doc -rwxr-xr-x 49.7 KB
makelst -rwxr-xr-x 941 bytes
mkcompile_h -rwxr-xr-x 2.1 KB
mkmakefile -rw-r--r-- 563 bytes
mksysmap -rw-r--r-- 1.3 KB
mkuboot.sh -rwxr-xr-x 293 bytes
mkversion -rw-r--r-- 74 bytes
namespace.pl -rw-r--r-- 13.1 KB
patch-kernel -rwxr-xr-x 9.7 KB
pnmtologo.c -rw-r--r-- 11.7 KB
reference_discarded.pl -rw-r--r-- 3.2 KB
reference_init.pl -rw-r--r-- 3.3 KB
show_delta -rw-r--r-- 3.0 KB
ver_linux -rwxr-xr-x 3.0 KB

back to top