Date: Tue, 22 May 2007 18:45:00 +1000 From: Lawrence Stewart <lstewart@room52.net> To: =?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= <des@des.no> Cc: freebsd-hackers@freebsd.org Subject: Re: Writing a plain text file to disk from kernel space Message-ID: <4652AD8C.7000605@room52.net> In-Reply-To: <86sl9qtpd1.fsf@dwp.des.no> References: <4649349D.4060101@room52.net> <200705150847.38838.marc.loerner@hob.de> <46499491.2010205@room52.net> <f2j5hf$hap$2@sea.gmane.org> <46515DE0.20209@room52.net> <86sl9qtpd1.fsf@dwp.des.no>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------050508090406060108000201 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit OK well that's cleared up. Thanks DES. So I went back to trying the kernio code I found here (http://people.freebsd.org/~pjd/misc/kernio/) which does operate directly on vnodes (first time I tried it I was getting kernel panics, so I assumed the code was a bit dated and carried on down the path of trying to get file descriptors working). Anyways, I modified the filewriter kernel module that I attached to my previous post so that it used the kio code, and verified that the code does work when called across different threads (in the module's init and deinit functions). However, when I ported it into my other module that I'm actually working on that uses the pfil hooks, I started getting hard resets again. After further investigation, it turns out that the pfil input hook I'm using, which catches packets as they traverse up the network stack, has no problems, and will happily write to the file using the kio_write function. However, in the pfil output hook, a call to kio_write causes a hard reset, with the following text shown on tty0: Sleeping thread (tid 100069, pid 613) owns a non-sleepable lock panic: sleeping thread If I comment out the kio_write code and put a printf instead, there are no such problems, so it seems the kio_write function is doing something that is upsetting the kernel, but only when called from a function that is acting as a pfil output hook? Strikes me as odd behaviour. I don't understand which thread the error is in relation to, why that thread is sleeping or which lock it is referring to. I tried wrapping the call to kio_write in a mutex, in case there was a race condition caused by multiple threads trying to write to the file at the one time, but that hasn't made a difference at all. I've attached the code that demonstrates the problem, but be warned: I've intentionally left it in a state that demonstrates the problem, and it will therefore hard reset any machine you run it on. Any thoughts on what's going on and how I can make the kio code not break the kernel when called from within a function that is acting as a pfil output hook? Cheers, Lawrence Dag-Erling Smørgrav wrote: > Lawrence Stewart <lstewart@room52.net> writes: > >> I suspect that you can't use a file descriptor that was opened in one >> thread in a completely different thread, but I'm not sure if this is >> true, and if it is true, how to get around it. >> > > A file descriptor is an index into a file table. Different threads have > different file tables. > > If you want to read from or write to files within the kernel, you need > to operate directly on vnodes, not on file descriptors. > > DES > --------------050508090406060108000201 Content-Type: application/octet-stream; name="filewriter.ko" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="filewriter.ko" f0VMRgEBAQkAAAAAAAAAAAMAAwABAAAAyAgAADQAAADEDgAAAAAAADQAIAADACgAEQAOAAEA AAAAAAAAAAAAAAAAAAAUDQAAFA0AAAUAAAAAEAAAAQAAABQNAAAUHQAAFB0AALAAAAAQAQAA BgAAAAAQAAACAAAAQA0AAEAdAABAHQAAeAAAAHgAAAAGAAAABAAAACUAAAAuAAAAAAAAAAAA AAAcAAAAHgAAAAAAAAAkAAAAGwAAABAAAAAtAAAAAAAAAB8AAAAAAAAAAAAAACkAAAAAAAAA IgAAABgAAAAAAAAAJgAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAABkAAAAjAAAAAAAAACsA AAAAAAAAAAAAACwAAAAqAAAAEgAAACEAAAAnAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAFQAAABcAAAAAAAAAFgAAAAAAAAAUAAAAAAAAAB0AAAAAAAAA AAAAAAAAAAATAAAAAAAAAAAAAAAOAAAAAAAAACAAAAAlAAAADwAAABoAAAAAAAAAKAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAJQAAAAAAAAAAwABAAAAAADoAQAAAAAAAAMAAgAAAAAA yAQAAAAAAAADAAMAAAAAAJgGAAAAAAAAAwAEAAAAAADICAAAAAAAAAMABQAAA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AAAIYAACGCwAAAhgAAJsLAAACLQAAqgsAAAIt AAAADAAAAhUAADMMAAACFAAAcwwAAAISAAAcHQAAARcAAFWJ5VdWU4PsYGSLPQAAAACLB4tQ JItaDIXbdQqhAAAAAIlCDIsHi1Aki0oIhcl1CKEAAAAAiUIIi0UIav//RQyJRaTHRcwAAAAA x0XQAAAAAMdFqAEAAACJfdT/t4gAAAD/dRCNRQxQjXWkVuj8////at+Jw1bo/P///4PEHDHA hdt1KItVuI1FlIlVmFDHRZQAAAAAx0WcAAAAAIl9oP9yCOj8////WFqLRbiNZfRbXl/Jw1WJ 5WShAAAAAFD/sIgAAABqAv91COj8////ycNVieVXVlOD7HyLXRBkiz0AAAAAagiNtXz///9W 6Pz///9qII1F1FDo/P///4tFDGoBiYV8////jYV4////UP91CIldgIl11Ild5Il98MdF3AAA AADHReAAAAAAx0XoAQAAAMdF7AEAAADHRdgBAAAA6Pz///9XaAIQAAD/dQjo/P///4uHiAAA AItVCIPEKIlFwI1FtIlVuIl9vMdFtAAAAADHRcQCAAAAUP9yCOj8////i4eIAAAAWYtVCFuJ VZiJRaSNVdSNRZSJVZxQx0WUAAAAAMdFoIMAAACLRQj/cAjo/P///1hajUWEi1UIiVWIiX2Q x0WEAAAAAMdFjAAAAABQ/3II6Pz///9eX/+1eP///+j8////jWX0W14xwF/Jw5CQVYnlai5o oQwAAGoAaAAeAADo/P///2oKaK4MAAD/NeQdAADotP7//2owaKEMAABqAGgAHgAA6Pz///8x wMnDkFWJ5Wo6aKEMAABqAGgAHgAA6Pz///9qC2i5DAAA/zXkHQAA6HT+//9qPGihDAAAagBo AB4AAOj8////McDJw5BVieVWU2oCagGJxuj8////icOF21hauAMAAAB0CYX2dA9OdDAxwI1l +FteycONdgBTagVqAGi8CgAA6Pz///9TagZqAGj8CgAA6Pz///+DxCDr0ZBTagVqAGi8CgAA 6Pz///9TagZqAGj8CgAA6Pz///+DxCDrrZBVieWLRQyFwHQKSHR/uBYAAADJw6HgHQAAMdKF wHQ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------------050508090406060108000201 Content-Type: text/plain; name="kernio.h" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="kernio.h" LyotCiAqIENvcHlyaWdodCAoYykgMjAwNiBQYXdlbCBKYWt1YiBEYXdpZGVrIDxwLmRhd2lk ZWtAd2hlZWwucGw+CiAqIEFsbCByaWdodHMgcmVzZXJ2ZWQuCiAqCiAqIERvd25sb2FkZWQg ZnJvbSBodHRwOi8vcGVvcGxlLmZyZWVic2Qub3JnL35wamQvbWlzYy9rZXJuaW8vCiAqLwoK I2lmbmRlZiBfU1lTX0tFUk5JT19IXwojZGVmaW5lCV9TWVNfS0VSTklPX0hfCgpzdHJ1Y3Qg dm5vZGUgKmtpb19vcGVuKGNvbnN0IGNoYXIgKmZpbGUsIGludCBmbGFncywgaW50IGNtb2Rl KTsKdm9pZCBraW9fY2xvc2Uoc3RydWN0IHZub2RlICp2cCk7CmludCBraW9fd3JpdGUoc3Ry dWN0IHZub2RlICp2cCwgdm9pZCAqYnVmLCBzaXplX3Qgc2l6ZSk7CgojZW5kaWYJLyogX1NZ U19LRVJOSU9fSF8gKi8K --------------050508090406060108000201 Content-Type: text/plain; name="Makefile" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="Makefile" U1JDUz12bm9kZV9pZi5oIHN1YnJfa2VybmlvLmMgZmlsZXdyaXRlci5jCktNT0Q9ZmlsZXdy aXRlcgoKLmluY2x1ZGUgPGJzZC5rbW9kLm1rPiAKCgo= --------------050508090406060108000201 Content-Type: text/plain; name="subr_kernio.c" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="subr_kernio.c" LyotCiAqIENvcHlyaWdodCAoYykgMjAwNiBQYXdlbCBKYWt1YiBEYXdpZGVrIDxwLmRhd2lk ZWtAd2hlZWwucGw+CiAqIEFsbCByaWdodHMgcmVzZXJ2ZWQuCiAqCiAqIERvd25sb2FkZWQg ZnJvbSBodHRwOi8vcGVvcGxlLmZyZWVic2Qub3JnL35wamQvbWlzYy9rZXJuaW8vCiAqL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SVZFIHwgTEtfUkVUUlksIHRkKTsKCVZPUF9MRUFTRSh2cCwgdGQsIHRk LT50ZF91Y3JlZCwgTEVBU0VfV1JJVEUpOwogIC8vIFRPRE86IElkZWFsbHksIHRoZSBmbGFn cyBwYXNzZWQgaW50byBWT1BfV1JJVEUgb24gdGhlIG5leHQgbGluZSBzaG91bGRuJ3QKICAv LyAgICAgICBiZSBoYXJkY29kZWQuIElzIHRoZXJlIGEgd2F5IHRvIGNhbGN1bGF0ZSB0aGVt IGJhc2VkIG9uIHRoZSBmbGFncwogIC8vICAgICAgIHBhc3NlZCBpbnRvIGtpb19vcGVuPwoJ Vk9QX1dSSVRFKHZwLCAmYXVpbywgSU9fVU5JVCB8IElPX1NZTkMgfCBJT19BUFBFTkQsIHRk LT50ZF91Y3JlZCk7CglWT1BfVU5MT0NLKHZwLCAwLCB0ZCk7Cgl2bl9maW5pc2hlZF93cml0 ZShtcCk7CglyZXR1cm4gKDApOwp9Cg== --------------050508090406060108000201--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4652AD8C.7000605>