The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Hongling Zeng <zhongling0719@126.com>
To: dsterba@suse.cz, Hongling Zeng <zenghongling@kylinos.cn>
Cc: clm@fb.com, dsterba@suse.com, linux-btrfs@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs: Add missing sctx check in cleanup path
Date: Tue, 14 Jul 2026 09:20:18 +0800	[thread overview]
Message-ID: <6A558ED2.2020902@126.com> (raw)
In-Reply-To: <20260713183508.GA8426@twin.jikos.cz>


在 2026年07月14日 02:35, David Sterba 写道:
> On Tue, Jul 07, 2026 at 05:16:04PM +0800, Hongling Zeng wrote:
>> Add sctx NULL check in the sort_clone_roots cleanup path for
>> consistency with other cleanup paths in the function.
>>
>> Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
>> ---
>>   fs/btrfs/send.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
>> index 3ae480c7474b..2d81fac03a3d 100644
>> --- a/fs/btrfs/send.c
>> +++ b/fs/btrfs/send.c
>> @@ -8250,7 +8250,7 @@ long btrfs_ioctl_send(struct btrfs_root *send_root, const struct btrfs_ioctl_sen
>>   		free_orphan_dir_info(sctx, odi);
>>   	}
>>   
>> -	if (sort_clone_roots) {
>> +	if (sctx && sort_clone_roots) {
> The check for sctx is indeed missing but in the else branch the
> condition is inside the for loop:
>
>    for (i = 0; sctx && i < clone_sources_to_rollback; i++) {
>
> It would be better to place it there for consistency.
>
> Overall in the function many of the sctx checks can be removed if the
> allocation is moved to the beginning.
  Thanks for the review.

   You're right, putting the sctx check inside the for loop condition 
would be more
   consistent with the else branch pattern. I'll send a v2 patch with 
this change.

   Best regards,
   Hongling Zeng


      reply	other threads:[~2026-07-14  1:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-07  9:16 [PATCH] btrfs: Add missing sctx check in cleanup path Hongling Zeng
2026-07-13 18:35 ` David Sterba
2026-07-14  1:20   ` Hongling Zeng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6A558ED2.2020902@126.com \
    --to=zhongling0719@126.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zenghongling@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox