Skip to content

Commit

Permalink
ext3: add writepage sanity checks
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
  • Loading branch information
Dmitry Monakhov authored and jankara committed Mar 4, 2010
1 parent 7eb4969 commit 49792c8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fs/ext3/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 49792c8

Please sign in to comment.