Re: debugfs and module unloading

2014-05-22 Thread Dave Martin
On Wed, May 21, 2014 at 11:01:14PM +0100, Greg Kroah-Hartman wrote: > On Wed, May 21, 2014 at 05:48:28PM +0100, Dave P Martin wrote: > > Hi there, > > > > I have a quick debugfs question: > > > > How can I protect against a module being unloaded while debugfs files it > > provides are open? > >

Re: debugfs and module unloading

2014-05-21 Thread Greg Kroah-Hartman
On Wed, May 21, 2014 at 05:48:28PM +0100, Dave P Martin wrote: > Hi there, > > I have a quick debugfs question: > > How can I protect against a module being unloaded while debugfs files it > provides are open? > > I can do something like the following: > > static int my_debugfs_file_open(struct

debugfs and module unloading

2014-05-21 Thread Dave P Martin
Hi there, I have a quick debugfs question: How can I protect against a module being unloaded while debugfs files it provides are open? I can do something like the following: static int my_debugfs_file_open(struct inode *, struct file *) { if (!try_module_get()) return -E