Bjorn, FYI. This lockdep warning disappeared with kernel version v6.1. I bisected and found the commit 2d7f9f8c1815 ("kernfs: Improve kernfs_drain() and always call on removal.") avoided the issue. This commit touches kernfs_drain() and __kernfs_remove(), and modifies the condition to lock kernfs_rwsem. I think it explains why the lockdep disappeared. No longer need to work on this issue :) -- Shin'ichiro Kawasaki