How can I identify the request queue for a linux block device -
i working on driver connects hard disk on network. there bug if enable 2 or more hard disks on computer, first 1 gets partitions looked on , identified. result is, if have 1 partition on hda , 1 partitions on hdb, connect hda there partition can mounted. hda1 gets blkid xyz123 mounts. when go ahead , mount hdb1 comes same blkid , in fact, driver reading hda, not hdb.
so think found place driver messing up. below debug output including dump_stack put @ first spot seems accessing wrong device.
here code section:
/*basically, request_queue processor. in log output follows, second device, (hdb) has been connected, right after hda connected , hda1 mounted system. */ void nblk_request_proc(struct request_queue *q) { struct request *req; ndas_error_t err = ndas_ok; dump_stack(); while((req = nblk_next_request(q)) != null) { dbgl_blk(8,"processing queue request slot %d",slot_r(req)); if (test_bit(ndas_flag_queue_suspended, &(ndas_get_slot_dev(slot_r(req))->queue_flags))) { printk ("ndas: queue suspended\n"); /* queue suspended */ #if ( linux_version_code >= kernel_version(2,6,31) ) blk_start_request(req); #else blkdev_dequeue_request(req); #endif
here log output. have added comments understand happening , bad call seems come up.
/* below here can see "slot" mentioned many times. identification network case in hd connected network. see slot 2 in log because first device has been connected , mounted. */ kernel: [231644.155503] bl|4|slot_enable|/driver/block/ctrldev.c:281|adding disk: slot=2, first_minor=16, capacity=976769072|nd/dpcd1,64:15:44.38,3828:10 kernel: [231644.155588] bl|3|ndop_open|/driver/block/ops.c:233|ing bdev=f6823400|nd/dpcd1,64:15:44.38,3720:10 kernel: [231644.155598] bl|2|ndop_open|/driver/block/ops.c:247|slot =0x2|nd/dpcd1,64:15:44.38,3720:10 kernel: [231644.155606] bl|2|ndop_open|/driver/block/ops.c:248|dev_t=0x3c00010|nd/dpcd1,64:15:44.38,3720:10 kernel: [231644.155615] nd|3|ndas_query_slot|netdisk/nddev.c:791|slot=2 sdev=d33e2080|nd/dpcd1,64:15:44.38,3696:10 kernel: [231644.155624] nd|3|ndas_query_slot|netdisk/nddev.c:817|ed|nd/dpcd1,64:15:44.38,3696:10 kernel: [231644.155631] bl|3|ndop_open|/driver/block/ops.c:326|mode=1|nd/dpcd1,64:15:44.38,3720:10 kernel: [231644.155640] bl|3|ndop_open|/driver/block/ops.c:365|ed open|nd/dpcd1,64:15:44.38,3724:10 kernel: [231644.155653] bl|8|ndop_revalidate_disk|/driver/block/ops.c:2334|gendisk=c6afd800={major=60,first_minor=16,minors=0x10,disk_name=ndas-44700486-0,private_data=00000002,capacity=%lld}|nd/dpcd1,64:15:44.38,3660:10 kernel: [231644.155668] bl|8|ndop_revalidate_disk|/driver/block/ops.c:2346|ed|nd/dpcd1,64:15:44.38,3652:10 /* @ point hard disk added (gendisk=c6...) , identifications match network device. driver begin scanning hard drive existing partitions. little 'ed', @ end of previous line indicates revalidate_disk has finished it's job. also, think request queue indicated output dpcd1 near end of line. below have entered function pasted above. in function can see slot can determined queue. , log output after stack dump shows slot 1. (the first network drive mounted.) */ kernel: [231644.155677] ndas-44700486-0:pid: 467, comm: nd/dpcd1 tainted: p 2.6.32-5-686 #1 kernel: [231644.155711] call trace: kernel: [231644.155723] [<fc5a7685>] ? nblk_request_proc+0x9/0x10c [ndas_block] kernel: [231644.155732] [<c11298db>] ? __generic_unplug_device+0x23/0x25 kernel: [231644.155737] [<c1129afb>] ? generic_unplug_device+0x1e/0x2e kernel: [231644.155743] [<c1123090>] ? blk_unplug+0x2e/0x31 kernel: [231644.155750] [<c10cceec>] ? block_sync_page+0x33/0x34 kernel: [231644.155756] [<c108770c>] ? sync_page+0x35/0x3d kernel: [231644.155763] [<c126d568>] ? __wait_on_bit_lock+0x31/0x6a kernel: [231644.155768] [<c10876d7>] ? sync_page+0x0/0x3d kernel: [231644.155773] [<c10876aa>] ? __lock_page+0x76/0x7e kernel: [231644.155780] [<c1043f1f>] ? wake_bit_function+0x0/0x3c kernel: [231644.155785] [<c1087b76>] ? do_read_cache_page+0xdf/0xf8 kernel: [231644.155791] [<c10d21b9>] ? blkdev_readpage+0x0/0xc kernel: [231644.155796] [<c1087bbc>] ? read_cache_page_async+0x14/0x18 kernel: [231644.155801] [<c1087bc9>] ? read_cache_page+0x9/0xf kernel: [231644.155808] [<c10ed6fc>] ? read_dev_sector+0x26/0x60 kernel: [231644.155813] [<c10ee368>] ? adfspart_check_ics+0x20/0x14c kernel: [231644.155819] [<c10ee138>] ? rescan_partitions+0x17e/0x378 kernel: [231644.155825] [<c10ee348>] ? adfspart_check_ics+0x0/0x14c kernel: [231644.155830] [<c10d26a3>] ? __blkdev_get+0x225/0x2c7 kernel: [231644.155836] [<c10ed7e6>] ? register_disk+0xb0/0xfd kernel: [231644.155843] [<c112e33b>] ? add_disk+0x9a/0xe8 kernel: [231644.155848] [<c112dafd>] ? exact_match+0x0/0x4 kernel: [231644.155853] [<c112deae>] ? exact_lock+0x0/0xd kernel: [231644.155861] [<fc5a8b80>] ? slot_enable+0x405/0x4a5 [ndas_block] kernel: [231644.155868] [<fc5a8c63>] ? ndcmd_enabled_handler+0x43/0x9e [ndas_block] kernel: [231644.155874] [<fc5a8c20>] ? ndcmd_enabled_handler+0x0/0x9e [ndas_block] kernel: [231644.155891] [<fc54b22b>] ? notify_func+0x38/0x4b [ndas_core] kernel: [231644.155906] [<fc561cba>] ? _dpc_cancel+0x17c/0x626 [ndas_core] kernel: [231644.155919] [<fc562005>] ? _dpc_cancel+0x4c7/0x626 [ndas_core] kernel: [231644.155933] [<fc561cba>] ? _dpc_cancel+0x17c/0x626 [ndas_core] kernel: [231644.155941] [<c1003d47>] ? kernel_thread_helper+0x7/0x10 /* here output of driver debugs. show operation being performed on first devices request queue. */ kernel: [231644.155948] bl|8|nblk_request_proc|/driver/block/block26.c:494|processing queue request slot 1|nd/dpcd1,64:15:44.38,3408:10 kernel: [231644.155959] bl|8|nblk_handle_io|/driver/block/block26.c:374|struct ndas_slot sd = ndas slot dev(slot 1) kernel: [231644.155966] |nd/dpcd1,64:15:44.38,3328:10 kernel: [231644.155970] bl|8|nblk_handle_io|/driver/block/block26.c:458|case reada call ndas_read(slot=1, ndas_req)|nd/dpcd1,64:15:44.38,3328:10 kernel: [231644.155979] nd|8|ndas_read|netdisk/nddev.c:824|read io: slot=1, cmd=0, req=x00|nd/dpcd1,64:15:44.38,3320:10
i hope enough background information. maybe obvious question @ moment "when , request_queues assigned?"
well handled little bit before add_disk function. adding disk, first line on log output.
slot->disk = null; spin_lock_init(&slot->lock); slot->queue = blk_init_queue( nblk_request_proc, &slot->lock );
as far know, standard operation. original question. can find request queue somewhere , make sure incremented or unique each new device or linux kernel use 1 queue each major number? want discover why driver loading same queue on 2 different block storages, , determine if causing duplicate blkid during initial registration process.
thanks looking @ situation me.
queue = blk_init_queue(sbd_request, &device.lock);
Comments
Post a Comment