On Wed, 2023-11-08 at 12:04 -0800, Ben Greear wrote: > On 11/8/23 10:43, Johannes Berg wrote: > > On Wed, 2023-11-08 at 09:44 -0800, Ben Greear wrote: > > > > > > This method appears to actually set a S_DEAD flag in the dentry, > > > > > > > A *dir* entry. > > > > > so maybe > > > we just check that flag in the mutex_trylock failed to acquire path > > > in the debugfs read? > > > > > > void simple_recursive_removal(struct dentry *dentry, > > > void (*callback)(struct dentry *)) > > > { > > > struct dentry *this = dget(dentry); > > > while (true) { > > > struct dentry *victim = NULL, *child; > > > struct inode *inode = this->d_inode; > > > > > > inode_lock(inode); > > > if (d_is_dir(this)) > > > inode->i_flags |= S_DEAD; > > > > > > > But even if you did that, I'm not sure what you'd do? trylock and sleep, > > and abort if you find it's being removed? That all sounds super awkward. > > Here is my compile-only tested approach. It only tries to fix one particular > locking case in debugfs, so I'm sure it is not yet complete. I believe I > need to add that new flag in the fs.h, as S_DEAD is only for directories, > if I understand the code properly. [snip code] Sure, it's just software. You can do whatever you want with it. But ... there's no way anything even similar to this will ever go upstream. johannes