linux-bcachefs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bcachefs: Fix error path of bch2_link_trans()
@ 2024-04-30  3:28 Youling Tang
  2024-04-30  3:31 ` Kent Overstreet
  0 siblings, 1 reply; 5+ messages in thread
From: Youling Tang @ 2024-04-30  3:28 UTC (permalink / raw)
  To: Kent Overstreet; +Cc: linux-bcachefs, linux-kernel, Youling Tang

From: Youling Tang <tangyouling@kylinos.cn>

In bch2_link_trans(), if bch2_inode_nlink_inc() fails, it needs to
call bch2_trans_iter_exit() in the error path.

Signed-off-by: Youling Tang <tangyouling@kylinos.cn>
---
 fs/bcachefs/fs-common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/bcachefs/fs-common.c b/fs/bcachefs/fs-common.c
index 6c737def357e..508d029ac53d 100644
--- a/fs/bcachefs/fs-common.c
+++ b/fs/bcachefs/fs-common.c
@@ -200,12 +200,12 @@ int bch2_link_trans(struct btree_trans *trans,
 
 	ret = bch2_inode_peek(trans, &inode_iter, inode_u, inum, BTREE_ITER_intent);
 	if (ret)
-		goto err;
+		return ret;
 
 	inode_u->bi_ctime = now;
 	ret = bch2_inode_nlink_inc(inode_u);
 	if (ret)
-		return ret;
+		goto err;
 
 	ret = bch2_inode_peek(trans, &dir_iter, dir_u, dir, BTREE_ITER_intent);
 	if (ret)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] bcachefs: Fix error path of bch2_link_trans()
  2024-04-30  3:28 [PATCH] bcachefs: Fix error path of bch2_link_trans() Youling Tang
@ 2024-04-30  3:31 ` Kent Overstreet
  2024-04-30  9:18   ` Markus Elfring
  0 siblings, 1 reply; 5+ messages in thread
From: Kent Overstreet @ 2024-04-30  3:31 UTC (permalink / raw)
  To: Youling Tang; +Cc: linux-bcachefs, linux-kernel, Youling Tang

On Tue, Apr 30, 2024 at 11:28:39AM +0800, Youling Tang wrote:
> From: Youling Tang <tangyouling@kylinos.cn>
> 
> In bch2_link_trans(), if bch2_inode_nlink_inc() fails, it needs to
> call bch2_trans_iter_exit() in the error path.

Thanks - applied.
> 
> Signed-off-by: Youling Tang <tangyouling@kylinos.cn>
> ---
>  fs/bcachefs/fs-common.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/bcachefs/fs-common.c b/fs/bcachefs/fs-common.c
> index 6c737def357e..508d029ac53d 100644
> --- a/fs/bcachefs/fs-common.c
> +++ b/fs/bcachefs/fs-common.c
> @@ -200,12 +200,12 @@ int bch2_link_trans(struct btree_trans *trans,
>  
>  	ret = bch2_inode_peek(trans, &inode_iter, inode_u, inum, BTREE_ITER_intent);
>  	if (ret)
> -		goto err;
> +		return ret;
>  
>  	inode_u->bi_ctime = now;
>  	ret = bch2_inode_nlink_inc(inode_u);
>  	if (ret)
> -		return ret;
> +		goto err;
>  
>  	ret = bch2_inode_peek(trans, &dir_iter, dir_u, dir, BTREE_ITER_intent);
>  	if (ret)
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bcachefs: Fix error path of bch2_link_trans()
  2024-04-30  3:31 ` Kent Overstreet
@ 2024-04-30  9:18   ` Markus Elfring
  2024-04-30  9:29     ` Youling Tang
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Elfring @ 2024-04-30  9:18 UTC (permalink / raw)
  To: Kent Overstreet, Youling Tang, linux-bcachefs
  Cc: LKML, kernel-janitors, Youling Tang

> > In bch2_link_trans(), if bch2_inode_nlink_inc() fails, it needs to
> > call bch2_trans_iter_exit() in the error path.
>
> Thanks - applied.

https://evilpiepirate.org/git/bcachefs.git/commit/?id=d04db1c7653dee5ee5f918ce951c05eefddad7eb

Would it have been nice to add the tag “Fixes” (besides an imperative wording) accordingly?

Regards,
Markus

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bcachefs: Fix error path of bch2_link_trans()
  2024-04-30  9:18   ` Markus Elfring
@ 2024-04-30  9:29     ` Youling Tang
  2024-04-30 10:55       ` Markus Elfring
  0 siblings, 1 reply; 5+ messages in thread
From: Youling Tang @ 2024-04-30  9:29 UTC (permalink / raw)
  To: Markus Elfring, Kent Overstreet, Youling Tang, linux-bcachefs
  Cc: LKML, kernel-janitors

Hi, Kent

On 30/04/2024 17:18, Markus Elfring wrote:
>>> In bch2_link_trans(), if bch2_inode_nlink_inc() fails, it needs to
>>> call bch2_trans_iter_exit() in the error path.
>> Thanks - applied.
> https://evilpiepirate.org/git/bcachefs.git/commit/?id=d04db1c7653dee5ee5f918ce951c05eefddad7eb
>
> Would it have been nice to add the tag “Fixes” (besides an imperative wording) accordingly?
The following labels can be added:
Fixes: 962ad1a7666 ("bcachefs: Don't BUG_ON() inode link count underflow")

Thanks,
Youling.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bcachefs: Fix error path of bch2_link_trans()
  2024-04-30  9:29     ` Youling Tang
@ 2024-04-30 10:55       ` Markus Elfring
  0 siblings, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2024-04-30 10:55 UTC (permalink / raw)
  To: Youling Tang, Kent Overstreet, linux-bcachefs, kernel-janitors
  Cc: LKML, Youling Tang

>> https://evilpiepirate.org/git/bcachefs.git/commit/?id=d04db1c7653dee5ee5f918ce951c05eefddad7eb
>>
>> Would it have been nice to add the tag “Fixes” (besides an imperative wording) accordingly?
> The following labels can be added:
> Fixes: 962ad1a7666 ("bcachefs: Don't BUG_ON() inode link count underflow")

May the corresponding hash be longer than eleven characters?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.9-rc6#n145

Regards,
Markus

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-30 10:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-30  3:28 [PATCH] bcachefs: Fix error path of bch2_link_trans() Youling Tang
2024-04-30  3:31 ` Kent Overstreet
2024-04-30  9:18   ` Markus Elfring
2024-04-30  9:29     ` Youling Tang
2024-04-30 10:55       ` Markus Elfring

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).