lkml.org 
[lkml]   [2007]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: per-bdi-throttling: synchronous writepage doesn't work correctly
From
Date

On Thu, 2007-11-01 at 20:19 +0100, Miklos Szeredi wrote:
> > >
> > > See the file "Locking" for more details.
> > >
> > >
> > > The "should set PG_Writeback" bit threw me off I guess.
> >
> > Hmm, set_page_writeback() is also the one clearing the radix tree dirty
> > tag. So if that is not called, we get in a bit of a mess, no?
> >
> > Which makes me think hostfs is buggy.
>
> Yes, looks like that sort of usage is not valid. But not clearing the
> dirty tag won't cause any malfunction, it'll just waste some CPU when
> looking for dirty pages to write back. This is probably why this
> wasn't noticed earlier.

Documentation/filesystems/Locking is also quite clear on the need to
call set_page_writeback() and end_page_writeback().

minimal fix for hostfs

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 8966b05..b6c1e12 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -415,6 +415,7 @@ int hostfs_writepage(struct page *page, struct writeback_control *wbc)
int end_index = inode->i_size >> PAGE_CACHE_SHIFT;
int err;

+ set_page_writeback(page);
if (page->index >= end_index)
count = inode->i_size & (PAGE_CACHE_SIZE-1);

@@ -438,6 +439,7 @@ int hostfs_writepage(struct page *page, struct writeback_control *wbc)
kunmap(page);

unlock_page(page);
+ end_page_writeback(page);
return err;
}


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-11-01 21:07    [from the cache]
©2003-2011 Jasper Spaans