* [PATCH] btrfs: Fix an error handling path in btrfs_read_sys_array()
@ 2022-05-14 12:01 Christophe JAILLET
2022-05-14 22:57 ` Qu Wenruo
0 siblings, 1 reply; 6+ messages in thread
From: Christophe JAILLET @ 2022-05-14 12:01 UTC (permalink / raw)
To: Chris Mason, Josef Bacik, David Sterba, Qu Wenruo
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-btrfs
If alloc_dummy_extent_buffer() we should return an error code, not 0 that
would mean success.
Fixes: a1fc41ac28d3 ("btrfs: use dummy extent buffer for super block sys chunk array read")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
fs/btrfs/volumes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index b2d5a54ea172..9c20049d1fec 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -7359,7 +7359,7 @@ int btrfs_read_sys_array(struct btrfs_fs_info *fs_info)
*/
sb = alloc_dummy_extent_buffer(fs_info, BTRFS_SUPER_INFO_OFFSET);
if (!sb)
- return PTR_ERR(sb);
+ return -ENOMEM;
set_extent_buffer_uptodate(sb);
write_extent_buffer(sb, super_copy, 0, BTRFS_SUPER_INFO_SIZE);
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] btrfs: Fix an error handling path in btrfs_read_sys_array()
2022-05-14 12:01 [PATCH] btrfs: Fix an error handling path in btrfs_read_sys_array() Christophe JAILLET
@ 2022-05-14 22:57 ` Qu Wenruo
2022-05-16 13:54 ` Dan Carpenter
0 siblings, 1 reply; 6+ messages in thread
From: Qu Wenruo @ 2022-05-14 22:57 UTC (permalink / raw)
To: Christophe JAILLET, Chris Mason, Josef Bacik, David Sterba, Qu Wenruo
Cc: linux-kernel, kernel-janitors, linux-btrfs
On 2022/5/14 20:01, Christophe JAILLET wrote:
> If alloc_dummy_extent_buffer() we should return an error code, not 0 that
> would mean success.
>
> Fixes: a1fc41ac28d3 ("btrfs: use dummy extent buffer for super block sys chunk array read")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Qu Wenruo <wqu@suse.com>
All my fault, thanks for catching it.
Qu
> ---
> fs/btrfs/volumes.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index b2d5a54ea172..9c20049d1fec 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -7359,7 +7359,7 @@ int btrfs_read_sys_array(struct btrfs_fs_info *fs_info)
> */
> sb = alloc_dummy_extent_buffer(fs_info, BTRFS_SUPER_INFO_OFFSET);
> if (!sb)
> - return PTR_ERR(sb);
> + return -ENOMEM;
> set_extent_buffer_uptodate(sb);
>
> write_extent_buffer(sb, super_copy, 0, BTRFS_SUPER_INFO_SIZE);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] btrfs: Fix an error handling path in btrfs_read_sys_array()
2022-05-14 22:57 ` Qu Wenruo
@ 2022-05-16 13:54 ` Dan Carpenter
2022-05-16 15:01 ` David Sterba
0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2022-05-16 13:54 UTC (permalink / raw)
To: Qu Wenruo
Cc: Christophe JAILLET, Chris Mason, Josef Bacik, David Sterba,
Qu Wenruo, linux-kernel, kernel-janitors, linux-btrfs
On Sun, May 15, 2022 at 06:57:25AM +0800, Qu Wenruo wrote:
>
>
> On 2022/5/14 20:01, Christophe JAILLET wrote:
> > If alloc_dummy_extent_buffer() we should return an error code, not 0 that
> > would mean success.
> >
> > Fixes: a1fc41ac28d3 ("btrfs: use dummy extent buffer for super block sys chunk array read")
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>
> Reviewed-by: Qu Wenruo <wqu@suse.com>
>
> All my fault, thanks for catching it.
> Qu
>
I sent this patch in January and David was going to fold it into the
original patch but it got lost. Thanks, Christophe!
regards,
dan carpenter
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] btrfs: Fix an error handling path in btrfs_read_sys_array()
2022-05-16 13:54 ` Dan Carpenter
@ 2022-05-16 15:01 ` David Sterba
2022-05-16 17:42 ` Christophe JAILLET
0 siblings, 1 reply; 6+ messages in thread
From: David Sterba @ 2022-05-16 15:01 UTC (permalink / raw)
To: Dan Carpenter
Cc: Qu Wenruo, Christophe JAILLET, Chris Mason, Josef Bacik,
David Sterba, Qu Wenruo, linux-kernel, kernel-janitors,
linux-btrfs
On Mon, May 16, 2022 at 04:54:07PM +0300, Dan Carpenter wrote:
> On Sun, May 15, 2022 at 06:57:25AM +0800, Qu Wenruo wrote:
> >
> >
> > On 2022/5/14 20:01, Christophe JAILLET wrote:
> > > If alloc_dummy_extent_buffer() we should return an error code, not 0 that
> > > would mean success.
> > >
> > > Fixes: a1fc41ac28d3 ("btrfs: use dummy extent buffer for super block sys chunk array read")
> > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> >
> > Reviewed-by: Qu Wenruo <wqu@suse.com>
> >
> > All my fault, thanks for catching it.
> > Qu
> >
>
> I sent this patch in January and David was going to fold it into the
> original patch but it got lost. Thanks, Christophe!
I found my reply to your fix that I folded the fixup, but then it got
lost for some reason. Probably because I picked the patchset from
mailing list again and did not take the local branch. I'll fold the fix
again as it' still in the unmerged branch. Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] btrfs: Fix an error handling path in btrfs_read_sys_array()
2022-05-16 15:01 ` David Sterba
@ 2022-05-16 17:42 ` Christophe JAILLET
2022-05-17 5:55 ` Dan Carpenter
0 siblings, 1 reply; 6+ messages in thread
From: Christophe JAILLET @ 2022-05-16 17:42 UTC (permalink / raw)
To: dsterba, Dan Carpenter, Qu Wenruo, Chris Mason, Josef Bacik,
David Sterba, Qu Wenruo, linux-kernel, kernel-janitors,
linux-btrfs
Le 16/05/2022 à 17:01, David Sterba a écrit :
> On Mon, May 16, 2022 at 04:54:07PM +0300, Dan Carpenter wrote:
>> On Sun, May 15, 2022 at 06:57:25AM +0800, Qu Wenruo wrote:
>>>
>>>
>>> On 2022/5/14 20:01, Christophe JAILLET wrote:
>>>> If alloc_dummy_extent_buffer() we should return an error code, not 0 that
>>>> would mean success.
>>>>
>>>> Fixes: a1fc41ac28d3 ("btrfs: use dummy extent buffer for super block sys chunk array read")
>>>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>>>
>>> Reviewed-by: Qu Wenruo <wqu@suse.com>
>>>
>>> All my fault, thanks for catching it.
>>> Qu
>>>
>>
>> I sent this patch in January and David was going to fold it into the
>> original patch but it got lost. Thanks, Christophe!
Hi,
Not exactly.
Your patch was:
- if (IS_ERR(sb))
- return PTR_ERR(sb);
+ if (!sb)
+ return -ENOMEM;
Mine is only:
- return PTR_ERR(sb);
+ return -ENOMEM;
So for some reason, what you had reported was just half applied. (or
half fixed by someone else)
>
> I found my reply to your fix that I folded the fixup, but then it got
> lost for some reason. Probably because I picked the patchset from
> mailing list again and did not take the local branch. I'll fold the fix
> again as it' still in the unmerged branch. Thanks.
>
just in case, the Fixes tag in Dan's patch leads to:
"Notice: this object is not reachable from any branch."
I don't think that it is of any importance if the fix in folded, but in
case, I let you know.
CJ
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] btrfs: Fix an error handling path in btrfs_read_sys_array()
2022-05-16 17:42 ` Christophe JAILLET
@ 2022-05-17 5:55 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2022-05-17 5:55 UTC (permalink / raw)
To: Christophe JAILLET
Cc: dsterba, Qu Wenruo, Chris Mason, Josef Bacik, David Sterba,
Qu Wenruo, linux-kernel, kernel-janitors, linux-btrfs
On Mon, May 16, 2022 at 07:42:23PM +0200, Christophe JAILLET wrote:
> Le 16/05/2022 à 17:01, David Sterba a écrit :
> > On Mon, May 16, 2022 at 04:54:07PM +0300, Dan Carpenter wrote:
> > > On Sun, May 15, 2022 at 06:57:25AM +0800, Qu Wenruo wrote:
> > > >
> > > >
> > > > On 2022/5/14 20:01, Christophe JAILLET wrote:
> > > > > If alloc_dummy_extent_buffer() we should return an error code, not 0 that
> > > > > would mean success.
> > > > >
> > > > > Fixes: a1fc41ac28d3 ("btrfs: use dummy extent buffer for super block sys chunk array read")
> > > > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> > > >
> > > > Reviewed-by: Qu Wenruo <wqu@suse.com>
> > > >
> > > > All my fault, thanks for catching it.
> > > > Qu
> > > >
> > >
> > > I sent this patch in January and David was going to fold it into the
> > > original patch but it got lost. Thanks, Christophe!
>
> Hi,
>
> Not exactly.
> Your patch was:
> - if (IS_ERR(sb))
> - return PTR_ERR(sb);
> + if (!sb)
> + return -ENOMEM;
>
> Mine is only:
> - return PTR_ERR(sb);
> + return -ENOMEM;
>
> So for some reason, what you had reported was just half applied. (or half
> fixed by someone else)
>
Oh that's interesting. I must have seen the same Smatch warning that
you saw and ignored it because I got confused which patch I had sent.
The kbuild-bot also tried to send a warning, but I squashed it for
the same reasons. So in terms of process issues and avoidable bugs this
one is partly my bad.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-05-17 5:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-14 12:01 [PATCH] btrfs: Fix an error handling path in btrfs_read_sys_array() Christophe JAILLET
2022-05-14 22:57 ` Qu Wenruo
2022-05-16 13:54 ` Dan Carpenter
2022-05-16 15:01 ` David Sterba
2022-05-16 17:42 ` Christophe JAILLET
2022-05-17 5:55 ` Dan Carpenter
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).