Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: dsterba@suse.cz, Sun YangKai <sunk67188@gmail.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v3] btrfs: more trivial BTRFS_PATH_AUTO_FREE conversions
Date: Mon, 1 Sep 2025 08:21:58 +0930	[thread overview]
Message-ID: <8c6af9a9-e446-4a18-a31e-3bd924d329b6@gmx.com> (raw)
In-Reply-To: <20250830010802.GB5333@twin.jikos.cz>



在 2025/8/30 10:38, David Sterba 写道:
> On Fri, Aug 29, 2025 at 04:35:36PM +0800, Sun YangKai wrote:
>> Trival pattern for the auto freeing with goto -> return conversions
>> if possible. No other function cleanup.
>>
>> The following cases are considered trivial in this patch:
>> 1. Cases where there are no operations between btrfs_free_path and the
>> function return.
>> 2. Cases where only simple cleanup operations (such as kfree, kvfree,
>> clear_bit, and fs_path_free) are present between btrfs_free_path and the
>> function return.
>>
>> Signed-off-by: Sun YangKai <sunk67188@gmail.com>
>>
>> ---
>>
>> Changelog:
>> v1 -> v3:
>> * Directly return 0 if info is NULL in send.c:get_inode_info()
>> * Limit the scope of the conversion to only what is described
>>    in the commit message.
> 
> Thanks, this looks good. If you find more cases for conversion, please
> send them. There were some minor conflicts with this patch so please
> use https://github.com/btrfs/linux branch for-next as base.
> 

I guess no one has yet tried to run any test case with this seemingly 
safe conversion.

It will easily hang the fs, with the following blocked processes:

[   85.124607] sysrq: Show Blocked State
[   85.125981] task:btrfs-transacti state:D stack:0     pid:1302 
tgid:1302  ppid:2      task_flags:0x208040 flags:0x00004000
[   85.129163] Call Trace:
[   85.130115]  <TASK>
[   85.130813]  __schedule+0x40d/0x12c0
[   85.131883]  ? psi_task_switch+0x113/0x290
[   85.133119]  ? finish_task_switch.isra.0+0x92/0x290
[   85.134584]  schedule+0x27/0xd0
[   85.135567]  wait_current_trans+0x107/0x170 [btrfs 
72a0a5602f44912ca5c15cad9f44c855141eb851]
[   85.138128]  ? __sched_core_set+0x1e0/0x1e0
[   85.139375]  start_transaction+0x383/0x830 [btrfs 
72a0a5602f44912ca5c15cad9f44c855141eb851]
[   85.141872]  transaction_kthread+0xb8/0x1b0 [btrfs 
72a0a5602f44912ca5c15cad9f44c855141eb851]
[   85.144361]  ? btrfs_cleanup_transaction.isra.0+0x5d0/0x5d0 [btrfs 
72a0a5602f44912ca5c15cad9f44c855141eb851]
[   85.147191]  kthread+0xf9/0x240
[   85.148207]  ? kthreads_online_cpu+0x130/0x130
[   85.149517]  ret_from_fork+0x17b/0x1a0
[   85.150580]  ? kthreads_online_cpu+0x130/0x130
[   85.151828]  ret_from_fork_asm+0x11/0x20
[   85.153028]  </TASK>
[   85.153682] task:sync            state:D stack:0     pid:1311 
tgid:1311  ppid:1310   task_flags:0x400100 flags:0x00004002
[   85.156609] Call Trace:
[   85.157388]  <TASK>
[   85.158041]  __schedule+0x40d/0x12c0
[   85.159143]  ? asm_sysvec_apic_timer_interrupt+0x1a/0x20
[   85.160732]  schedule+0x27/0xd0
[   85.161728]  schedule_preempt_disabled+0x15/0x20
[   85.163141]  rwsem_down_write_slowpath+0x1fe/0x760
[   85.164563]  ? xas_load+0x9/0xc0
[   85.165531]  ? xas_find+0x136/0x180
[   85.166625]  down_write+0x52/0x60
[   85.167713]  btrfs_tree_lock_nested+0x1d/0x90 [btrfs 
72a0a5602f44912ca5c15cad9f44c855141eb851]
[   85.170405]  btrfs_lock_root_node+0x35/0x50 [btrfs 
72a0a5602f44912ca5c15cad9f44c855141eb851]
[   85.172992]  commit_cowonly_roots+0x49/0x260 [btrfs 
72a0a5602f44912ca5c15cad9f44c855141eb851]
[   85.175405]  btrfs_commit_transaction+0x326/0xd70 [btrfs 
72a0a5602f44912ca5c15cad9f44c855141eb851]
[   85.178077]  ? vfs_fsync_range+0x90/0x90
[   85.179206]  ? btrfs_attach_transaction_barrier+0x25/0x60 [btrfs 
72a0a5602f44912ca5c15cad9f44c855141eb851]
[   85.182205]  ? vfs_fsync_range+0x90/0x90
[   85.183431]  __iterate_supers+0xd6/0x160
[   85.184616]  ksys_sync+0x63/0xa0
[   85.185608]  __do_sys_sync+0xe/0x20
[   85.186719]  do_syscall_64+0x82/0xae0
[   85.187858]  ? obj_cgroup_charge_account+0x145/0x410
[   85.189343]  ? ___pte_offset_map+0x1b/0x150
[   85.190601]  ? set_pte_range+0xf2/0x290
[   85.191775]  ? next_uptodate_folio+0x89/0x2a0
[   85.193094]  ? filemap_map_pages+0x413/0x680
[   85.194383]  ? __alloc_frozen_pages_noprof+0x19c/0x370
[   85.195903]  ? do_fault+0x342/0x5a0
[   85.196968]  ? __handle_mm_fault+0x8c4/0xf00
[   85.198265]  ? count_memcg_events+0xba/0x180
[   85.199570]  ? handle_mm_fault+0x1d3/0x2d0
[   85.200865]  ? do_user_addr_fault+0x216/0x690
[   85.202156]  ? exc_page_fault+0x7e/0x1a0
[   85.203308]  entry_SYSCALL_64_after_hwframe+0x4b/0x53
[   85.204739] RIP: 0033:0x7f4e4634ce7b
[   85.205813] RSP: 002b:00007ffd7485f3c8 EFLAGS: 00000246 ORIG_RAX: 
00000000000000a2
[   85.208142] RAX: ffffffffffffffda RBX: 00007ffd7485f5c8 RCX: 
00007f4e4634ce7b
[   85.210268] RDX: 00007f4e4641c201 RSI: 00007f4e4641c248 RDI: 
00007f4e463e65c9
[   85.212549] RBP: 00007ffd7485f4a0 R08: 0000000000000000 R09: 
0000000000000000
[   85.214726] R10: 0000000000000004 R11: 0000000000000246 R12: 
00007f4e4641c248
[   85.216901] R13: 0000000000000001 R14: 0000559279cf61d0 R15: 
0000559279cf7b60
[   85.218907]  </TASK>

I believe it's some path not properly released.

So I have removed it from for-next for now.

Thanks,
Qu

  reply	other threads:[~2025-08-31 22:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-29  8:35 [PATCH v3] btrfs: more trivial BTRFS_PATH_AUTO_FREE conversions Sun YangKai
2025-08-30  1:08 ` David Sterba
2025-08-31 22:51   ` Qu Wenruo [this message]
2025-09-01  6:56     ` Sun YangKai
2025-09-01  7:54       ` Sun YangKai
2025-09-01 14:44         ` Filipe Manana

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=8c6af9a9-e446-4a18-a31e-3bd924d329b6@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=sunk67188@gmail.com \
    /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