Skip to content

Commit

Permalink
ext3: Don't warn from writepage when readonly inode is spotted after …
Browse files Browse the repository at this point in the history
…error

WARN_ON_ONCE(IS_RDONLY(inode)) tends to trip when filesystem hits error and is
remounted read-only. This unnecessarily scares users (well, they should be
scared because of filesystem error, but the stack trace distracts them from the
right source of their fear ;-). We could as well just remove the WARN_ON but
it's not hard to fix it to not trip on filesystem with errors and not use more
cycles in the common case so that's what we do.

CC: stable@kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Jan Kara committed Jan 9, 2012
1 parent 0048278 commit 33c104d
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions fs/ext3/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,13 @@ static int ext3_ordered_writepage(struct page *page,
int err;

J_ASSERT(PageLocked(page));
WARN_ON_ONCE(IS_RDONLY(inode));
/*
* We don't want to warn for emergency remount. The condition is
* ordered to avoid dereferencing inode->i_sb in non-error case to
* avoid slow-downs.
*/
WARN_ON_ONCE(IS_RDONLY(inode) &&
!(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ERROR_FS));

/*
* We give up here if we're reentered, because it might be for a
Expand Down Expand Up @@ -1698,7 +1704,13 @@ static int ext3_writeback_writepage(struct page *page,
int err;

J_ASSERT(PageLocked(page));
WARN_ON_ONCE(IS_RDONLY(inode));
/*
* We don't want to warn for emergency remount. The condition is
* ordered to avoid dereferencing inode->i_sb in non-error case to
* avoid slow-downs.
*/
WARN_ON_ONCE(IS_RDONLY(inode) &&
!(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ERROR_FS));

if (ext3_journal_current_handle())
goto out_fail;
Expand Down Expand Up @@ -1741,7 +1753,13 @@ static int ext3_journalled_writepage(struct page *page,
int err;

J_ASSERT(PageLocked(page));
WARN_ON_ONCE(IS_RDONLY(inode));
/*
* We don't want to warn for emergency remount. The condition is
* ordered to avoid dereferencing inode->i_sb in non-error case to
* avoid slow-downs.
*/
WARN_ON_ONCE(IS_RDONLY(inode) &&
!(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ERROR_FS));

if (ext3_journal_current_handle())
goto no_write;
Expand Down

0 comments on commit 33c104d

Please sign in to comment.