* [PATCH next] btrfs: Fix reversed condition in copy_inline_to_page()
@ 2024-08-27 10:21 Dan Carpenter
2024-08-27 15:37 ` David Sterba
2024-08-28 12:53 ` Li Zetao
0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2024-08-27 10:21 UTC (permalink / raw)
To: Li Zetao
Cc: Chris Mason, Josef Bacik, David Sterba, linux-btrfs,
linux-kernel, kernel-janitors
This if statement is reversed leading to locking issues.
Fixes: 8e603cfe05f0 ("btrfs: convert copy_inline_to_page() to use folio")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
This patch is obviously correct but it's from static analysis so additional
testing would be good as well.
fs/btrfs/reflink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/reflink.c b/fs/btrfs/reflink.c
index 1681d63f03dd..f0824c948cb7 100644
--- a/fs/btrfs/reflink.c
+++ b/fs/btrfs/reflink.c
@@ -146,7 +146,7 @@ static int copy_inline_to_page(struct btrfs_inode *inode,
btrfs_folio_clear_checked(fs_info, folio, file_offset, block_size);
btrfs_folio_set_dirty(fs_info, folio, file_offset, block_size);
out_unlock:
- if (IS_ERR(folio)) {
+ if (!IS_ERR(folio)) {
folio_unlock(folio);
folio_put(folio);
}
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH next] btrfs: Fix reversed condition in copy_inline_to_page()
2024-08-27 10:21 [PATCH next] btrfs: Fix reversed condition in copy_inline_to_page() Dan Carpenter
@ 2024-08-27 15:37 ` David Sterba
2024-08-28 12:53 ` Li Zetao
1 sibling, 0 replies; 4+ messages in thread
From: David Sterba @ 2024-08-27 15:37 UTC (permalink / raw)
To: Dan Carpenter
Cc: Li Zetao, Chris Mason, Josef Bacik, David Sterba, linux-btrfs,
linux-kernel, kernel-janitors
On Tue, Aug 27, 2024 at 01:21:08PM +0300, Dan Carpenter wrote:
> This if statement is reversed leading to locking issues.
>
> Fixes: 8e603cfe05f0 ("btrfs: convert copy_inline_to_page() to use folio")
This is from series that appeared in linux-next for a short time and has
been removed due to problems, one if which might be the one you report.
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH next] btrfs: Fix reversed condition in copy_inline_to_page()
2024-08-27 10:21 [PATCH next] btrfs: Fix reversed condition in copy_inline_to_page() Dan Carpenter
2024-08-27 15:37 ` David Sterba
@ 2024-08-28 12:53 ` Li Zetao
2024-08-28 13:13 ` Dan Carpenter
1 sibling, 1 reply; 4+ messages in thread
From: Li Zetao @ 2024-08-28 12:53 UTC (permalink / raw)
To: Dan Carpenter
Cc: Chris Mason, Josef Bacik, David Sterba, linux-btrfs,
linux-kernel, kernel-janitors
Hi Dan,
在 2024/8/27 18:21, Dan Carpenter 写道:
> This if statement is reversed leading to locking issues.
>
> Fixes: 8e603cfe05f0 ("btrfs: convert copy_inline_to_page() to use folio")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> This patch is obviously correct but it's from static analysis so additional
> testing would be good as well.
>
> fs/btrfs/reflink.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/reflink.c b/fs/btrfs/reflink.c
> index 1681d63f03dd..f0824c948cb7 100644
> --- a/fs/btrfs/reflink.c
> +++ b/fs/btrfs/reflink.c
> @@ -146,7 +146,7 @@ static int copy_inline_to_page(struct btrfs_inode *inode,
> btrfs_folio_clear_checked(fs_info, folio, file_offset, block_size);
> btrfs_folio_set_dirty(fs_info, folio, file_offset, block_size);
> out_unlock:
> - if (IS_ERR(folio)) {
> + if (!IS_ERR(folio)) {
This is a mistake caused by my carelessness,thank you for the patch
> folio_unlock(folio);
> folio_put(folio);
> }
Can I merge your patch into my patchset and add you as a co-author?
Thanks,
Li Zetao.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH next] btrfs: Fix reversed condition in copy_inline_to_page()
2024-08-28 12:53 ` Li Zetao
@ 2024-08-28 13:13 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2024-08-28 13:13 UTC (permalink / raw)
To: Li Zetao
Cc: Chris Mason, Josef Bacik, David Sterba, linux-btrfs,
linux-kernel, kernel-janitors
On Wed, Aug 28, 2024 at 08:53:44PM +0800, Li Zetao wrote:
> Hi Dan,
>
> 在 2024/8/27 18:21, Dan Carpenter 写道:
> > This if statement is reversed leading to locking issues.
> >
> > Fixes: 8e603cfe05f0 ("btrfs: convert copy_inline_to_page() to use folio")
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> > ---
> > This patch is obviously correct but it's from static analysis so additional
> > testing would be good as well.
> >
> > fs/btrfs/reflink.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/btrfs/reflink.c b/fs/btrfs/reflink.c
> > index 1681d63f03dd..f0824c948cb7 100644
> > --- a/fs/btrfs/reflink.c
> > +++ b/fs/btrfs/reflink.c
> > @@ -146,7 +146,7 @@ static int copy_inline_to_page(struct btrfs_inode *inode,
> > btrfs_folio_clear_checked(fs_info, folio, file_offset, block_size);
> > btrfs_folio_set_dirty(fs_info, folio, file_offset, block_size);
> > out_unlock:
> > - if (IS_ERR(folio)) {
> > + if (!IS_ERR(folio)) {
> This is a mistake caused by my carelessness,thank you for the patch
> > folio_unlock(folio);
> > folio_put(folio);
> > }
>
> Can I merge your patch into my patchset and add you as a co-author?
Just merge it. No need for co-author credit for something tiny like this. :P
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-08-28 13:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-27 10:21 [PATCH next] btrfs: Fix reversed condition in copy_inline_to_page() Dan Carpenter
2024-08-27 15:37 ` David Sterba
2024-08-28 12:53 ` Li Zetao
2024-08-28 13:13 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®