<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/fs/buffer.c, branch v2.6.13</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v2.6.13</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.13'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2005-07-08T01:23:45Z</updated>
<entry>
<title>[PATCH] page_uptodate locking scalability</title>
<updated>2005-07-08T01:23:45Z</updated>
<author>
<name>Nick Piggin</name>
<email>nickpiggin@yahoo.com.au</email>
</author>
<published>2005-07-08T00:56:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a39722034ae37f80a1803bf781fe3fe1b03e20bc'/>
<id>urn:sha1:a39722034ae37f80a1803bf781fe3fe1b03e20bc</id>
<content type='text'>
Use a bit spin lock in the first buffer of the page to synchronise asynch
IO buffer completions, instead of the global page_uptodate_lock, which is
showing some scalabilty problems.

Signed-off-by: Nick Piggin &lt;nickpiggin@yahoo.com.au&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] rename wakeup_bdflush to wakeup_pdflush</title>
<updated>2005-06-29T04:20:31Z</updated>
<author>
<name>Pekka J Enberg</name>
<email>penberg@cs.Helsinki.FI</email>
</author>
<published>2005-06-29T03:44:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=687a21cee17000177b1935896b9b475acf136678'/>
<id>urn:sha1:687a21cee17000177b1935896b9b475acf136678</id>
<content type='text'>
Signed-off-by: Pekka Enberg &lt;penberg@cs.helsinki.fi&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] Bug in error recovery in fs/buffer.c::__block_prepare_write()</title>
<updated>2005-06-23T16:45:34Z</updated>
<author>
<name>Anton Altaparmakov</name>
<email>aia21@cam.ac.uk</email>
</author>
<published>2005-06-23T07:10:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=152becd26e0563aefdbc4fd1fe491928efe92d1f'/>
<id>urn:sha1:152becd26e0563aefdbc4fd1fe491928efe92d1f</id>
<content type='text'>
fs/buffer.c::__block_prepare_write() has broken error recovery.  It calls
the get_block() callback with "create = 1" and if that succeeds it
immediately clears buffer_new on the just allocated buffer (which has
buffer_new set).

The bug is that if an error occurs and get_block() returns != 0, we break
from this loop and go into recovery code.  This code has this comment:

/* Error case: */
/*
 * Zero out any newly allocated blocks to avoid exposing stale
 * data.  If BH_New is set, we know that the block was newly
 * allocated in the above loop.
 */

So the intent is obviously good in that it wants to clear just allocated
and hence not zeroed buffers.  However the code recognises allocated
buffers by checking for buffer_new being set.

Unfortunately __block_prepare_write() as discussed above already cleared
buffer_new on all allocated buffers thus no buffers will be cleared during
error recovery and old data will be leaked.

The simplest way I can see to fix this is to make the current recovery code
work by _not_ clearing buffer_new after calling get_block() in
__block_prepare_write().

We cannot safely allow buffer_new buffers to "leak out" of
__block_prepare_write(), thus we simply do a quick loop over the buffers
clearing buffer_new on each of them if it is set just before returning
"success" from __block_prepare_write().

Signed-off-by: Anton Altaparmakov &lt;aia21@cantab.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] factor out common code in sys_fsync/sys_fdatasync</title>
<updated>2005-06-23T16:45:29Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@tv-sign.ru</email>
</author>
<published>2005-06-23T07:10:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=dfb388bf8a328f206bba33933dd97230f412238b'/>
<id>urn:sha1:dfb388bf8a328f206bba33933dd97230f412238b</id>
<content type='text'>
This patch consolidates sys_fsync and sys_fdatasync.

Signed-off-by: Oleg Nesterov &lt;oleg@tv-sign.ru&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] vm: try_to_free_pages unused argument</title>
<updated>2005-06-22T01:46:17Z</updated>
<author>
<name>Darren Hart</name>
<email>dvhltc@us.ibm.com</email>
</author>
<published>2005-06-22T00:14:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1ad539b2bd89bf2e129123eb24d5bcc4484a35de'/>
<id>urn:sha1:1ad539b2bd89bf2e129123eb24d5bcc4484a35de</id>
<content type='text'>
try_to_free_pages accepts a third argument, order, but hasn't used it since
before 2.6.0.  The following patch removes the argument and updates all the
calls to try_to_free_pages.

