I try to create a Linux kernel module that filters SCSI requests. The idea is very simple: I enumerate all Scsi_hosts by calling the function scsi_host_lookup()
and modify the corresponding pointers
host->hostt->queuecommand.
This hooking works.
However, I need to do some complicated work during the dispatching scsi requests. I can't do it immediately in my hook function since it is called in the context that doesn't support interrupts.
I've already tried the following approach: I created a work queue, and in my hook function I put scsi requests into this queue and then returned zero. In the work queue functions I called original host->hostt->queuecommand
functions. The system didn't crash but it was stuck. I think that it resulted because I returned constantly zeros in my hook function.
Could you help me with it?