// SPDX-License-Identifier: GPL-2.0-or-later /******************************************************************************* * Filename: target_core_tmr.c * * This file contains SPC-3 task management infrastructure * * (c) Copyright 2009-2013 Datera, Inc. * * Nicholas A. Bellinger <[email protected]> * ******************************************************************************/ #include <linux/slab.h> #include <linux/spinlock.h> #include <linux/list.h> #include <linux/export.h> #include <target/target_core_base.h> #include <target/target_core_backend.h> #include <target/target_core_fabric.h> #include "target_core_internal.h" #include "target_core_alua.h" #include "target_core_pr.h" int core_tmr_alloc_req( struct se_cmd *se_cmd, void *fabric_tmr_ptr, u8 function, gfp_t gfp_flags) { … } EXPORT_SYMBOL(…); void core_tmr_release_req(struct se_tmr_req *tmr) { … } static int target_check_cdb_and_preempt(struct list_head *list, struct se_cmd *cmd) { … } static bool __target_check_io_state(struct se_cmd *se_cmd, struct se_session *tmr_sess, bool tas) { … } void core_tmr_abort_task( struct se_device *dev, struct se_tmr_req *tmr, struct se_session *se_sess) { … } static void core_tmr_drain_tmr_list( struct se_device *dev, struct se_tmr_req *tmr, struct list_head *preempt_and_abort_list) { … } /** * core_tmr_drain_state_list() - abort SCSI commands associated with a device * * @dev: Device for which to abort outstanding SCSI commands. * @prout_cmd: Pointer to the SCSI PREEMPT AND ABORT if this function is called * to realize the PREEMPT AND ABORT functionality. * @tmr_sess: Session through which the LUN RESET has been received. * @tas: Task Aborted Status (TAS) bit from the SCSI control mode page. * A quote from SPC-4, paragraph "7.5.10 Control mode page": * "A task aborted status (TAS) bit set to zero specifies that * aborted commands shall be terminated by the device server * without any response to the application client. A TAS bit set * to one specifies that commands aborted by the actions of an I_T * nexus other than the I_T nexus on which the command was * received shall be completed with TASK ABORTED status." * @preempt_and_abort_list: For the PREEMPT AND ABORT functionality, a list * with registrations that will be preempted. */ static void core_tmr_drain_state_list( struct se_device *dev, struct se_cmd *prout_cmd, struct se_session *tmr_sess, bool tas, struct list_head *preempt_and_abort_list) { … } int core_tmr_lun_reset( struct se_device *dev, struct se_tmr_req *tmr, struct list_head *preempt_and_abort_list, struct se_cmd *prout_cmd) { … }