@@ -802,6 +802,14 @@ static void target_reserve2_nodlm(struct se_device *dev, struct se_session *sess
}
}
+static void target_reset_nodlm(struct se_device *dev)
+{
+ if (dev->dev_reservation_flags & DRF_SPC2_RESERVATIONS) {
+ target_release_reservation(dev);
+ pr_debug("LUN_RESET: SCSI-2 Released reservation\n");
+ }
+}
+
const struct target_cluster_ops nodlm_cluster_ops = {
.name = "single",
.owner = NULL,
@@ -813,6 +821,7 @@ const struct target_cluster_ops nodlm_cluster_ops = {
.pr_unlock = target_dummy_nodlm,
.pr_sync = target_prsync_nodlm,
.reserve = target_reserve2_nodlm,
+ .reset = target_reset_nodlm,
};
struct se_device *target_alloc_device(struct se_hba *hba, const char *name)
@@ -402,14 +402,7 @@ int core_tmr_lun_reset(
{
core_local_lun_reset(dev, tmr, NULL, NULL);
- /*
- * Clear any legacy SPC-2 reservation when called during
- * LOGICAL UNIT RESET
- */
- if (dev->dev_reservation_flags & DRF_SPC2_RESERVATIONS) {
- dev->cl_ops->reserve(dev, NULL);
- pr_debug("LUN_RESET: SCSI-2 Released reservation\n");
- }
+ dev->cl_ops->reset(dev);
target_dev_ua_allocate(dev, 0x29,
ASCQ_29H_BUS_DEVICE_RESET_FUNCTION_OCCURRED);
@@ -791,6 +791,7 @@ struct target_cluster_ops {
int (*pr_unlock)(struct se_device *dev);
int (*pr_sync)(struct se_device *dev, u8 pro_sa);
void (*reserve)(struct se_device *dev, struct se_session *sess);
+ void (*reset)(struct se_device *dev);
};
struct se_device {
Introduce `reset' function pointer in target cluster ops. For no cluster case do just clear SCSI2 reservation status. Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com> --- drivers/target/target_core_device.c | 9 +++++++++ drivers/target/target_core_tmr.c | 9 +-------- include/target/target_core_base.h | 1 + 3 files changed, 11 insertions(+), 8 deletions(-)