* [PATCH] tune2fs: exit directly when fs freed in ext2fs_run_ext3_journal
@ 2022-09-16 7:42 Li Jinlin
2022-09-26 9:46 ` Li Jinlin
2022-10-20 17:08 ` Theodore Ts'o
0 siblings, 2 replies; 3+ messages in thread
From: Li Jinlin @ 2022-09-16 7:42 UTC (permalink / raw)
To: tytso, adilger; +Cc: linux-ext4, linfeilong, liuzhiqiang26
In ext2fs_run_ext3_journal(), fs will be free and reallocate. But
reallocating by ext2fs_open() may fail in some cases, such as device
being offline at the same time. In these cases, goto closefs will
cause segfault, fix it by exiting directly.
Signed-off-by: Li Jinlin <lijinlin3@huawei.com>
---
misc/tune2fs.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 088f87e5..ee57dc7c 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -3344,8 +3344,11 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
com_err("tune2fs", retval,
"while recovering journal.\n");
printf(_("Please run e2fsck -fy %s.\n"), argv[1]);
- rc = 1;
- goto closefs;
+ if (fs) {
+ rc = 1;
+ goto closefs;
+ }
+ exit(1);
}
sb = fs->super;
}
--
2.23.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tune2fs: exit directly when fs freed in ext2fs_run_ext3_journal
2022-09-16 7:42 [PATCH] tune2fs: exit directly when fs freed in ext2fs_run_ext3_journal Li Jinlin
@ 2022-09-26 9:46 ` Li Jinlin
2022-10-20 17:08 ` Theodore Ts'o
1 sibling, 0 replies; 3+ messages in thread
From: Li Jinlin @ 2022-09-26 9:46 UTC (permalink / raw)
To: lijinlin3; +Cc: adilger, linfeilong, linux-ext4, liuzhiqiang26, tytso
friendly ping ...
Thanks,
Jinlin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tune2fs: exit directly when fs freed in ext2fs_run_ext3_journal
2022-09-16 7:42 [PATCH] tune2fs: exit directly when fs freed in ext2fs_run_ext3_journal Li Jinlin
2022-09-26 9:46 ` Li Jinlin
@ 2022-10-20 17:08 ` Theodore Ts'o
1 sibling, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2022-10-20 17:08 UTC (permalink / raw)
To: Li Jinlin; +Cc: adilger, linux-ext4, linfeilong, liuzhiqiang26
On Fri, Sep 16, 2022 at 03:42:23PM +0800, Li Jinlin wrote:
> In ext2fs_run_ext3_journal(), fs will be free and reallocate. But
> reallocating by ext2fs_open() may fail in some cases, such as device
> being offline at the same time. In these cases, goto closefs will
> cause segfault, fix it by exiting directly.
>
> Signed-off-by: Li Jinlin <lijinlin3@huawei.com>
Thanks, applied, although I simplified the patch a little:
@@ -3106,6 +3106,8 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
com_err("tune2fs", retval,
"while recovering journal.\n");
printf(_("Please run e2fsck -fy %s.\n"), argv[1]);
+ if (!fs)
+ exit(1);
rc = 1;
goto closefs;
}
- Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-20 17:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-16 7:42 [PATCH] tune2fs: exit directly when fs freed in ext2fs_run_ext3_journal Li Jinlin
2022-09-26 9:46 ` Li Jinlin
2022-10-20 17:08 ` Theodore Ts'o
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.