Skip to content

Improve Debian Package Builds - #2

Merged
koverstreet merged 2 commits into
koverstreet:masterfrom
modelrockettier:master
Feb 12, 2018
Merged

Improve Debian Package Builds#2
koverstreet merged 2 commits into
koverstreet:masterfrom
modelrockettier:master

Conversation

@modelrockettier

Copy link
Copy Markdown
  • Sets PREFIX back to /usr for debian package builds (which was changed in 6c9e9b6).

    • Other builds (i.e. "make install") still default to /usr/local.
  • Increases the debian/compat level to 10 to allow for parallel builds by default.

  • Use short opts for debuild command in the Makefile.

    • Long opts were added in dpkg-dev 1.18.8, which is newer than is available in Ubuntu 16.04.

	* Compat level 10 allows parallel builds by default.
	* Also changed debuild to use short arguments.
	* Long arguments weren't supported until dpkg-dev 1.18.8.
@koverstreet
koverstreet merged commit 8d95f4a into koverstreet:master Feb 12, 2018
koverstreet pushed a commit that referenced this pull request May 13, 2026
This fixes a deadlock:

01305 WARNING: possible circular locking dependency detected
01305 6.3.0-ktest-gf4de9bee61af #5305 Tainted: G        W
01305 ------------------------------------------------------
01305 cat/14658 is trying to acquire lock:
01305 ffffffc00982f460 (fs_reclaim){+.+.}-{0:0}, at: __kmem_cache_alloc_node+0x48/0x278
01305
01305 but task is already holding lock:
01305 ffffff8011aaf040 (&lock->wait_lock){+.+.}-{2:2}, at: bch2_check_for_deadlock+0x4b8/0xa58
01305
01305 which lock already depends on the new lock.
01305
01305
01305 the existing dependency chain (in reverse order) is:
01305
01305 -> #2 (&lock->wait_lock){+.+.}-{2:2}:
01305        _raw_spin_lock+0x54/0x70
01305        __six_lock_wakeup+0x40/0x1b0
01305        six_unlock_ip+0xe8/0x248
01305        bch2_btree_key_cache_scan+0x720/0x940
01305        shrink_slab.constprop.0+0x284/0x770
01305        shrink_node+0x390/0x828
01305        balance_pgdat+0x390/0x6d0
01305        kswapd+0x2e4/0x718
01305        kthread+0x184/0x1a8
01305        ret_from_fork+0x10/0x20
01305
01305 -> #1 (&c->lock#2){+.+.}-{3:3}:
01305        __mutex_lock+0x104/0x14a0
01305        mutex_lock_nested+0x30/0x40
01305        bch2_btree_key_cache_scan+0x5c/0x940
01305        shrink_slab.constprop.0+0x284/0x770
01305        shrink_node+0x390/0x828
01305        balance_pgdat+0x390/0x6d0
01305        kswapd+0x2e4/0x718
01305        kthread+0x184/0x1a8
01305        ret_from_fork+0x10/0x20
01305
01305 -> #0 (fs_reclaim){+.+.}-{0:0}:
01305        __lock_acquire+0x19d0/0x2930
01305        lock_acquire+0x1dc/0x458
01305        fs_reclaim_acquire+0x9c/0xe0
01305        __kmem_cache_alloc_node+0x48/0x278
01305        __kmalloc_node_track_caller+0x5c/0x278
01305        krealloc+0x94/0x180
01305        bch2_printbuf_make_room.part.0+0xac/0x118
01305        bch2_prt_printf+0x150/0x1e8
01305        bch2_btree_bkey_cached_common_to_text+0x170/0x298
01305        bch2_btree_trans_to_text+0x244/0x348
01305        print_cycle+0x7c/0xb0
01305        break_cycle+0x254/0x528
01305        bch2_check_for_deadlock+0x59c/0xa58
01305        bch2_btree_deadlock_read+0x174/0x200
01305        full_proxy_read+0x94/0xf0
01305        vfs_read+0x15c/0x3a8
01305        ksys_read+0xb8/0x148
01305        __arm64_sys_read+0x48/0x60
01305        invoke_syscall.constprop.0+0x64/0x138
01305        do_el0_svc+0x84/0x138
01305        el0_svc+0x34/0x80
01305        el0t_64_sync_handler+0xb0/0xb8
01305        el0t_64_sync+0x14c/0x150
01305
01305 other info that might help us debug this:
01305
01305 Chain exists of:
01305   fs_reclaim --> &c->lock#2 --> &lock->wait_lock
01305
01305  Possible unsafe locking scenario:
01305
01305        CPU0                    CPU1
01305        ----                    ----
01305   lock(&lock->wait_lock);
01305                                lock(&c->lock#2);
01305                                lock(&lock->wait_lock);
01305   lock(fs_reclaim);
01305
01305  *** DEADLOCK ***

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
koverstreet pushed a commit that referenced this pull request May 13, 2026
When I was testing mongodb over bcachefs with compression,
there is a lockdep warning when snapshotting mongodb data volume.

$ cat test.sh
prog=bcachefs

$prog subvolume create /mnt/data
$prog subvolume create /mnt/data/snapshots

while true;do
    $prog subvolume snapshot /mnt/data /mnt/data/snapshots/$(date +%s)
    sleep 1s
done

$ cat /etc/mongodb.conf
systemLog:
  destination: file
  logAppend: true
  path: /mnt/data/mongod.log

storage:
  dbPath: /mnt/data/

lockdep reports:
[ 3437.452330] ======================================================
[ 3437.452750] WARNING: possible circular locking dependency detected
[ 3437.453168] 6.7.0-rc7-custom+ #85 Tainted: G            E
[ 3437.453562] ------------------------------------------------------
[ 3437.453981] bcachefs/35533 is trying to acquire lock:
[ 3437.454325] ffffa0a02b2b1418 (sb_writers#10){.+.+}-{0:0}, at: filename_create+0x62/0x190
[ 3437.454875]
               but task is already holding lock:
[ 3437.455268] ffffa0a02b2b10e0 (&type->s_umount_key#48){.+.+}-{3:3}, at: bch2_fs_file_ioctl+0x232/0xc90 [bcachefs]
[ 3437.456009]
               which lock already depends on the new lock.

[ 3437.456553]
               the existing dependency chain (in reverse order) is:
[ 3437.457054]
               -> #3 (&type->s_umount_key#48){.+.+}-{3:3}:
[ 3437.457507]        down_read+0x3e/0x170
[ 3437.457772]        bch2_fs_file_ioctl+0x232/0xc90 [bcachefs]
[ 3437.458206]        __x64_sys_ioctl+0x93/0xd0
[ 3437.458498]        do_syscall_64+0x42/0xf0
[ 3437.458779]        entry_SYSCALL_64_after_hwframe+0x6e/0x76
[ 3437.459155]
               -> #2 (&c->snapshot_create_lock){++++}-{3:3}:
[ 3437.459615]        down_read+0x3e/0x170
[ 3437.459878]        bch2_truncate+0x82/0x110 [bcachefs]
[ 3437.460276]        bchfs_truncate+0x254/0x3c0 [bcachefs]
[ 3437.460686]        notify_change+0x1f1/0x4a0
[ 3437.461283]        do_truncate+0x7f/0xd0
[ 3437.461555]        path_openat+0xa57/0xce0
[ 3437.461836]        do_filp_open+0xb4/0x160
[ 3437.462116]        do_sys_openat2+0x91/0xc0
[ 3437.462402]        __x64_sys_openat+0x53/0xa0
[ 3437.462701]        do_syscall_64+0x42/0xf0
[ 3437.462982]        entry_SYSCALL_64_after_hwframe+0x6e/0x76
[ 3437.463359]
               -> #1 (&sb->s_type->i_mutex_key#15){+.+.}-{3:3}:
[ 3437.463843]        down_write+0x3b/0xc0
[ 3437.464223]        bch2_write_iter+0x5b/0xcc0 [bcachefs]
[ 3437.464493]        vfs_write+0x21b/0x4c0
[ 3437.464653]        ksys_write+0x69/0xf0
[ 3437.464839]        do_syscall_64+0x42/0xf0
[ 3437.465009]        entry_SYSCALL_64_after_hwframe+0x6e/0x76
[ 3437.465231]
               -> #0 (sb_writers#10){.+.+}-{0:0}:
[ 3437.465471]        __lock_acquire+0x1455/0x21b0
[ 3437.465656]        lock_acquire+0xc6/0x2b0
[ 3437.465822]        mnt_want_write+0x46/0x1a0
[ 3437.465996]        filename_create+0x62/0x190
[ 3437.466175]        user_path_create+0x2d/0x50
[ 3437.466352]        bch2_fs_file_ioctl+0x2ec/0xc90 [bcachefs]
[ 3437.466617]        __x64_sys_ioctl+0x93/0xd0
[ 3437.466791]        do_syscall_64+0x42/0xf0
[ 3437.466957]        entry_SYSCALL_64_after_hwframe+0x6e/0x76
[ 3437.467180]
               other info that might help us debug this:

[ 3437.469670] 2 locks held by bcachefs/35533:
               other info that might help us debug this:

[ 3437.467507] Chain exists of:
                 sb_writers#10 --> &c->snapshot_create_lock --> &type->s_umount_key#48

[ 3437.467979]  Possible unsafe locking scenario:

[ 3437.468223]        CPU0                    CPU1
[ 3437.468405]        ----                    ----
[ 3437.468585]   rlock(&type->s_umount_key#48);
[ 3437.468758]                                lock(&c->snapshot_create_lock);
[ 3437.469030]                                lock(&type->s_umount_key#48);
[ 3437.469291]   rlock(sb_writers#10);
[ 3437.469434]
                *** DEADLOCK ***

[ 3437.469670] 2 locks held by bcachefs/35533:
[ 3437.469838]  #0: ffffa0a02ce00a88 (&c->snapshot_create_lock){++++}-{3:3}, at: bch2_fs_file_ioctl+0x1e3/0xc90 [bcachefs]
[ 3437.470294]  #1: ffffa0a02b2b10e0 (&type->s_umount_key#48){.+.+}-{3:3}, at: bch2_fs_file_ioctl+0x232/0xc90 [bcachefs]
[ 3437.470744]
               stack backtrace:
[ 3437.470922] CPU: 7 PID: 35533 Comm: bcachefs Kdump: loaded Tainted: G            E      6.7.0-rc7-custom+ #85
[ 3437.471313] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Arch Linux 1.16.3-1-1 04/01/2014
[ 3437.471694] Call Trace:
[ 3437.471795]  <TASK>
[ 3437.471884]  dump_stack_lvl+0x57/0x90
[ 3437.472035]  check_noncircular+0x132/0x150
[ 3437.472202]  __lock_acquire+0x1455/0x21b0
[ 3437.472369]  lock_acquire+0xc6/0x2b0
[ 3437.472518]  ? filename_create+0x62/0x190
[ 3437.472683]  ? lock_is_held_type+0x97/0x110
[ 3437.472856]  mnt_want_write+0x46/0x1a0
[ 3437.473025]  ? filename_create+0x62/0x190
[ 3437.473204]  filename_create+0x62/0x190
[ 3437.473380]  user_path_create+0x2d/0x50
[ 3437.473555]  bch2_fs_file_ioctl+0x2ec/0xc90 [bcachefs]
[ 3437.473819]  ? lock_acquire+0xc6/0x2b0
[ 3437.474002]  ? __fget_files+0x2a/0x190
[ 3437.474195]  ? __fget_files+0xbc/0x190
[ 3437.474380]  ? lock_release+0xc5/0x270
[ 3437.474567]  ? __x64_sys_ioctl+0x93/0xd0
[ 3437.474764]  ? __pfx_bch2_fs_file_ioctl+0x10/0x10 [bcachefs]
[ 3437.475090]  __x64_sys_ioctl+0x93/0xd0
[ 3437.475277]  do_syscall_64+0x42/0xf0
[ 3437.475454]  entry_SYSCALL_64_after_hwframe+0x6e/0x76
[ 3437.475691] RIP: 0033:0x7f2743c313af
======================================================

In __bch2_ioctl_subvolume_create(), we grab s_umount unconditionally
and unlock it at the end of the function. There is a comment
"why do we need this lock?" about the lock coming from
commit 6f8c3e5 ("bcachefs: Snapshot creation, deletion")
The reason is that __bch2_ioctl_subvolume_create() calls
sync_inodes_sb() which enforce locked s_umount to writeback all dirty
nodes before doing snapshot works.

Fix it by read locking s_umount for snapshotting only and unlocking
s_umount after sync_inodes_sb().

Signed-off-by: Su Yue <glass.su@suse.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
koverstreet pushed a commit that referenced this pull request May 13, 2026
======================================================
WARNING: possible circular locking dependency detected
6.10.0-rc2-ktest-00018-gebd1d148b278 #144 Not tainted
------------------------------------------------------
fio/1345 is trying to acquire lock:
ffff88813e200ab8 (&c->snapshot_create_lock){++++}-{3:3}, at: bch2_truncate+0x76/0xf0

but task is already holding lock:
ffff888105a1fa38 (&sb->s_type->i_mutex_key#13){+.+.}-{3:3}, at: do_truncate+0x7b/0xc0

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #2 (&sb->s_type->i_mutex_key#13){+.+.}-{3:3}:
       down_write+0x3d/0xd0
       bch2_write_iter+0x1c0/0x10f0
       vfs_write+0x24a/0x560
       __x64_sys_pwrite64+0x77/0xb0
       x64_sys_call+0x17e5/0x1ab0
       do_syscall_64+0x68/0x130
       entry_SYSCALL_64_after_hwframe+0x4b/0x53

-> #1 (sb_writers#10){.+.+}-{0:0}:
       mnt_want_write+0x4a/0x1d0
       filename_create+0x69/0x1a0
       user_path_create+0x38/0x50
       bch2_fs_file_ioctl+0x315/0xbf0
       __x64_sys_ioctl+0x297/0xaf0
       x64_sys_call+0x10cb/0x1ab0
       do_syscall_64+0x68/0x130
       entry_SYSCALL_64_after_hwframe+0x4b/0x53

-> #0 (&c->snapshot_create_lock){++++}-{3:3}:
       __lock_acquire+0x1445/0x25b0
       lock_acquire+0xbd/0x2b0
       down_read+0x40/0x180
       bch2_truncate+0x76/0xf0
       bchfs_truncate+0x240/0x3f0
       bch2_setattr+0x7b/0xb0
       notify_change+0x322/0x4b0
       do_truncate+0x8b/0xc0
       do_ftruncate+0x110/0x270
       __x64_sys_ftruncate+0x43/0x80
       x64_sys_call+0x1373/0x1ab0
       do_syscall_64+0x68/0x130
       entry_SYSCALL_64_after_hwframe+0x4b/0x53

other info that might help us debug this:

Chain exists of:
  &c->snapshot_create_lock --> sb_writers#10 --> &sb->s_type->i_mutex_key#13

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&sb->s_type->i_mutex_key#13);
                               lock(sb_writers#10);
                               lock(&sb->s_type->i_mutex_key#13);
  rlock(&c->snapshot_create_lock);

 *** DEADLOCK ***

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
koverstreet pushed a commit that referenced this pull request May 13, 2026
Two fixes from the recent logging changes:

bch2_inconsistent(), bch2_fs_inconsistent() be called from interrupt
context, or with rcu_read_lock() held.

The one syzbot found is in
  bch2_bkey_pick_read_device
  bch2_dev_rcu
  bch2_fs_inconsistent

We're starting to switch to lift the printbufs up to higher levels so we
can emit better log messages and print them all in one go (avoid
garbling), so that conversion will help with spotting these in the
future; when we declare a printbuf it must be flagged if we're in an
atomic context.

Secondly, in btree_node_write_endio:

00085 BUG: sleeping function called from invalid context at include/linux/sched/mm.h:321
00085 in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 618, name: bch-reclaim/fa6
00085 preempt_count: 10001, expected: 0
00085 RCU nest depth: 0, expected: 0
00085 4 locks held by bch-reclaim/fa6/618:
00085  #0: ffffff80d7ccad68 (&j->reclaim_lock){+.+.}-{4:4}, at: bch2_journal_reclaim_thread+0x84/0x198
00085  #1: ffffff80d7c84218 (&c->btree_trans_barrier){.+.+}-{0:0}, at: __bch2_trans_get+0x1c0/0x440
00085  #2: ffffff80cd3f8140 (bcachefs_btree){+.+.}-{0:0}, at: __bch2_trans_get+0x22c/0x440
00085  #3: ffffff80c3823c20 (&vblk->vqs[i].lock){-.-.}-{3:3}, at: virtblk_done+0x58/0x130
00085 irq event stamp: 328
00085 hardirqs last  enabled at (327): [<ffffffc080073a14>] finish_task_switch.isra.0+0xbc/0x2a0
00085 hardirqs last disabled at (328): [<ffffffc080971a10>] el1_interrupt+0x20/0x60
00085 softirqs last  enabled at (0): [<ffffffc08002f920>] copy_process+0x7c8/0x2118
00085 softirqs last disabled at (0): [<0000000000000000>] 0x0
00085 Preemption disabled at:
00085 [<ffffffc08003ada0>] irq_enter_rcu+0x18/0x90
00085 CPU: 8 UID: 0 PID: 618 Comm: bch-reclaim/fa6 Not tainted 6.14.0-rc6-ktest-g04630bde23e8 #18798
00085 Hardware name: linux,dummy-virt (DT)
00085 Call trace:
00085  show_stack+0x1c/0x30 (C)
00085  dump_stack_lvl+0x84/0xc0
00085  dump_stack+0x14/0x20
00085  __might_resched+0x180/0x288
00085  __might_sleep+0x4c/0x88
00085  __kmalloc_node_track_caller_noprof+0x34c/0x3e0
00085  krealloc_noprof+0x1a0/0x2d8
00085  bch2_printbuf_make_room+0x9c/0x120
00085  bch2_prt_printf+0x60/0x1b8
00085  btree_node_write_endio+0x1b0/0x2d8
00085  bio_endio+0x138/0x1f0
00085  btree_node_write_endio+0xe8/0x2d8
00085  bio_endio+0x138/0x1f0
00085  blk_update_request+0x220/0x4c0
00085  blk_mq_end_request+0x28/0x148
00085  virtblk_request_done+0x64/0xe8
00085  blk_mq_complete_request+0x34/0x40
00085  virtblk_done+0x78/0x130
00085  vring_interrupt+0x6c/0xb0
00085  __handle_irq_event_percpu+0x8c/0x2e0
00085  handle_irq_event+0x50/0xb0
00085  handle_fasteoi_irq+0xc4/0x250
00085  handle_irq_desc+0x44/0x60
00085  generic_handle_domain_irq+0x20/0x30
00085  gic_handle_irq+0x54/0xc8
00085  call_on_irq_stack+0x24/0x40

Reported-by: syzbot+c82cd2906e2f192410bb@syzkaller.appspotmail.com
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
koverstreet pushed a commit that referenced this pull request May 13, 2026
Kill a harmless lockdep splat:

00478 ======================================================
00478 WARNING: possible circular locking dependency detected
00478 6.17.0-ktest-g062ae2842644 #27906 Not tainted
00478 ------------------------------------------------------
00478 umount/1458 is trying to acquire lock:
00478 ffffff80de30ab10 (&ht->mutex){+.+.}-{4:4}, at: rhashtable_free_and_destroy+0x40/0x378
00478
00478 but task is already holding lock:
00478 ffffff80de30abf8 (&bc->lock){+.+.}-{4:4}, at: bch2_fs_btree_cache_exit+0x74/0x430
00478
00478 which lock already depends on the new lock.
00478
00478
00478 the existing dependency chain (in reverse order) is:
00478
00478 -> #2 (&bc->lock){+.+.}-{4:4}:
00478        lock_acquire+0x1d0/0x368
00478        __mutex_lock+0xa8/0xb70
00478        mutex_lock_nested+0x28/0x40
00478        bch2_btree_cache_scan+0x88/0x640
00478        shrink_slab+0x24c/0x7b0
00478        shrink_node+0x1e8/0x540
00478        balance_pgdat+0x2b0/0x628
00478        kswapd+0x1f8/0x528
00478        kthread+0x140/0x210
00478        ret_from_fork+0x10/0x20
00478
00478 -> #1 (fs_reclaim){+.+.}-{0:0}:
00478        lock_acquire+0x1d0/0x368
00478        fs_reclaim_acquire+0x70/0xa8
00478        __kvmalloc_node_noprof+0xf4/0x500
00478        bucket_table_alloc+0x4c/0x1f0
00478        rhashtable_rehash_alloc+0x38/0xa8
00478        rht_deferred_worker+0xa78/0xb20
00478        process_one_work+0x240/0x690
00478        worker_thread+0x1c4/0x370
00478        kthread+0x140/0x210
00478        ret_from_fork+0x10/0x20
00478
00478 -> #0 (&ht->mutex){+.+.}-{4:4}:
00478        check_prev_add+0x110/0xcb0
00478        __lock_acquire+0x12f0/0x1600
00478        lock_acquire+0x1d0/0x368
00478        __mutex_lock+0xa8/0xb70
00478        mutex_lock_nested+0x28/0x40
00478        rhashtable_free_and_destroy+0x40/0x378
00478        rhashtable_destroy+0x14/0x20
00478        bch2_fs_btree_cache_exit+0x418/0x430
00478        bch2_fs_btree_exit+0x54/0xb0
00478        bch2_fs_release+0x138/0x1f8
00478        kobject_put+0x84/0xf0
00478        bch2_fs_exit+0x108/0x128
00478        bch2_kill_sb+0x24/0x38
00478        deactivate_locked_super+0x54/0xd0
00478        deactivate_super+0x70/0x90
00478        cleanup_mnt+0xf4/0x190
00478        __cleanup_mnt+0x18/0x28
00478        task_work_run+0x8c/0xd8
00478        do_notify_resume+0x148/0x160
00478        el0_svc+0xa4/0xb0
00478        el0t_64_sync_handler+0x98/0xe0
00478        el0t_64_sync+0x154/0x158
00478
00478 other info that might help us debug this:
00478
00478 Chain exists of:
00478   &ht->mutex --> fs_reclaim --> &bc->lock
00478
00478  Possible unsafe locking scenario:
00478
00478        CPU0                    CPU1
00478        ----                    ----
00478   lock(&bc->lock);
00478                                lock(fs_reclaim);
00478                                lock(&bc->lock);
00478   lock(&ht->mutex);
00478
00478  *** DEADLOCK ***
00478
00478 1 lock held by umount/1458:
00478  #0: ffffff80de30abf8 (&bc->lock){+.+.}-{4:4}, at: bch2_fs_btree_cache_exit+0x74/0x430
00478
00478 stack backtrace:
00478 CPU: 13 UID: 0 PID: 1458 Comm: umount Not tainted 6.17.0-ktest-g062ae2842644 #27906 PREEMPT
00478 Hardware name: linux,dummy-virt (DT)
00478 Call trace:
00478  show_stack+0x1c/0x30 (C)
00478  dump_stack_lvl+0x68/0x90
00478  dump_stack+0x14/0x1c
00478  print_circular_bug+0x228/0x270
00478  check_noncircular+0x15c/0x170
00478  check_prev_add+0x110/0xcb0
00478  __lock_acquire+0x12f0/0x1600
00478  lock_acquire+0x1d0/0x368
00478  __mutex_lock+0xa8/0xb70
00478  mutex_lock_nested+0x28/0x40
00478  rhashtable_free_and_destroy+0x40/0x378
00478  rhashtable_destroy+0x14/0x20
00478  bch2_fs_btree_cache_exit+0x418/0x430
00478  bch2_fs_btree_exit+0x54/0xb0
00478  bch2_fs_release+0x138/0x1f8
00478  kobject_put+0x84/0xf0
00478  bch2_fs_exit+0x108/0x128
00478  bch2_kill_sb+0x24/0x38
00478  deactivate_locked_super+0x54/0xd0
00478  deactivate_super+0x70/0x90
00478  cleanup_mnt+0xf4/0x190
00478  __cleanup_mnt+0x18/0x28
00478  task_work_run+0x8c/0xd8
00478  do_notify_resume+0x148/0x160
00478  el0_svc+0xa4/0xb0
00478  el0t_64_sync_handler+0x98/0xe0
00478  el0t_64_sync+0x154/0x158

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
koverstreet pushed a commit that referenced this pull request May 13, 2026
00677 BUG: sleeping function called from invalid context at include/linux/percpu-rwsem.h:51
00677 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 34081, name: xfs_io
00677 preempt_count: 1, expected: 0
00677 RCU nest depth: 1, expected: 0
00677 3 locks held by xfs_io/34081:
00677  #0: ffffff80c34d0a10 (&mm->mmap_lock){++++}-{4:4}, at: exit_mmap+0x68/0x480
00677  #1: ffffffc0811b0eb8 (rcu_read_lock){....}-{1:3}, at: ___pte_offset_map+0x8/0x1a8
00677  #2: ffffff80c3321a98 (ptlock_ptr(ptdesc)){+.+.}-{3:3}, at: __pte_offset_map_lock+0x80/0x160
00677 Preemption disabled at:
00677 [<ffffffc0802457a8>] __pte_offset_map_lock+0x80/0x160
00677 CPU: 3 UID: 0 PID: 34081 Comm: xfs_io Not tainted 6.17.0-ktest-g1051044265e5 #54360 PREEMPT
00677 Hardware name: linux,dummy-virt (DT)
00677 Call trace:
00677  show_stack+0x1c/0x30 (C)
00677  dump_stack_lvl+0x68/0x90
00677  dump_stack+0x14/0x1c
00677  __might_resched+0x170/0x270
00677  __might_sleep+0x4c/0x90
00677  percpu_down_read_internal.constprop.0+0x24/0x148
00677  __bch2_disk_reservation_add+0x5c/0x460
00677  bch2_disk_reservation_add+0xe4/0x198
00677  bch2_vfs_dirty_folio+0x1a0/0x2d0
00677  folio_mark_dirty+0x38/0xa0
00677  unmap_page_range+0xe64/0x1100
00677  unmap_single_vma.isra.0+0x88/0xe8
00677  unmap_vmas+0x68/0x138
00677  exit_mmap+0xb4/0x480
00677  mmput+0x7c/0x180
00677  do_exit+0x23c/0xab8
00677  do_group_exit+0x38/0xa0
00677  get_signal+0xaa4/0xad0
00677  do_signal+0x84/0x250
00677  do_notify_resume+0xf8/0x160
00677  el0_svc+0xa4/0xb0
00677  el0t_64_sync_handler+0x98/0xe0
00677  el0t_64_sync+0x154/0x158

mark_lock dated from when the percpu allocation online_reserved was on
could be resized - it's no longer necessary, and sectors_available_lock
can safely be a spinlock.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
koverstreet pushed a commit that referenced this pull request Jun 9, 2026
00677 BUG: sleeping function called from invalid context at include/linux/percpu-rwsem.h:51
00677 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 34081, name: xfs_io
00677 preempt_count: 1, expected: 0
00677 RCU nest depth: 1, expected: 0
00677 3 locks held by xfs_io/34081:
00677  #0: ffffff80c34d0a10 (&mm->mmap_lock){++++}-{4:4}, at: exit_mmap+0x68/0x480
00677  #1: ffffffc0811b0eb8 (rcu_read_lock){....}-{1:3}, at: ___pte_offset_map+0x8/0x1a8
00677  #2: ffffff80c3321a98 (ptlock_ptr(ptdesc)){+.+.}-{3:3}, at: __pte_offset_map_lock+0x80/0x160
00677 Preemption disabled at:
00677 [<ffffffc0802457a8>] __pte_offset_map_lock+0x80/0x160
00677 CPU: 3 UID: 0 PID: 34081 Comm: xfs_io Not tainted 6.17.0-ktest-g1051044265e5 #54360 PREEMPT
00677 Hardware name: linux,dummy-virt (DT)
00677 Call trace:
00677  show_stack+0x1c/0x30 (C)
00677  dump_stack_lvl+0x68/0x90
00677  dump_stack+0x14/0x1c
00677  __might_resched+0x170/0x270
00677  __might_sleep+0x4c/0x90
00677  percpu_down_read_internal.constprop.0+0x24/0x148
00677  __bch2_disk_reservation_add+0x5c/0x460
00677  bch2_disk_reservation_add+0xe4/0x198
00677  bch2_vfs_dirty_folio+0x1a0/0x2d0
00677  folio_mark_dirty+0x38/0xa0
00677  unmap_page_range+0xe64/0x1100
00677  unmap_single_vma.isra.0+0x88/0xe8
00677  unmap_vmas+0x68/0x138
00677  exit_mmap+0xb4/0x480
00677  mmput+0x7c/0x180
00677  do_exit+0x23c/0xab8
00677  do_group_exit+0x38/0xa0
00677  get_signal+0xaa4/0xad0
00677  do_signal+0x84/0x250
00677  do_notify_resume+0xf8/0x160
00677  el0_svc+0xa4/0xb0
00677  el0t_64_sync_handler+0x98/0xe0
00677  el0t_64_sync+0x154/0x158

mark_lock dated from when the percpu allocation online_reserved was on
could be resized - it's no longer necessary, and sectors_available_lock
can safely be a spinlock.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
koverstreet pushed a commit that referenced this pull request Jun 9, 2026
00677 BUG: sleeping function called from invalid context at include/linux/percpu-rwsem.h:51
00677 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 34081, name: xfs_io
00677 preempt_count: 1, expected: 0
00677 RCU nest depth: 1, expected: 0
00677 3 locks held by xfs_io/34081:
00677  #0: ffffff80c34d0a10 (&mm->mmap_lock){++++}-{4:4}, at: exit_mmap+0x68/0x480
00677  #1: ffffffc0811b0eb8 (rcu_read_lock){....}-{1:3}, at: ___pte_offset_map+0x8/0x1a8
00677  #2: ffffff80c3321a98 (ptlock_ptr(ptdesc)){+.+.}-{3:3}, at: __pte_offset_map_lock+0x80/0x160
00677 Preemption disabled at:
00677 [<ffffffc0802457a8>] __pte_offset_map_lock+0x80/0x160
00677 CPU: 3 UID: 0 PID: 34081 Comm: xfs_io Not tainted 6.17.0-ktest-g1051044265e5 #54360 PREEMPT
00677 Hardware name: linux,dummy-virt (DT)
00677 Call trace:
00677  show_stack+0x1c/0x30 (C)
00677  dump_stack_lvl+0x68/0x90
00677  dump_stack+0x14/0x1c
00677  __might_resched+0x170/0x270
00677  __might_sleep+0x4c/0x90
00677  percpu_down_read_internal.constprop.0+0x24/0x148
00677  __bch2_disk_reservation_add+0x5c/0x460
00677  bch2_disk_reservation_add+0xe4/0x198
00677  bch2_vfs_dirty_folio+0x1a0/0x2d0
00677  folio_mark_dirty+0x38/0xa0
00677  unmap_page_range+0xe64/0x1100
00677  unmap_single_vma.isra.0+0x88/0xe8
00677  unmap_vmas+0x68/0x138
00677  exit_mmap+0xb4/0x480
00677  mmput+0x7c/0x180
00677  do_exit+0x23c/0xab8
00677  do_group_exit+0x38/0xa0
00677  get_signal+0xaa4/0xad0
00677  do_signal+0x84/0x250
00677  do_notify_resume+0xf8/0x160
00677  el0_svc+0xa4/0xb0
00677  el0t_64_sync_handler+0x98/0xe0
00677  el0t_64_sync+0x154/0x158

mark_lock dated from when the percpu allocation online_reserved was on
could be resized - it's no longer necessary, and sectors_available_lock
can safely be a spinlock.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants