On Tue, Apr 1, 2025 at 2:17 PM Mateusz Guzik <mjguzik@xxxxxxxxx> wrote: > > On Tue, Apr 1, 2025 at 1:14 PM Alexey Dobriyan <adobriyan@xxxxxxxxx> wrote: > > > > > +void proc_make_permanent(struct proc_dir_entry *de) > > > +{ > > > + pde_make_permanent(de); > > > +} > > > +EXPORT_SYMBOL(proc_make_permanent); > > > > no, no, no, no > > > > this is wrong! > > > > marking should be done in the context of a module! > > > > the reason it is not exported is because the aren't safeguards against > > module misuse > > > > the flag is supposed to be used in case where > > a) PDE itself is never removed and, > > b) all the code supporting is never removed, > > so that locking can be skipped > > > > this it fine to mark /proc/filesystems because kernel controls it > > > > this is fine to mark /proc/aaa if all module does is to write some > > info to it and deletes it during rmmod > > > > but it is not fine to mark /proc/aaa/bbb if "bbb" is created/deleted > > while module is running, > > locking _must_ be done in this case > > Well I'm unhappy to begin with unhappy with the API :) > but did not want to do anything > churn-inducing. The above looks like a minimal solution to me. > > The pde_ marking things are in an internal header and I did not want > to move them around. > > If anything I'm surprised there is no mechanism to get this done (I > assumed there would be a passable flags argument, but got nothing). > > What I need here is that /proc/filesystems thing sorted out, as in this call: > > proc_create_single("filesystems", 0, NULL, filesystems_proc_show); > > Would you be ok with adding proc_create_single_permanent() which hides > the logic and is not exported to modules? > This still does not add a 'flags' argument, but given limited number of consumers perhaps it is fine? I'm not going to push for any specific solution as long as /proc/filesystems gets to shed the overhead. If you don't like the idea of proc_create_single_permanent(), then perhaps it would be least back-and-forth inducing if you did whatever change which you think is fine and then I just use it? There is absolutely no rush. -- Mateusz Guzik <mjguzik gmail.com>