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
AUTHORS -rw-r--r-- 2.2 KB
CHANGES -rw-r--r-- 27.6 KB
Makefile -rw-r--r-- 296 bytes
README -rw-r--r-- 25.5 KB
TODO -rw-r--r-- 4.6 KB
asn1.c -rw-r--r-- 13.6 KB
cifs_debug.c -rw-r--r-- 18.5 KB
cifs_debug.h -rw-r--r-- 2.0 KB
cifs_fs_sb.h -rw-r--r-- 1.5 KB
cifs_unicode.c -rw-r--r-- 2.2 KB
cifs_unicode.h -rw-r--r-- 7.9 KB
cifs_uniupr.h -rw-r--r-- 12.6 KB
cifsencrypt.c -rw-r--r-- 6.5 KB
cifsencrypt.h -rw-r--r-- 1.4 KB
cifsfs.c -rw-r--r-- 24.2 KB
cifsfs.h -rw-r--r-- 4.2 KB
cifsglob.h -rw-r--r-- 14.7 KB
cifspdu.h -rw-r--r-- 60.5 KB
cifsproto.h -rw-r--r-- 12.6 KB
cifssmb.c -rw-r--r-- 131.0 KB
connect.c -rw-r--r-- 99.3 KB
dir.c -rw-r--r-- 12.2 KB
fcntl.c -rw-r--r-- 3.7 KB
file.c -rw-r--r-- 44.9 KB
inode.c -rw-r--r-- 34.3 KB
ioctl.c -rw-r--r-- 2.9 KB
link.c -rw-r--r-- 8.7 KB
md4.c -rw-r--r-- 4.5 KB
md5.c -rw-r--r-- 10.6 KB
md5.h -rw-r--r-- 1.1 KB
misc.c -rw-r--r-- 19.1 KB
netmisc.c -rw-r--r-- 36.1 KB
nterr.c -rw-r--r-- 33.5 KB
nterr.h -rw-r--r-- 29.8 KB
ntlmssp.h -rw-r--r-- 4.0 KB
readdir.c -rw-r--r-- 28.1 KB
rfc1002pdu.h -rw-r--r-- 2.9 KB
smbdes.c -rw-r--r-- 9.9 KB
smbencrypt.c -rw-r--r-- 7.6 KB
smberr.h -rw-r--r-- 7.2 KB
transport.c -rw-r--r-- 17.2 KB
xattr.c -rw-r--r-- 10.3 KB

README

back to top