Re: [RFC] simple_recursive_removal()

From: Greg KH
Date: Sat Nov 16 2019 - 07:04:23 EST


On Fri, Nov 15, 2019 at 10:10:37PM +0000, Al Viro wrote:
> On Fri, Nov 15, 2019 at 04:26:09PM -0500, Steven Rostedt wrote:
> > On Fri, 15 Nov 2019 21:18:20 +0000
> > Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
> >
> > > OK... debugfs and tracefs definitely convert to that; so do, AFAICS,
> > > spufs and selinuxfs, and I wouldn't be surprised if it could be
> > > used in a few more places... securityfs, almost certainly qibfs,
> > > gadgetfs looks like it could make use of that. Maybe subrpc
> > > as well, but I'll need to look in details. configfs won't,
> > > unfortunately...
> >
> > Thanks Al for looking into this.
> >
> > I'll try to test it in tracefs, and see if anything breaks. But
> > probably wont get to it till next week.
>
> I'll probably throw that into #next.dcache - if nothing else,
> that cuts down on the size of patch converting d_subdirs/d_child
> from list to hlist...
>
> Need to get some sleep first, though - only 5 hours today, so
> I want to take another look at that thing tomorrow morning -
> I don't trust my ability to spot obvious bugs right now... ;-/
>
> Oh, well - that at least might finally push the old "kernel-side
> rm -rf done right" pile of half-baked patches into more useful
> state, probably superseding most of them.

Thanks for doing this. Sorry for the delay in getting back to this, was
on a long-haul flight...

Anyway, this looks sane to me. debugfs "should" not be having a file
added while a directory is being removed at the same time, but I really
can't guarantee that someone is trying to do something crazy like that.
So "heavy" locking is fine with me, this never has to be a "fast"
operation, it's much more important to get it "correct".

thanks,

greg k-h