summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Monakhov <dmonakhov@openvz.org>2010-03-02 13:51:02 +0100
committerJan Kara <jack@suse.cz>2010-03-05 00:20:27 +0100
commit49792c806d0bfd53afc789dcdf50dc9bed2c5b83 (patch)
treeb24280fa76abad273e0f009a9cfe49b594c2becf
parentext3: Truncate allocated blocks if direct IO write fails to update i_size (diff)
downloadlinux-49792c806d0bfd53afc789dcdf50dc9bed2c5b83.tar.xz
linux-49792c806d0bfd53afc789dcdf50dc9bed2c5b83.zip
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>
-rw-r--r--fs/ext3/inode.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index c0ff9d6ffde6..eda9121d7d57 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -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;