On Tue, Apr 07, 2015 at 07:21:06AM -0700, Christoph Hellwig wrote: > On Tue, Apr 07, 2015 at 08:09:00AM -0400, Dan Lane wrote: > > Thanks, but unfortunately your post doesn't have any replies either... Any > > idea of how I could work around or fix this? > > I don't really know the COMPARE AND WRITE code at all, so I can't really > help with fixing it. > > You could try to crudely disable it like in the patch below and hope > that the initiator has a fallback: Just removing the caw_sem makes the test complete, although of course that means the COMPARE AND WRITE won't actually be atomic. I think this code really needs a conersion to a proper state machine instead of a pile of hacks and flags. diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 3e72974..14ea2f6 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c @@ -394,7 +394,7 @@ static sense_reason_t compare_and_write_post(struct se_cmd *cmd) * Unlock ->caw_sem originally obtained during sbc_compare_and_write() * before the original READ I/O submission. */ - up(&dev->caw_sem); +// up(&dev->caw_sem); return TCM_NO_SENSE; } @@ -537,7 +537,7 @@ out: * In the MISCOMPARE or failure case, unlock ->caw_sem obtained in * sbc_compare_and_write() before the original READ I/O submission. */ - up(&dev->caw_sem); +// up(&dev->caw_sem); kfree(write_sg); kfree(buf); return ret; @@ -553,11 +553,11 @@ sbc_compare_and_write(struct se_cmd *cmd) * Submit the READ first for COMPARE_AND_WRITE to perform the * comparision using SGLs at cmd->t_bidi_data_sg.. */ - rc = down_interruptible(&dev->caw_sem); - if ((rc != 0) || signal_pending(current)) { - cmd->transport_complete_callback = NULL; - return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; - } +// rc = down_interruptible(&dev->caw_sem); +// if ((rc != 0) || signal_pending(current)) { +// cmd->transport_complete_callback = NULL; +// return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; +// } /* * Reset cmd->data_length to individual block_size in order to not * confuse backend drivers that depend on this value matching the @@ -569,7 +569,7 @@ sbc_compare_and_write(struct se_cmd *cmd) DMA_FROM_DEVICE); if (ret) { cmd->transport_complete_callback = NULL; - up(&dev->caw_sem); +// up(&dev->caw_sem); return ret; } /* -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html