Commit 49792c80 authored by Dmitry Monakhov's avatar Dmitry Monakhov Committed by Jan Kara

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: default avatarDmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 7eb4969e
...@@ -1528,6 +1528,7 @@ static int ext3_ordered_writepage(struct page *page, ...@@ -1528,6 +1528,7 @@ static int ext3_ordered_writepage(struct page *page,
int err; int err;
J_ASSERT(PageLocked(page)); J_ASSERT(PageLocked(page));
WARN_ON_ONCE(IS_RDONLY(inode));
/* /*
* We give up here if we're reentered, because it might be for a * 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, ...@@ -1600,6 +1601,9 @@ static int ext3_writeback_writepage(struct page *page,
int ret = 0; int ret = 0;
int err; int err;
J_ASSERT(PageLocked(page));
WARN_ON_ONCE(IS_RDONLY(inode));
if (ext3_journal_current_handle()) if (ext3_journal_current_handle())
goto out_fail; goto out_fail;
...@@ -1642,6 +1646,9 @@ static int ext3_journalled_writepage(struct page *page, ...@@ -1642,6 +1646,9 @@ static int ext3_journalled_writepage(struct page *page,
int ret = 0; int ret = 0;
int err; int err;
J_ASSERT(PageLocked(page));
WARN_ON_ONCE(IS_RDONLY(inode));
if (ext3_journal_current_handle()) if (ext3_journal_current_handle())
goto no_write; goto no_write;
......
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