Date: Mon, 27 Aug 2001 15:31:54 +0400 (MSD) From: "Eugene L. Vorokov" <vel@bugz.infotecs.ru> To: dima@unixfreak.org (Dima Dorfman) Cc: freebsd-hackers@freebsd.org Subject: Re: problem with unloading device driver Message-ID: <200108271131.f7RBVs902785@bugz.infotecs.ru> In-Reply-To: <20010827111601.BA49D3E2F@bazooka.unixfreak.org> from "Dima Dorfman" at Aug 27, 2001 04:15:56 AM
next in thread | previous in thread | raw e-mail | index | archive | help
> > Hello, > > > > I have a module which adds new device. It does make_dev() and then simulates > > mknod() syscall, so that /dev/name is always automatically created. > > Also I have a daemon which reads from and writes to this device. The daemon > > opens the device once and then holds it open. When my module unloads, > > it simulates unlink() and then does detsroy_dev(). I just noticed that > > when I unload my module, the first write() by daemon to the fd associated with > > that device causes system to crash. Trace looks like this: > > You're unloading your module while something still has an fd > associated with a device it provides? How do you expect that to work? > The right thing to do would be to keep track of how many times your > device has been opened, and fail to unload (return an error from the > modevent handler) if something still has it open. Oh yes ... but I thought kernel should know that I unloaded the driver and close associated fd's, returning some error code when a program still tries to operate on them. Anyway, I now return EBUSY, and it works fine. Thanks ! Regards, Eugene To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200108271131.f7RBVs902785>