Commit d17d7fa4 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] revert ext3-writepages-support-for-writeback-mode

This had a fatal lock ranking bug: we do journal_start outside
mpage_writepages()'s lock_page().

Revert the whole thing, think again.

Credit-to: Jan Kara <jack@suse.cz>

For identifying the bug.

Cc: Badari Pulavarty <pbadari@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ecffdde6
...@@ -844,12 +844,6 @@ ext3_direct_io_get_blocks(struct inode *inode, sector_t iblock, ...@@ -844,12 +844,6 @@ ext3_direct_io_get_blocks(struct inode *inode, sector_t iblock,
return ret; return ret;
} }
static int ext3_writepages_get_block(struct inode *inode, sector_t iblock,
struct buffer_head *bh, int create)
{
return ext3_direct_io_get_blocks(inode, iblock, 1, bh, create);
}
/* /*
* `handle' can be NULL if create is zero * `handle' can be NULL if create is zero
*/ */
...@@ -1323,45 +1317,6 @@ static int ext3_ordered_writepage(struct page *page, ...@@ -1323,45 +1317,6 @@ static int ext3_ordered_writepage(struct page *page,
return ret; return ret;
} }
static int
ext3_writeback_writepage_helper(struct page *page,
struct writeback_control *wbc)
{
return block_write_full_page(page, ext3_get_block, wbc);
}
static int
ext3_writeback_writepages(struct address_space *mapping,
struct writeback_control *wbc)
{
struct inode *inode = mapping->host;
handle_t *handle = NULL;
int err, ret = 0;
if (!mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
return ret;
handle = ext3_journal_start(inode, ext3_writepage_trans_blocks(inode));
if (IS_ERR(handle)) {
ret = PTR_ERR(handle);
return ret;
}
ret = __mpage_writepages(mapping, wbc, ext3_writepages_get_block,
ext3_writeback_writepage_helper);
/*
* Need to reaquire the handle since ext3_writepages_get_block()
* can restart the handle
*/
handle = journal_current_handle();
err = ext3_journal_stop(handle);
if (!ret)
ret = err;
return ret;
}
static int ext3_writeback_writepage(struct page *page, static int ext3_writeback_writepage(struct page *page,
struct writeback_control *wbc) struct writeback_control *wbc)
{ {
...@@ -1599,7 +1554,6 @@ static struct address_space_operations ext3_writeback_aops = { ...@@ -1599,7 +1554,6 @@ static struct address_space_operations ext3_writeback_aops = {
.readpage = ext3_readpage, .readpage = ext3_readpage,
.readpages = ext3_readpages, .readpages = ext3_readpages,
.writepage = ext3_writeback_writepage, .writepage = ext3_writeback_writepage,
.writepages = ext3_writeback_writepages,
.sync_page = block_sync_page, .sync_page = block_sync_page,
.prepare_write = ext3_prepare_write, .prepare_write = ext3_prepare_write,
.commit_write = ext3_writeback_commit_write, .commit_write = ext3_writeback_commit_write,
......
...@@ -626,15 +626,6 @@ __mpage_writepage(struct bio *bio, struct page *page, get_block_t get_block, ...@@ -626,15 +626,6 @@ __mpage_writepage(struct bio *bio, struct page *page, get_block_t get_block,
int int
mpage_writepages(struct address_space *mapping, mpage_writepages(struct address_space *mapping,
struct writeback_control *wbc, get_block_t get_block) struct writeback_control *wbc, get_block_t get_block)
{
return __mpage_writepages(mapping, wbc, get_block,
mapping->a_ops->writepage);
}
int
__mpage_writepages(struct address_space *mapping,
struct writeback_control *wbc, get_block_t get_block,
writepage_t writepage_fn)
{ {
struct backing_dev_info *bdi = mapping->backing_dev_info; struct backing_dev_info *bdi = mapping->backing_dev_info;
struct bio *bio = NULL; struct bio *bio = NULL;
...@@ -725,7 +716,7 @@ __mpage_writepages(struct address_space *mapping, ...@@ -725,7 +716,7 @@ __mpage_writepages(struct address_space *mapping,
} else { } else {
bio = __mpage_writepage(bio, page, get_block, bio = __mpage_writepage(bio, page, get_block,
&last_block_in_bio, &ret, wbc, &last_block_in_bio, &ret, wbc,
writepage_fn); page->mapping->a_ops->writepage);
} }
if (unlikely(ret == WRITEPAGE_ACTIVATE)) if (unlikely(ret == WRITEPAGE_ACTIVATE))
unlock_page(page); unlock_page(page);
...@@ -755,7 +746,6 @@ __mpage_writepages(struct address_space *mapping, ...@@ -755,7 +746,6 @@ __mpage_writepages(struct address_space *mapping,
return ret; return ret;
} }
EXPORT_SYMBOL(mpage_writepages); EXPORT_SYMBOL(mpage_writepages);
EXPORT_SYMBOL(__mpage_writepages);
int mpage_writepage(struct page *page, get_block_t get_block, int mpage_writepage(struct page *page, get_block_t get_block,
struct writeback_control *wbc) struct writeback_control *wbc)
......
...@@ -20,9 +20,6 @@ int mpage_writepages(struct address_space *mapping, ...@@ -20,9 +20,6 @@ int mpage_writepages(struct address_space *mapping,
struct writeback_control *wbc, get_block_t get_block); struct writeback_control *wbc, get_block_t get_block);
int mpage_writepage(struct page *page, get_block_t *get_block, int mpage_writepage(struct page *page, get_block_t *get_block,
struct writeback_control *wbc); struct writeback_control *wbc);
int __mpage_writepages(struct address_space *mapping,
struct writeback_control *wbc, get_block_t get_block,
writepage_t writepage);
static inline int static inline int
generic_writepages(struct address_space *mapping, struct writeback_control *wbc) generic_writepages(struct address_space *mapping, struct writeback_control *wbc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment