Block driver

This is a discussion about Block driver in the Everything Linux category; 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 , . Last reply 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 in our website and join the conversation

You already have an account on our website? To log in, use the link provided below.
Login
Create a new user account. Registration is free and takes only a few seconds.
Register
This subject has been archived. New comments and votes cannot be submitted.
Jun 6
Created
Jun 6
Last Response
0
Likes
1 minute
Read Time
User
Users