* [PATCH] ext4: do not commit super on read-only bdev
@ 2020-03-18 19:19 Eric Sandeen
2020-03-18 22:09 ` Andreas Dilger
2020-03-26 14:57 ` Theodore Y. Ts'o
0 siblings, 2 replies; 3+ messages in thread
From: Eric Sandeen @ 2020-03-18 19:19 UTC (permalink / raw)
To: linux-ext4; +Cc: Ritesh Harjani
From: Eric Sandeen <sandeen@redhat.com>
Under some circumstances we may encounter a filesystem error on a
read-only block device, and if we try to save the error info to the
superblock and commit it, we'll wind up with a noisy error and
backtrace, i.e.:
[ 3337.146838] EXT4-fs error (device pmem1p2): ext4_get_journal_inode:4634: comm mount: inode #0: comm mount: iget: illegal inode #
------------[ cut here ]------------
generic_make_request: Trying to write to read-only block-device pmem1p2 (partno 2)
WARNING: CPU: 107 PID: 115347 at block/blk-core.c:788 generic_make_request_checks+0x6b4/0x7d0
...
To avoid this, commit the error info in the superblock only if the
block device is writable.
Reported-by: Ritesh Harjani <riteshh@linux.ibm.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
(compile-tested only FWIW)
(also, not sure if the bdev test in __save_error_info should be removed?)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0c7c4adb664e..55392903bda5 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -372,7 +372,8 @@ static void save_error_info(struct super_block *sb, const char *func,
unsigned int line)
{
__save_error_info(sb, func, line);
- ext4_commit_super(sb, 1);
+ if (!bdev_read_only(sb->s_bdev))
+ ext4_commit_super(sb, 1);
}
/*
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ext4: do not commit super on read-only bdev
2020-03-18 19:19 [PATCH] ext4: do not commit super on read-only bdev Eric Sandeen
@ 2020-03-18 22:09 ` Andreas Dilger
2020-03-26 14:57 ` Theodore Y. Ts'o
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Dilger @ 2020-03-18 22:09 UTC (permalink / raw)
To: Eric Sandeen; +Cc: linux-ext4, Ritesh Harjani
[-- Attachment #1: Type: text/plain, Size: 1563 bytes --]
On Mar 18, 2020, at 1:19 PM, Eric Sandeen <sandeen@sandeen.net> wrote:
>
> From: Eric Sandeen <sandeen@redhat.com>
>
> Under some circumstances we may encounter a filesystem error on a
> read-only block device, and if we try to save the error info to the
> superblock and commit it, we'll wind up with a noisy error and
> backtrace, i.e.:
>
> [ 3337.146838] EXT4-fs error (device pmem1p2): ext4_get_journal_inode:4634: comm mount: inode #0: comm mount: iget: illegal inode #
> ------------[ cut here ]------------
> generic_make_request: Trying to write to read-only block-device pmem1p2 (partno 2)
> WARNING: CPU: 107 PID: 115347 at block/blk-core.c:788 generic_make_request_checks+0x6b4/0x7d0
> ...
>
> To avoid this, commit the error info in the superblock only if the
> block device is writable.
>
> Reported-by: Ritesh Harjani <riteshh@linux.ibm.com>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
> ---
>
> (compile-tested only FWIW)
> (also, not sure if the bdev test in __save_error_info should be removed?)
>
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 0c7c4adb664e..55392903bda5 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -372,7 +372,8 @@ static void save_error_info(struct super_block *sb, const char *func,
> unsigned int line)
> {
> __save_error_info(sb, func, line);
> - ext4_commit_super(sb, 1);
> + if (!bdev_read_only(sb->s_bdev))
> + ext4_commit_super(sb, 1);
> }
>
> /*
Cheers, Andreas
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ext4: do not commit super on read-only bdev
2020-03-18 19:19 [PATCH] ext4: do not commit super on read-only bdev Eric Sandeen
2020-03-18 22:09 ` Andreas Dilger
@ 2020-03-26 14:57 ` Theodore Y. Ts'o
1 sibling, 0 replies; 3+ messages in thread
From: Theodore Y. Ts'o @ 2020-03-26 14:57 UTC (permalink / raw)
To: Eric Sandeen; +Cc: linux-ext4, Ritesh Harjani
On Wed, Mar 18, 2020 at 02:19:38PM -0500, Eric Sandeen wrote:
> From: Eric Sandeen <sandeen@redhat.com>
>
> Under some circumstances we may encounter a filesystem error on a
> read-only block device, and if we try to save the error info to the
> superblock and commit it, we'll wind up with a noisy error and
> backtrace, i.e.:
>
> [ 3337.146838] EXT4-fs error (device pmem1p2): ext4_get_journal_inode:4634: comm mount: inode #0: comm mount: iget: illegal inode #
> ------------[ cut here ]------------
> generic_make_request: Trying to write to read-only block-device pmem1p2 (partno 2)
> WARNING: CPU: 107 PID: 115347 at block/blk-core.c:788 generic_make_request_checks+0x6b4/0x7d0
> ...
>
> To avoid this, commit the error info in the superblock only if the
> block device is writable.
>
> Reported-by: Ritesh Harjani <riteshh@linux.ibm.com>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-26 14:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-18 19:19 [PATCH] ext4: do not commit super on read-only bdev Eric Sandeen
2020-03-18 22:09 ` Andreas Dilger
2020-03-26 14:57 ` Theodore Y. Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).