Re: watchdog infrastructure

From: Arnd Bergmann
Date: Mon Jul 12 2004 - 07:22:47 EST


On Montag, 12. Juli 2004 10:23, viro@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx wrote:
> On Mon, Jul 12, 2004 at 10:19:39AM +0200, Wim Van Sebroeck wrote:
> > > - You need to get the module reference count before calling any
> > >   watchdog operation, the best place for this is probably the
> > >   open() fop.
>
> Huh?  Just set ->owner in file_operations and be done with that.
>
Yes, that would work. However, I don't feel comfortable with setting
fops->owner to anything else than THIS_MODULE. In particular, this
causes problems when multiple watchdog drivers register with the
watchdog base module.

The sequence I had in mind was:

chrdev_open()
try_module_get(fops->owner)
watchdog_open()
try_module_get(wdops->owner)
wdops->start()


vfs_write
watchdog_write()
wdops->keepalive()

...

fput()
watchdog_release()
wdops->stop()
module_put(wdops->owner)
module_put(fops->owner)

This would practically do the same for the watchdog layer that we already
do for inside vfs for the file_operations.

Arnd <><

Attachment: pgp00000.pgp
Description: signature