Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/ryusuke/nilfs2

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ryusuke/nilfs2:
  nilfs2: fix missing unlock in error path of nilfs_mdt_write_page
  nilfs2: fix oops due to inconsistent state in page with discrete b-tree nodes
  • Loading branch information
Linus Torvalds committed Aug 4, 2009
2 parents 849c9ca + 01a261e commit 624720e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 3 additions & 1 deletion fs/nilfs2/mdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,10 @@ nilfs_mdt_write_page(struct page *page, struct writeback_control *wbc)
return 0; /* Do not request flush for shadow page cache */
if (!sb) {
writer = nilfs_get_writer(NILFS_MDT(inode)->mi_nilfs);
if (!writer)
if (!writer) {
nilfs_put_writer(NILFS_MDT(inode)->mi_nilfs);
return -EROFS;
}
sb = writer->s_super;
}

Expand Down
16 changes: 15 additions & 1 deletion fs/nilfs2/segment.c
Original file line number Diff line number Diff line change
Expand Up @@ -1859,12 +1859,26 @@ static void nilfs_end_page_io(struct page *page, int err)
if (!page)
return;

if (buffer_nilfs_node(page_buffers(page)) && !PageWriteback(page))
if (buffer_nilfs_node(page_buffers(page)) && !PageWriteback(page)) {
/*
* For b-tree node pages, this function may be called twice
* or more because they might be split in a segment.
*/
if (PageDirty(page)) {
/*
* For pages holding split b-tree node buffers, dirty
* flag on the buffers may be cleared discretely.
* In that case, the page is once redirtied for
* remaining buffers, and it must be cancelled if
* all the buffers get cleaned later.
*/
lock_page(page);
if (nilfs_page_buffers_clean(page))
__nilfs_clear_page_dirty(page);
unlock_page(page);
}
return;
}

__nilfs_end_page_io(page, err);
}
Expand Down

0 comments on commit 624720e

Please sign in to comment.