It may not be a solution that solves your problem, but based on limited information from your question and comments, this is what I could collect.
Based on the question and comments, it looks like you defined the struct file_operations structure like this:
struct file_operations fops = { .ioctl=ospfs_ioctl };
And the signature of your ospfs_ioctl suggests that you are using an older ioctl.
With the latest kernels (at least after 2.6.35+ or something else) it is recommended to use .unlocked_ioctl instead of .ioctl .
struct file_operations fops = { .unlocked_ioctl=ospfs_ioctl };
And the definition of the ospfs_ioctl function ospfs_ioctl change to:
long ospfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
The differences between unlocked_ioctl and regular ioctl can be found here here . In short, it does not accept the dreaded BKL before invoking ioctl.
And also at the suggestion of Chris Dodd you should double check how you define your OSPFIOCRASH . The recommended way is to use _IO(magic, some_num_for_ioctl)
source share