Block driver

Hi i am building a block driver. It is supposed to emulate the physical driver by using a file. Furthermore , the writing takes place inside a kernel thread. I have a vdisk_request function where i do blkdev_dequeue_request(req); and then put the requests in a queue The kernel thread than takes requests from the qu ...

Everything Linux 1798 This topic was started by ,


data/avatar/default/avatar30.webp

32 Posts
Location -
Joined 2004-10-13
Hi
 
i am building a block driver.It is supposed to emulate the physical driver by using a file.Furthermore , the writing takes
place inside a kernel thread.
 
I have a vdisk_request function where i do
blkdev_dequeue_request(req);
and then put the requests in a queue
The kernel thread than takes requests from the queue and
writes the info to the file.After the writing i do
end_that_request_last(req);
 
 
When i call this function i get a
kernel BUG at drivers/ll_rw_blk.c:2167
invalid operand:0000[#1]
 
 
At line 2167 i find
BUG_ON(!list_empty(&req->queuelist));
in the __blk_put_request function.
 
 
I understand that we need to obtain a lock to do any change on the request queue.I have a lock in my disk structure
but if i try spin_unlock(&dev->lock) or spin_lock(&dev->lock)
the program just ignores the call ( which is correct behavior on a single processor system)
 
 
Any idea what the problem could be?
thanks

Participate on our website and join the conversation

You have already an account on our website? Use the link below to login.
Login
Create a new user account. Registration is free and takes only a few seconds.
Register
This topic is archived. New comments cannot be posted and votes cannot be cast.