* [PATCH] ext3: Don't warn from writepage when readonly inode is spotted after error
@ 2011-12-22 15:56 Jan Kara
2011-12-22 16:11 ` Eric Sandeen
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2011-12-22 15:56 UTC (permalink / raw)
To: linux-ext4; +Cc: Jan Kara
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.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ext3/inode.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
I carry this patch in my tree and will merge it with Linus in the next merge
window if noone objects.
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index a8d3217..91ac85b 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -1623,7 +1623,11 @@ 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
@@ -1698,7 +1702,11 @@ 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;
@@ -1741,7 +1749,11 @@ 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;
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ext3: Don't warn from writepage when readonly inode is spotted after error
2011-12-22 15:56 [PATCH] ext3: Don't warn from writepage when readonly inode is spotted after error Jan Kara
@ 2011-12-22 16:11 ` Eric Sandeen
2011-12-22 16:18 ` Jan Kara
0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2011-12-22 16:11 UTC (permalink / raw)
To: Jan Kara; +Cc: linux-ext4
On 12/22/11 9:56 AM, Jan Kara wrote:
> 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.
I've seen that too and it is distracting.
Looks good to me, aside from the rather long lines ;)
-Eric
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> fs/ext3/inode.c | 18 +++++++++++++++---
> 1 files changed, 15 insertions(+), 3 deletions(-)
>
> I carry this patch in my tree and will merge it with Linus in the next merge
> window if noone objects.
>
> diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
> index a8d3217..91ac85b 100644
> --- a/fs/ext3/inode.c
> +++ b/fs/ext3/inode.c
> @@ -1623,7 +1623,11 @@ 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
> @@ -1698,7 +1702,11 @@ 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;
> @@ -1741,7 +1749,11 @@ 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;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ext3: Don't warn from writepage when readonly inode is spotted after error
2011-12-22 16:11 ` Eric Sandeen
@ 2011-12-22 16:18 ` Jan Kara
0 siblings, 0 replies; 3+ messages in thread
From: Jan Kara @ 2011-12-22 16:18 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Jan Kara, linux-ext4
On Thu 22-12-11 10:11:36, Eric Sandeen wrote:
> On 12/22/11 9:56 AM, Jan Kara wrote:
> > 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.
>
> I've seen that too and it is distracting.
>
> Looks good to me, aside from the rather long lines ;)
Ah, right. My internal style checker had a coffee break I assume ;).
Below is a version with long lines fixed.
Honza
>From 0588350bf10c8dad70cc299971dfdeec10754b29 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Thu, 22 Dec 2011 16:49:05 +0100
Subject: [PATCH] ext3: Don't warn from writepage when readonly inode is spotted after 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>
---
fs/ext3/inode.c | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index a8d3217..fbf6599 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -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
@@ -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;
@@ -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;
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-12-22 16:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-22 15:56 [PATCH] ext3: Don't warn from writepage when readonly inode is spotted after error Jan Kara
2011-12-22 16:11 ` Eric Sandeen
2011-12-22 16:18 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox