Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Christian Borntraeger <borntraeger@linux.ibm.com>,
	Chris Mason <clm@fb.com>, David Sterba <dsterba@suse.com>,
	Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: Lockdep circular dependency: btrfs_swap_activate() calls sysfs_notify()
Date: Mon, 3 Aug 2026 19:14:30 +0930	[thread overview]
Message-ID: <d98fc5c9-c107-4e67-a145-eca566b10e83@gmx.com> (raw)
In-Reply-To: <bb5e1ba4-5062-4a92-a9ee-1ca0a0dcc992@linux.ibm.com>



在 2026/8/3 18:37, Christian Borntraeger 写道:
> 
> 
> Am 31.07.26 um 13:14 schrieb Christian Borntraeger:
>>
>>
>> Am 31.07.26 um 13:12 schrieb Qu Wenruo:
>>>
>>>
>>> 在 2026/7/31 20:27, Christian Borntraeger 写道:
>>>> One or more of the following files ( btrfs-swapon-kernfs-repro.sh ) 
>>>> violates IBM policy and all attachment(s) have been removed from the 
>>>> message.
>>
>> Oh.
>>
>>
>> Lets try this:
>> #!/bin/bash
>> # Reproducer for the lockdep circular dependency
>> #
> Can you reproduce the lockdep message?
> 

Sorry, I am on vacation since the last reply, until Wednesday.

However the script seems to have several minor problems that got 
rejected by my VM:

- EOF not matching
   The involved python scripts expects "EOF" without any other prefix,
   but the script is using "\tEOF", which failed to end the file.

   My bash version is 5.3.3, not sure if this is version specific.

- Bad indent rejected by python3
   The python version is 3.13.7, which rejects any weird indent, so
   it fails like:

     File "<stdin>", line 1
       import mmap, os, sys
   IndentationError: unexpected indent

Even with all those minor problems fixed, it still didn't trigger on my VM.

I tried 128 runs, the script is triggered for a newly created btrfs in a 
loop, no lockdep warning triggered, all the same successful runs:

[repro] kernel 7.2.0-rc5-custom+, lockdep active
[repro] using existing btrfs at /mnt/btrfs/
[repro] dirtying a btrfs file mapping (mmap_lock -> sb_pagefaults -> 
i_mmap_lock)
[repro] reading sysfs directories (kernfs_rwsem -> mmap_lock)
[repro] creating swap file /mnt/btrfs//lockdep-swapfile
[repro] swapon -- this is the call that closes the cycle
[repro] swapon succeeded
[repro] no lockdep splat
[repro] PASS: the i_mmap_lock -> kernfs_rwsem edge was not taken
[repro] (expected on a kernel carrying btrfs-swapon-kernfs-fix.patch)
[repro] swapoff /mnt/btrfs//lockdep-swapfile

The kernel has LOCKDEP and DEBUG_ATOMIC_SLEEP set.

Although this is on a newer branch, based on btrfs' for-next.

Thus not sure if there is anything new, or if it's really too timing 
specific.

You may want to send out your fix for extra reviews, other developers 
may provide extra review on the fix.

Thanks,
Qu

      reply	other threads:[~2026-08-03  9:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31 10:57 Lockdep circular dependency: btrfs_swap_activate() calls sysfs_notify() Christian Borntraeger
2026-07-31 11:12 ` Qu Wenruo
2026-07-31 11:14   ` Christian Borntraeger
2026-08-03  9:07     ` Christian Borntraeger
2026-08-03  9:44       ` Qu Wenruo [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=d98fc5c9-c107-4e67-a145-eca566b10e83@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wqu@suse.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