Recent changes by Nicholas to fix the Persistent Group Reservation code for the iSCSI target code prompted me to run my PGR test suite (see https://github.com/gonzoleeman/open-iscsi-pgr-validate), and I found one more bug in the PR code. For a PR lock type of Exclusive Access, all registrants should be able to read from the device though only the reservation holder should be able to write to the device. The current target code disallows reading as well as writing in this case, which is a bug. The following patch seems to fix this, but I'm using "cmd->data_direction == DMA_FROM_DEVICE" to identify READ commands, and I'm not sure this is correct. Perhaps the code should explicitly check for allowed commands as per SBC 3, Section 4.17 Reservations, Table 4 SBC-3 commands that are allowed in the presence of various reservations? I would appreciate your input since you know the code so well. ---------------------------------------------------------------- From: Lee Duncan <lduncan@xxxxxxxx> Subject: [PATCH] target: Allow READ fro Write Exclusive Registrants. For reservation type Exclusive Access, allow all registrants to read from the device. Signed-off-by: Lee Duncan <lduncan@xxxxxxxx> --- target_core_pr.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c --- a/drivers/target/target_core_pr.c 2014-12-18 18:05:34.155248494 -0800 +++ b/drivers/target/target_core_pr.c 2014-12-18 19:49:46.786931456 -0800 @@ -528,6 +528,18 @@ static int core_scsi3_pr_seq_non_holder( return 0; } + } else if (we && registered_nexus) { + /* + * Reads are allowed for Write Exclusive locks + * from all registrants. + */ + if (cmd->data_direction == DMA_FROM_DEVICE) { + pr_debug("Allowing READ CDB: 0x%02x for %s" + " reservation\n", cdb[0], + core_scsi3_pr_dump_type(pr_reg_type)); + + return 0; + } } pr_debug("%s Conflict for %sregistered nexus %s CDB: 0x%2x" " for %s reservation\n", transport_dump_cmd_direction(cmd), -- 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