Skip to contentSkip to conversation

target/core: Make ABORT and LUN RESET handling synchronous

PATCH Applied Bart Van Assche 1 participant 1 message Nov 27, 2018 SCSI target

lore
Share & tools
lore
#0 lore raw

PATCH v2 9/10 target/core: Make ABORT and LUN RESET handling synchronous

Instead of invoking target driver callback functions from the context that handles an abort or LUN RESET task management function, only set the abort flag from that context and perform the actual abort handling from the context of the regular command processing flow. This approach has the advantage that the task management code becomes much easier to read and to verify since the number of potential race conditions against the command processing flow is strongly reduced.

This patch has been tested by running the following two shell commands concurrently for about ten minutes for both the iSCSI and the SRP target drivers ($dev is an initiator device node connected with storage provided by the target driver under test):
* fio with data verification enabled on a filesystem mounted on top of $dev.
* while true; do sg_reset -d $dev; echo -n .; sleep .1; done

Cc Nicholas Bellinger <[email protected]>
Cc Mike Christie <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc David Disseldorp <[email protected]>
Cc Hannes Reinecke <[email protected]>
---
 drivers/target/target_core_internal.h  |   2 -
 drivers/target/target_core_tmr.c       |  49 +++---
 drivers/target/target_core_transport.c | 230 +++++++++++++------------
 include/target/target_core_fabric.h    |   1 +
 4 files changed, 148 insertions(+), 134 deletions(-)
drivers/target/target_core_internal.h +0 -2
index 0c6635587930..853344415963 100644
@@ -138,7 +138,6 @@ int	init_se_kmem_caches(void);
 void	release_se_kmem_caches(void);
 u32	scsi_get_new_index(scsi_index_t);
 void	transport_subsystem_check_init(void);
-int	transport_cmd_finish_abort(struct se_cmd *);
 unsigned char *transport_dump_cmd_direction(struct se_cmd *);
 void	transport_dump_dev_state(struct se_device *, char *, int *);
 void	transport_dump_dev_info(struct se_device *, struct se_lun *,
@@ -148,7 +147,6 @@ int	transport_dump_vpd_assoc(struct t10_vpd *, unsigned char *, int);
 int	transport_dump_vpd_ident_type(struct t10_vpd *, unsigned char *, int);
 int	transport_dump_vpd_ident(struct t10_vpd *, unsigned char *, int);
 void	transport_clear_lun_ref(struct se_lun *);
-void	transport_send_task_abort(struct se_cmd *);
 sense_reason_t	target_cmd_size_check(struct se_cmd *cmd, unsigned int size);
 void	target_qf_do_work(struct work_struct *work);
 bool	target_check_wce(struct se_device *dev);
drivers/target/target_core_tmr.c +28 -21

71 lines not on this page · raw message

drivers/target/target_core_transport.c +119 -111

326 lines not on this page · raw message

include/target/target_core_fabric.h +1 -0
index 3c100c1f3173..c6d6bfdcd41a 100644
@@ -156,6 +156,7 @@ int	target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
 int	transport_handle_cdb_direct(struct se_cmd *);
 sense_reason_t	transport_generic_new_cmd(struct se_cmd *);
 
+void	target_put_cmd_and_wait(struct se_cmd *cmd);
 void	target_execute_cmd(struct se_cmd *cmd);
 
 int	transport_generic_free_cmd(struct se_cmd *, int);
Signature · 1 line
2.20.0.rc0.387.gc7a69e6b6c-goog