This might not be the solution which solves your problem, but based on the limited information from your question and the comments, this what I could gather.
Based on the question and the comments, it looks like you have defined a struct file_operations
structure in this fashion:
struct file_operations fops = { .ioctl=ospfs_ioctl };
And the signature of your ospfs_ioctl
suggests that you're using the older ioctl.
With the recent kernels (at least after 2.6.35+ or something), 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 would change to:
long ospfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
The differences between unlocked_ioctl
and the regular ioctl can be found here. In short it does not take the dreaded BKL
before invoking the ioctl.
And also as per Chris Dodd
's suggestion, you should double check how you're defining your OSPFIOCRASH
. The recommended way is to make use of the _IO(magic, some_num_for_ioctl)