Signed-off-by: Darren Hart &lt;dvhltc@us.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] block_read_full_page() get_block() error handling fix</title>
<updated>2005-05-17T14:59:20Z</updated>
<author>
<name>Andrew Morton</name>
<email>akpm@osdl.org</email>
</author>
<published>2005-05-17T04:53:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c64610ba585fabb36be78782868277f3d9741a2e'/>
<id>urn:sha1:c64610ba585fabb36be78782868277f3d9741a2e</id>
<content type='text'>
If block_read_full_page() detects an error when running get_block() it will
run SetPageError(), then it will zero out the block in pagecache and will mark
the buffer_head uptodate.

So at the end of readahead we end up with a non-uptodate pagecache page which
is marked PageError.  But it has uptodate buffers.

The pagefault code will run ClearPageError, will launch readpage a second time
and block_read_full_page() will notice the uptodate buffers and will mark the
page uptodate as well.  We end up with an uptodate, !PageError page full of
zeros and the error is lost.

(It seems a little odd that filemap_nopage() runs ClearPageError().  I guess
all of this adds up to meaning that for each attempted access to the page, the
pagefault handler will retry the I/O.  Which is good and bad.  If the app is
ignoring SIGBUS for some reason we could get a lot of back-to-back I/O
errors.)

Fix it by not marking the pagecache buffer_head as uptodate if the attempt to
map that buffer to a disk block failed.

Credit-to: Qu Fuping &lt;fs@ercist.iscas.ac.cn&gt;

  For reporting the bug and identifying its source.

Signed-off-by: Qu Fuping &lt;fs@ercist.iscas.ac.cn&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] make some things static</title>
<updated>2005-05-05T23:36:47Z</updated>
<author>
<name>Adrian Bunk</name>
<email>bunk@stusta.de</email>
</author>
<published>2005-05-05T23:16:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=75c96f85845a6707b0f9916cb263cb3584f7d48f'/>
<id>urn:sha1:75c96f85845a6707b0f9916cb263cb3584f7d48f</id>
<content type='text'>
This patch makes some needlessly global identifiers static.

Signed-off-by: Adrian Bunk &lt;bunk@stusta.de&gt;
Acked-by: Arjan van de Ven &lt;arjanv@infradead.org&gt;
Acked-by: Trond Myklebust &lt;trond.myklebust@fys.uio.no&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] __block_write_full_page() simplification</title>
<updated>2005-05-05T23:36:41Z</updated>
<author>
<name>Andrew Morton</name>
<email>akpm@osdl.org</email>
</author>
<published>2005-05-05T23:15:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f0fbd5fc09b20f7ba7bc8c80be33e39925bb38e1'/>
<id>urn:sha1:f0fbd5fc09b20f7ba7bc8c80be33e39925bb38e1</id>
<content type='text'>
The `last_bh' logic probably isn't worth much.  In those situations where only
the front part of the page is being written out we will save some looping but
in the vastly more common case of an all-page writeout if just adds more code.

Nick Piggin &lt;nickpiggin@yahoo.com.au&gt;

Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] __block_write_full_page speedup</title>
<updated>2005-05-05T23:36:41Z</updated>
<author>
<name>Andrew Morton</name>
<email>akpm@osdl.org</email>
</author>
<published>2005-05-05T23:15:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=05937baae9fc27b64bcd4378da7d2b14edf7931c'/>
<id>urn:sha1:05937baae9fc27b64bcd4378da7d2b14edf7931c</id>
<content type='text'>
Remove all those get_bh()'s and put_bh()'s by extending lock_page() to cover
the troublesome regions.

(get_bh() and put_bh() happen every time whereas contention on a page's lock
in there happens basically never).

Cc: Nick Piggin &lt;nickpiggin@yahoo.com.au&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] __block_write_full_page race fix</title>
<updated>2005-05-05T23:36:40Z</updated>
<author>
<name>Nick Piggin</name>
<email>nickpiggin@yahoo.com.au</email>
</author>
<published>2005-05-05T23:15:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ad576e63e0c8b274a8558b8e05a6d0526e804dc0'/>
<id>urn:sha1:ad576e63e0c8b274a8558b8e05a6d0526e804dc0</id>
<content type='text'>
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.
=&gt; 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.
=&gt; 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 &lt;nickpiggin@yahoo.com.au&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
</feed>
