Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch '3.3-urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending

Pull target fixes from Nicholas Bellinger:
"This series addresses two recently reported regression bugs related to
legacy SCSI reservation usage in target core, and iscsi-target
reservation conflict handling.

The second patch in particular addresses possible data-corruption with
SCSI reservations that is specific to iscsi-target fabric LUNs with
multiple client writers. Both patches need to go into v3.2 stable
ASAP, and the branch based on the last target-pending/3.3-rc-fixes
HEAD.

Again, thanks to Martin Svec for his help to identify and address this
regression bug with iscsi-target."

* '3.3-urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
iscsi-target: Fix reservation conflict -EBUSY response handling bug
target: Fix compatible reservation handling (CRH=1) with legacy RESERVE/RELEASE

+24 -13
+1 -1
drivers/target/iscsi/iscsi_target.c
··· 1028 1028 return iscsit_add_reject_from_cmd( 1029 1029 ISCSI_REASON_BOOKMARK_NO_RESOURCES, 1030 1030 1, 1, buf, cmd); 1031 - } else if (transport_ret == -EINVAL) { 1031 + } else if (transport_ret < 0) { 1032 1032 /* 1033 1033 * Unsupported SAM Opcode. CHECK_CONDITION will be sent 1034 1034 * in iscsit_execute_cmd() during the CmdSN OOO Execution
+22 -12
drivers/target/target_core_pr.c
··· 117 117 struct se_node_acl *, struct se_session *); 118 118 static void core_scsi3_put_pr_reg(struct t10_pr_registration *); 119 119 120 - static int target_check_scsi2_reservation_conflict(struct se_cmd *cmd, int *ret) 120 + static int target_check_scsi2_reservation_conflict(struct se_cmd *cmd) 121 121 { 122 122 struct se_session *se_sess = cmd->se_sess; 123 123 struct se_subsystem_dev *su_dev = cmd->se_dev->se_sub_dev; ··· 127 127 int conflict = 0; 128 128 129 129 if (!crh) 130 - return false; 130 + return -EINVAL; 131 131 132 132 pr_reg = core_scsi3_locate_pr_reg(cmd->se_dev, se_sess->se_node_acl, 133 133 se_sess); ··· 155 155 */ 156 156 if (pr_reg->pr_res_holder) { 157 157 core_scsi3_put_pr_reg(pr_reg); 158 - *ret = 0; 159 - return false; 158 + return 1; 160 159 } 161 160 if ((pr_reg->pr_res_type == PR_TYPE_WRITE_EXCLUSIVE_REGONLY) || 162 161 (pr_reg->pr_res_type == PR_TYPE_EXCLUSIVE_ACCESS_REGONLY) || 163 162 (pr_reg->pr_res_type == PR_TYPE_WRITE_EXCLUSIVE_ALLREG) || 164 163 (pr_reg->pr_res_type == PR_TYPE_EXCLUSIVE_ACCESS_ALLREG)) { 165 164 core_scsi3_put_pr_reg(pr_reg); 166 - *ret = 0; 167 - return true; 165 + return 1; 168 166 } 169 167 core_scsi3_put_pr_reg(pr_reg); 170 168 conflict = 1; ··· 187 189 " while active SPC-3 registrations exist," 188 190 " returning RESERVATION_CONFLICT\n"); 189 191 cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; 190 - return true; 192 + return -EBUSY; 191 193 } 192 194 193 - return false; 195 + return 0; 194 196 } 195 197 196 198 int target_scsi2_reservation_release(struct se_task *task) ··· 199 201 struct se_device *dev = cmd->se_dev; 200 202 struct se_session *sess = cmd->se_sess; 201 203 struct se_portal_group *tpg = sess->se_tpg; 202 - int ret = 0; 204 + int ret = 0, rc; 203 205 204 206 if (!sess || !tpg) 205 207 goto out; 206 - if (target_check_scsi2_reservation_conflict(cmd, &ret)) 208 + rc = target_check_scsi2_reservation_conflict(cmd); 209 + if (rc == 1) 207 210 goto out; 211 + else if (rc < 0) { 212 + cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; 213 + ret = -EINVAL; 214 + goto out; 215 + } 208 216 209 217 ret = 0; 210 218 spin_lock(&dev->dev_reservation_lock); ··· 247 243 struct se_device *dev = cmd->se_dev; 248 244 struct se_session *sess = cmd->se_sess; 249 245 struct se_portal_group *tpg = sess->se_tpg; 250 - int ret = 0; 246 + int ret = 0, rc; 251 247 252 248 if ((cmd->t_task_cdb[1] & 0x01) && 253 249 (cmd->t_task_cdb[1] & 0x02)) { ··· 263 259 */ 264 260 if (!sess || !tpg) 265 261 goto out; 266 - if (target_check_scsi2_reservation_conflict(cmd, &ret)) 262 + rc = target_check_scsi2_reservation_conflict(cmd); 263 + if (rc == 1) 267 264 goto out; 265 + else if (rc < 0) { 266 + cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; 267 + ret = -EINVAL; 268 + goto out; 269 + } 268 270 269 271 ret = 0; 270 272 spin_lock(&dev->dev_reservation_lock);
+1
drivers/target/target_core_transport.c
··· 2539 2539 cmd, cdb, pr_reg_type) != 0) { 2540 2540 cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; 2541 2541 cmd->se_cmd_flags |= SCF_SCSI_RESERVATION_CONFLICT; 2542 + cmd->scsi_status = SAM_STAT_RESERVATION_CONFLICT; 2542 2543 cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; 2543 2544 return -EBUSY; 2544 2545 }