lkml.org 
[lkml]   [2006]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectProblem Simulating REMOVAL Media
Date
From

Dear Linux Kernel Govers,

Here I am making an attempt to simulate the Removable media in a Simple
block driver module.
It results in a segmentation fault raising the kernel module count to 1
which makes me to reboot it.

I am doing the following when trying to simulate the Removable media:

/******* Simple block Driver request ********/
static void sbd_request(request_queue_t *q)
{
struct request *req;
int status;

while ((req = elv_next_request(q)) != NULL) {
if (! blk_fs_request(req)) {
printk (KERN_NOTICE "Skip non-CMD request\n");
end_request(req, 0);
continue;
}

/* Simple memcpy based on the request ;
Returns success or failure which is passed to end_that_request_first()
*/
status = sbd_transfer(&Device, req->sector,
req->current_nr_sectors,
req->buffer, rq_data_dir(req));

// end_request(req, 1);
if(!end_that_request_first(req, status, req->current_nr_sectors))
{
blkdev_dequeue_request(req);
end_that_request_last(req);
}
}

I issue an IOCTL from the application after the module is loaded and
memory device is mounted.
The IOCTL code executed is as follows:

/* Simulate the Removal Media Disk */
Case REMOVE_MOUNTED_DISK:
if(Device.bdev)
invalidate_bdev(Device.bdev,1);
del_gendisk(Device.gd);
put_disk(Device.gd);
blk_cleanup_queue(Queue);
vfree(Device.data);
return 0;

After this, I get a segmentation fault either when I issue a
#ls /mnt
OR
When I try to unload the driver module?

Result is module cannot be unloaded, and some times it hangs the console
terminal.

Regards,
Mukund Jampala


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-04-25 09:38    [W:0.029 / U:0.496 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site