Hi All,<br><br>I have found the issue.<br><br>in kernel prior to RHEL 6.0 blk_pc_request(rq) is define as:<br>
#define blk_pc_request(rq) ((rq)->flags & REQ_BLOCK_PC)<br>
while in RHEL 6.0 it is define as:<br>
#define blk_pc_request(rq) ((rq)->cmd_type == REQ_TYPE_BLOCK_PC)<br>
<br>
So, the issue was adding I was REQ_NOMERGE flag in cmd_type field of
the request. This was making blk_pc_request(rq) to return false and
thats why IOs were not going to scsi layer.<br><br>thanks,<br>ajit<br><br><div class="gmail_quote">On Wed, Apr 20, 2011 at 6:06 PM, ajit jain <span dir="ltr"><<a href="mailto:ajit4mail@gmail.com">ajit4mail@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi All,<br><br>I have written a func to send a CDB on a scsi device from the kernel. For that I am getting a request and queueing for execution.<br>
But blk_execute_rq() func is setting errors field of request to 65536 and sense length is set but all the fields in sense header is <br>
0.<br><br>I dont know what I am missing, any suggestion would be great help.<br><br><br>snippet of the code<br>===========================<br> rq = blk_get_request(q, rw, __GFP_WAIT);<br> if(!rq){<br> goto out;<br>
}<br> if (buflen && blk_rq_map_kern(q, rq, buf, buflen, __GFP_WAIT)){<br> goto out;<br> }<br> rq->cmd_len = cmdlen;<br> memcpy(rq->cmd, cmd, cmdlen);<br> memset(sense, 0, sizeof(sense));<br>
rq->sense_len = 0;<br> rq->sense = sense;<br> rq->cmd_type |= REQ_TYPE_BLOCK_PC;<br> rq->cmd_type |= REQ_NOMERGE;<br> rq->timeout = WRITE_SCSI_TIMEOUT; //WRITE_SCSI_TIMEOUT is set to 60 sec<br>
blk_execute_rq(q, bd_disk, rq, 0);<br> error = rq->errors;<br> if( error ){<br> dbg("error in blk_execute_rq error %d",error);<br> }<br> if(rq->sense_len){<br> process_sense_info(rq->sense);<br>
} else {<br> info("no sense available");<br> }<br>==========================================<br><br><br>thanks,<br><font color="#888888">ajit<br></font><br>PS:We can not use sg_ioctl interface because code expects user space application only to invoke sg_ioctl that the reason it does a copyin.<br>
<input type="hidden"><input type="hidden"><div></div>
</blockquote></div><br><input id="gwProxy" type="hidden"><input onclick="jsCall();" id="jsProxy" type="hidden"><div id="refHTML"></div>