diff options
author | Dmitry Monakhov <dmonakhov@openvz.org> | 2010-03-02 07:51:02 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2010-03-04 18:20:27 -0500 |
commit | 49792c806d0bfd53afc789dcdf50dc9bed2c5b83 (patch) | |
tree | b24280fa76abad273e0f009a9cfe49b594c2becf /fs/ext3/inode.c | |
parent | 7eb4969e04060dcf3fbd46af9c21b1059b853068 (diff) |
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>
Diffstat (limited to 'fs/ext3/inode.c')
-rw-r--r-- | fs/ext3/inode.c | 7 |
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, | |||
1528 | int err; | 1528 | int err; |
1529 | 1529 | ||
1530 | J_ASSERT(PageLocked(page)); | 1530 | J_ASSERT(PageLocked(page)); |
1531 | WARN_ON_ONCE(IS_RDONLY(inode)); | ||
1531 | 1532 | ||
1532 | /* | 1533 | /* |
1533 | * We give up here if we're reentered, because it might be for a | 1534 | * 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 | int ret = 0; | 1601 | int ret = 0; |
1601 | int err; | 1602 | int err; |
1602 | 1603 | ||
1604 | J_ASSERT(PageLocked(page)); | ||
1605 | WARN_ON_ONCE(IS_RDONLY(inode)); | ||
1606 | |||
1603 | if (ext3_journal_current_handle()) | 1607 | if (ext3_journal_current_handle()) |
1604 | goto out_fail; | 1608 | goto out_fail; |
1605 | 1609 | ||
@@ -1642,6 +1646,9 @@ static int ext3_journalled_writepage(struct page *page, | |||
1642 | int ret = 0; | 1646 | int ret = 0; |
1643 | int err; | 1647 | int err; |
1644 | 1648 | ||
1649 | J_ASSERT(PageLocked(page)); | ||
1650 | WARN_ON_ONCE(IS_RDONLY(inode)); | ||
1651 | |||
1645 | if (ext3_journal_current_handle()) | 1652 | if (ext3_journal_current_handle()) |
1646 | goto no_write; | 1653 | goto no_write; |
1647 | 1654 | ||