2006-03-31 16:10:25

by Jan Kiszka

[permalink] [raw]
Subject: safe usage of remove_proc_entry and proc_entry->data

Hi,

I just wondered (after using this for years...) what the safe usage of
remove_proc_entry() is when I've registered a dynamic data object with
the proc-entry during creation. I'm creating and deleting proc entries
dynamically, not on module insertion/removal.

What is the clean way to synchronise e.g. an ongoing proc read request
on that entry and its access to the embedded data object vs. the
deregistration and later release of the data object?
remove_proc_entry() is non-blocking and does unfortunately not return
any error in case the deletion is deferred.

In the procfs-guide, I read that I should "free the data entry from
the struct proc_dir_entry *before* [calling] remove_proc_entry()".
Doesn't parse for me so far (how should this help?), and I failed to
find a pattern for this in existing kernel code. Any hints welcome!

Thanks in advance,
Jan