I write a custom block driver in the Linux kernel and in my make_request procedure, when I write, I need to read the bio-industrial sector data (from the physical disk) before writing new data. My excerpt below demonstrates much of what I'm trying to accomplish, but for some reason I never get a return from wait_for_completion. After I / O to the block device. It freezes after submit_bio and never continues. Every 120 seconds, I get a stack dump and a message about how the task is blocked. Any ideas? Thoughts?
... in make_request .... if(rw != READ){ struct completion event; struct bio *biow = bio_alloc(GFP_NOIO, bio_segments(bio)); biow->bi_bdev = bio->bi_bdev; biow->bi_sector = bio->sector; biow->bi_rw = READ_SYNC; biow->bi_vcnt = bio_segments(bio); biow->bi_size = bio->bi_size; init_completion(&event); biow->bi_private = &event; biow->bi_end_io = bi_complete; submit_bio(READ_SYNC, biow); wait_for_completion(&event); .... some more magic occurs here .... } generic_make_request(bio);
source share