* [PATCH] ext4: fix wrong return err in ext4_load_and_init_journal()
@ 2022-10-22 13:07 Jason Yan
2022-10-24 15:29 ` Jan Kara
0 siblings, 1 reply; 4+ messages in thread
From: Jason Yan @ 2022-10-22 13:07 UTC (permalink / raw)
To: tytso, adilger.kernel, jack, ritesh.list, lczerner, linux-ext4; +Cc: Jason Yan
The return value is wrong in ext4_load_and_init_journal(). The local
variable 'err' need to be initialized before goto out. The original code
in __ext4_fill_super() is fine because it has two return values 'ret'
and 'err' and 'ret' is initialized as -EINVAL. After we factor out
ext4_load_and_init_journal(), this code is broken. So fix it by directly
returning -EINVAL in the error handler path.
Fixes: 9c1dd22d7422 (ext4: factor out ext4_load_and_init_journal())
Signed-off-by: Jason Yan <yanaijie@huawei.com>
---
fs/ext4/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 989365b878a6..89c6bad28a8a 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4885,7 +4885,7 @@ static int ext4_load_and_init_journal(struct super_block *sb,
flush_work(&sbi->s_error_work);
jbd2_journal_destroy(sbi->s_journal);
sbi->s_journal = NULL;
- return err;
+ return -EINVAL;
}
static int ext4_journal_data_mode_check(struct super_block *sb)
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: fix wrong return err in ext4_load_and_init_journal()
2022-10-22 13:07 [PATCH] ext4: fix wrong return err in ext4_load_and_init_journal() Jason Yan
@ 2022-10-24 15:29 ` Jan Kara
2022-10-25 3:27 ` Jason Yan
0 siblings, 1 reply; 4+ messages in thread
From: Jan Kara @ 2022-10-24 15:29 UTC (permalink / raw)
To: Jason Yan; +Cc: tytso, adilger.kernel, jack, ritesh.list, lczerner, linux-ext4
On Sat 22-10-22 21:07:39, Jason Yan wrote:
> The return value is wrong in ext4_load_and_init_journal(). The local
> variable 'err' need to be initialized before goto out. The original code
> in __ext4_fill_super() is fine because it has two return values 'ret'
> and 'err' and 'ret' is initialized as -EINVAL. After we factor out
> ext4_load_and_init_journal(), this code is broken. So fix it by directly
> returning -EINVAL in the error handler path.
>
> Fixes: 9c1dd22d7422 (ext4: factor out ext4_load_and_init_journal())
We format the tag usually as:
Fixes: 9c1dd22d7422 ("ext4: factor out ext4_load_and_init_journal()")
> Signed-off-by: Jason Yan <yanaijie@huawei.com>
Otherwise the patch looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/ext4/super.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 989365b878a6..89c6bad28a8a 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -4885,7 +4885,7 @@ static int ext4_load_and_init_journal(struct super_block *sb,
> flush_work(&sbi->s_error_work);
> jbd2_journal_destroy(sbi->s_journal);
> sbi->s_journal = NULL;
> - return err;
> + return -EINVAL;
> }
>
> static int ext4_journal_data_mode_check(struct super_block *sb)
> --
> 2.31.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: fix wrong return err in ext4_load_and_init_journal()
2022-10-24 15:29 ` Jan Kara
@ 2022-10-25 3:27 ` Jason Yan
2022-10-25 8:56 ` Jan Kara
0 siblings, 1 reply; 4+ messages in thread
From: Jason Yan @ 2022-10-25 3:27 UTC (permalink / raw)
To: Jan Kara; +Cc: tytso, adilger.kernel, ritesh.list, lczerner, linux-ext4
On 2022/10/24 23:29, Jan Kara wrote:
> On Sat 22-10-22 21:07:39, Jason Yan wrote:
>> The return value is wrong in ext4_load_and_init_journal(). The local
>> variable 'err' need to be initialized before goto out. The original code
>> in __ext4_fill_super() is fine because it has two return values 'ret'
>> and 'err' and 'ret' is initialized as -EINVAL. After we factor out
>> ext4_load_and_init_journal(), this code is broken. So fix it by directly
>> returning -EINVAL in the error handler path.
>>
>> Fixes: 9c1dd22d7422 (ext4: factor out ext4_load_and_init_journal())
>
> We format the tag usually as:
>
> Fixes: 9c1dd22d7422 ("ext4: factor out ext4_load_and_init_journal()")
>
Oh, sorry I didn't notice it. Thank you so much.
I generate this tag by the following script:
#cat .gitconfig
[alias]
fixes = log --abbrev=12 -1 --format='Fixes: %h ("%s")'
#git fixes 9c1dd22d742249cfae7bbf3680a7c188d194d3ce
Fixes: 9c1dd22d7422 (ext4: factor out ext4_load_and_init_journal())
This works fine before but it fails recently. I don't know what makes
the behavior changed.
However if I directly call the whole command:
#git log --abbrev=12 -1 --format='Fixes: %h ("%s")' 9c1dd22d742249cfae
Fixes: 9c1dd22d7422 ("ext4: factor out ext4_load_and_init_journal()")
It works fine.
>> Signed-off-by: Jason Yan <yanaijie@huawei.com>
>
> Otherwise the patch looks good. Feel free to add:
>
> Reviewed-by: Jan Kara <jack@suse.cz>
>
Thanks.
> Honza
>
>> ---
>> fs/ext4/super.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
>> index 989365b878a6..89c6bad28a8a 100644
>> --- a/fs/ext4/super.c
>> +++ b/fs/ext4/super.c
>> @@ -4885,7 +4885,7 @@ static int ext4_load_and_init_journal(struct super_block *sb,
>> flush_work(&sbi->s_error_work);
>> jbd2_journal_destroy(sbi->s_journal);
>> sbi->s_journal = NULL;
>> - return err;
>> + return -EINVAL;
>> }
>>
>> static int ext4_journal_data_mode_check(struct super_block *sb)
>> --
>> 2.31.1
>>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: fix wrong return err in ext4_load_and_init_journal()
2022-10-25 3:27 ` Jason Yan
@ 2022-10-25 8:56 ` Jan Kara
0 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2022-10-25 8:56 UTC (permalink / raw)
To: Jason Yan
Cc: Jan Kara, tytso, adilger.kernel, ritesh.list, lczerner, linux-ext4
On Tue 25-10-22 11:27:01, Jason Yan wrote:
>
> On 2022/10/24 23:29, Jan Kara wrote:
> > On Sat 22-10-22 21:07:39, Jason Yan wrote:
> > > The return value is wrong in ext4_load_and_init_journal(). The local
> > > variable 'err' need to be initialized before goto out. The original code
> > > in __ext4_fill_super() is fine because it has two return values 'ret'
> > > and 'err' and 'ret' is initialized as -EINVAL. After we factor out
> > > ext4_load_and_init_journal(), this code is broken. So fix it by directly
> > > returning -EINVAL in the error handler path.
> > >
> > > Fixes: 9c1dd22d7422 (ext4: factor out ext4_load_and_init_journal())
> >
> > We format the tag usually as:
> >
> > Fixes: 9c1dd22d7422 ("ext4: factor out ext4_load_and_init_journal()")
> >
>
> Oh, sorry I didn't notice it. Thank you so much.
>
> I generate this tag by the following script:
>
> #cat .gitconfig
> [alias]
> fixes = log --abbrev=12 -1 --format='Fixes: %h ("%s")'
>
>
> #git fixes 9c1dd22d742249cfae7bbf3680a7c188d194d3ce
> Fixes: 9c1dd22d7422 (ext4: factor out ext4_load_and_init_journal())
>
> This works fine before but it fails recently. I don't know what makes the
> behavior changed.
I guess something does one more round of expansion on the string. I guess
you could trace it with strace and see where the quotes get lost...
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-10-25 8:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-22 13:07 [PATCH] ext4: fix wrong return err in ext4_load_and_init_journal() Jason Yan
2022-10-24 15:29 ` Jan Kara
2022-10-25 3:27 ` Jason Yan
2022-10-25 8:56 ` Jan Kara
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.