Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1298757
| From | Greg Kroah-Hartman <greg@kroah.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: debugfs_remove_recursive() while a file is in use by userspace |
| Date | 2015-12-28 22:20 +0100 |
| Message-ID | <qKNmW-7GX-11@gated-at.bofh.it> (permalink) |
| References | <qKMAy-78z-7@gated-at.bofh.it> <qKMKe-7cQ-17@gated-at.bofh.it> <qKN3A-7k0-3@gated-at.bofh.it> <qKN3A-7k0-7@gated-at.bofh.it> <qKNmW-7GX-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Dec 28, 2015 at 01:11:53PM -0800, Rajat Jain wrote: > On Mon, Dec 28, 2015 at 12:58 PM, Greg Kroah-Hartman <greg@kroah.com> wrote: > > On Mon, Dec 28, 2015 at 12:51:32PM -0800, Rajat Jain wrote: > >> Thanks Greg and Al for the quick turnaround. > >> > >> Essentially I have a device that supports something called "contexts" > >> that can be "created" and "destroyed" during the life of the device. I > >> want to expose some debug files for the context when it is created, > >> and destroy the files when the context is destroyed. However, I'm not > >> sure how do I ensure that the user is not in the middle of reading / > >> writing / mmaping to those files. Also how do I know that user is > >> still not holding a reference to the file structure. > > > > You don't. > > > >> It seems like debugfs is currently not a good choice for this? Would > >> you recommend me to any other fs or subsystem that I should use for > >> this? > > > > What exactly do you need to export to userspace and for what purpose? > > For debugging-only stuff, sure, use debugfs, but don't rely on it for > > any "real" tools, only your own debugging. > > I'm actually writing a driver that would expose a "dummy device" to a > real driver. The dummy driver relies on user space to feed in the > device attributes (no of supported contexts etc). That sounds "odd". Why not configfs? > I am now thinking that a character device interface to user space may > actually be a better choice. Not really, you would now have to parse things in a character driver write() callback, not very good or robust. > Question: Does cdev_del() ensure that all references to the file are > dropped before it returns? No, but when the reference is dropped, everything cleans up properly. thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
debugfs_remove_recursive() while a file is in use by userspace Rajat Jain <rajatxjain@gmail.com> - 2015-12-28 21:30 +0100
Re: debugfs_remove_recursive() while a file is in use by userspace Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-28 21:40 +0100
Re: debugfs_remove_recursive() while a file is in use by userspace Greg Kroah-Hartman <greg@kroah.com> - 2015-12-28 21:40 +0100
Re: debugfs_remove_recursive() while a file is in use by userspace Greg Kroah-Hartman <greg@kroah.com> - 2015-12-28 22:00 +0100
Re: debugfs_remove_recursive() while a file is in use by userspace Greg Kroah-Hartman <greg@kroah.com> - 2015-12-28 22:20 +0100
Re: debugfs_remove_recursive() while a file is in use by userspace Rajat Jain <rajatxjain@gmail.com> - 2015-12-28 22:20 +0100
Re: debugfs_remove_recursive() while a file is in use by userspace Rajat Jain <rajatxjain@gmail.com> - 2015-12-28 22:00 +0100
Re: debugfs_remove_recursive() while a file is in use by userspace Nicolai Stange <nicstange@gmail.com> - 2015-12-28 21:50 +0100
Re: debugfs_remove_recursive() while a file is in use by userspace Rajat Jain <rajatxjain@gmail.com> - 2015-12-28 22:00 +0100
csiph-web