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
Kconfig -rw-r--r-- 21.7 KB
Makefile -rw-r--r-- 1.9 KB
nls_ascii.c -rw-r--r-- 5.7 KB
nls_base.c -rw-r--r-- 14.0 KB
nls_cp1250.c -rw-r--r-- 15.0 KB
nls_cp1251.c -rw-r--r-- 12.4 KB
nls_cp1255.c -rw-r--r-- 16.9 KB
nls_cp437.c -rw-r--r-- 17.0 KB
nls_cp737.c -rw-r--r-- 15.1 KB
nls_cp775.c -rw-r--r-- 13.2 KB
nls_cp850.c -rw-r--r-- 13.0 KB
nls_cp852.c -rw-r--r-- 14.4 KB
nls_cp855.c -rw-r--r-- 12.1 KB
nls_cp857.c -rw-r--r-- 12.3 KB
nls_cp860.c -rw-r--r-- 15.8 KB
nls_cp861.c -rw-r--r-- 17.0 KB
nls_cp862.c -rw-r--r-- 19.0 KB
nls_cp863.c -rw-r--r-- 16.7 KB
nls_cp864.c -rw-r--r-- 18.5 KB
nls_cp865.c -rw-r--r-- 17.0 KB
nls_cp866.c -rw-r--r-- 12.3 KB
nls_cp869.c -rw-r--r-- 13.0 KB
nls_cp874.c -rw-r--r-- 10.7 KB
nls_cp932.c -rw-r--r-- 478.8 KB
nls_cp936.c -rw-r--r-- 675.8 KB
nls_cp949.c -rw-r--r-- 853.1 KB
nls_cp950.c -rw-r--r-- 578.8 KB
nls_euc-jp.c -rw-r--r-- 23.9 KB
nls_iso8859-1.c -rw-r--r-- 9.9 KB
nls_iso8859-13.c -rw-r--r-- 11.5 KB
nls_iso8859-14.c -rw-r--r-- 14.5 KB
nls_iso8859-15.c -rw-r--r-- 12.6 KB
nls_iso8859-2.c -rw-r--r-- 12.8 KB
nls_iso8859-3.c -rw-r--r-- 12.8 KB
nls_iso8859-4.c -rw-r--r-- 12.8 KB
nls_iso8859-5.c -rw-r--r-- 10.6 KB
nls_iso8859-6.c -rw-r--r-- 10.2 KB
nls_iso8859-7.c -rw-r--r-- 13.2 KB
nls_iso8859-9.c -rw-r--r-- 10.7 KB
nls_koi8-r.c -rw-r--r-- 13.5 KB
nls_koi8-ru.c -rw-r--r-- 1.7 KB
nls_koi8-u.c -rw-r--r-- 13.8 KB
nls_utf8.c -rw-r--r-- 1.1 KB

back to top