On Fri, May 01, 2015 at 12:24PM, Andy Grover wrote: > On 05/01/2015 10:50 AM, Christoph Hellwig wrote: > >But while reviewing this I noticed another oddity: > > > >tcmu totally ignores the non-cmd arguments to tcmu_execute_rw. > >These arguments exist to support commands like COMPARE AND WRITE > >that first do a read and then a write pass, which scb_parse_cdb > >will hapilly accept, but which will be broken with tcmu. > > [CCing Ilias too] > > Hey, at least it's just a bug and not another API issue. > > So, TCMU just wants its tcmu_execute_rw called just once, even for BIDI > commands (e.g. COMPARE_AND_WRITE and XDWRITEREAD*) Hi Christoph, Andy, Nice catch. Indeed sbc_parse_cdb() has a different way of handling BIDI commands than TCMU. Since sbc_parse_cdb() does a bunch of useful things, I lean towards #2 too. Another thing I've noticed is that 'pass_level=1' (which is the default TCMU behavior now) only allows *SBC* IO-related commands, and not all IO-related commands. For example, 'pass_level=1' cannot be used for SCSI OSD commands. This is not necessarily a bad thing, but maybe we should make it a little more obvious in the documentation. I have only used full passthrough (pass_level=0) before, but I can see how 'pass_level=1' may be useful to other people. I hope we can reinstate full passthrough support again soon. Cheers, Ilias > Setting cmd->transport_complete_callback is happening in sbc_parse_cdb, some > options: > > 1) in tcmu_parse_cdb, don't call sbc_parse_cdb for bidi opcodes, do what it > would have done except don't set cmd->transport_complete_callback and set > cmd->execute_cmd to sbc_execute_rw > > 2) in tcmu_parse_cdb, call sbc_parse_cdb for all opcodes but then NULL the > callback ptr and fix the execute_cmd pointer for BIDI opcodes, either > explicitly by opcodes or based on SCF_BIDI and SCF_COMPARE_AND_WRITE flags > to identify cmds to fix > > 3) wait until in tcmu_execute_rw, and before completing the cmd for the > first time, set cmd->transport_complete_callback to NULL and > up(dev->caw_sem) ourselves > > 4) Use two-pass for tcmu, change the opcode that userspace sees in both > passes to reads and writes > > 5) some other way? > > I'd lean towards #2. Thoughts? > > Regards -- Andy
Attachment:
signature.asc
Description: Digital signature