Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.development.system > #577
| From | Lew Pitcher <lew.pitcher@digitalfreehold.ca> |
|---|---|
| Subject | Re: rmmod with a kernel delayed work running in the loadable kernel module |
| Newsgroups | comp.os.linux.development.system |
| References | <79e9876e-cd2c-42aa-8f43-47d5dfb77a20@googlegroups.com> |
| Organization | The Pitcher Digital Freehold |
| Message-ID | <RTghu.208966$QZ6.1832@fx15.iad> (permalink) |
| Date | 2013-11-14 22:52 -0500 |
On Thursday 14 November 2013 21:56, in comp.os.linux.development.system, "Shankar Vaideeswaran" <sankaranarayanan.vaideeswaran@gmail.com> wrote: > Hi, > > I am kind of a beginner in Linux kernel and I am facing the following > problem: > > I have a kernel module, that has a delayed work initialized to log some > things to a file periodically. I am using filp_open, vfs_write to do so. > > When i want to unload the module, its not allowing the operation as > expected because i have the file pointer open. > > are there any callbacks/commands, that will tell the kernel module to > close such a reference and rmmod the module? I believe that the proper "callback" is the cleanup_module() function you export from your module. According to the documentation, the kernel will call this function when it wants to deactivate your module. As for writing to files from within your module, the consensus is "Don't do that!". There are other, better ways to externalize module data. Use them. If you require media-copy storage of your externalized data, you should write a companion user-space daemon to capture the data. The kernel module, I'm told, should only externalize data on demand from user-space programs. The module may do this, for instance, by servicing a device read(2) call issued from user-space, or by providing the data through an appropriate /sys or /proc filesystem, both of which there are standard kernel interfaces for. If you find that you cannot properly handle the "file close" functions through the cleanup_module() callback, you probably should move your data output to one of the (above) supported methods. HTH -- Lew Pitcher "In Skills, We Trust" PGP public key available upon request
Back to comp.os.linux.development.system | Previous | Next — Previous in thread | Find similar
rmmod with a kernel delayed work running in the loadable kernel module Shankar Vaideeswaran <sankaranarayanan.vaideeswaran@gmail.com> - 2013-11-14 18:56 -0800 Re: rmmod with a kernel delayed work running in the loadable kernel module Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2013-11-14 22:52 -0500
csiph-web