ext3: add writepage sanity checks

- There is theoretical possibility to perform writepage on
   RO superblock. Add explicit check for what case.
- Page must being locked before writepage.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
Dmitry Monakhov 2010-03-02 15:51:02 +03:00 коммит произвёл Jan Kara
Родитель 7eb4969e04
Коммит 49792c806d
1 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -1528,6 +1528,7 @@ static int ext3_ordered_writepage(struct page *page,
int err;
J_ASSERT(PageLocked(page));
WARN_ON_ONCE(IS_RDONLY(inode));
/*
* We give up here if we're reentered, because it might be for a
@ -1600,6 +1601,9 @@ static int ext3_writeback_writepage(struct page *page,
int ret = 0;
int err;
J_ASSERT(PageLocked(page));
WARN_ON_ONCE(IS_RDONLY(inode));
if (ext3_journal_current_handle())
goto out_fail;
@ -1642,6 +1646,9 @@ static int ext3_journalled_writepage(struct page *page,
int ret = 0;
int err;
J_ASSERT(PageLocked(page));
WARN_ON_ONCE(IS_RDONLY(inode));
if (ext3_journal_current_handle())
goto no_write;