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 git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending

Pull scsi target fixes from Nicholas Bellinger:
"The highlights include:

- Re-instate sess->wait_list in target_wait_for_sess_cmds() for
active I/O shutdown handling in fabrics using se_cmd->cmd_kref
- Make ib_srpt call target_sess_cmd_list_set_waiting() during session
shutdown
- Fix FILEIO off-by-one READ_CAPACITY bug for !S_ISBLK export
- Fix iscsi-target login error heap buffer overflow (Kees)
- Fix iscsi-target active I/O shutdown handling regression in
v3.10-rc1

A big thanks to Kees Cook for fixing a long standing login error
buffer overflow bug.

All patches are CC'ed to stable with the exception of the v3.10-rc1
specific regression + other minor target cleanup."

* git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
iscsi-target: Fix iscsit_free_cmd() se_cmd->cmd_kref shutdown handling
target: Propigate up ->cmd_kref put return via transport_generic_free_cmd
iscsi-target: fix heap buffer overflow on error
target/file: Fix off-by-one READ_CAPACITY bug for !S_ISBLK export
ib_srpt: Call target_sess_cmd_list_set_waiting during shutdown_session
target: Re-instate sess_wait_list for target_wait_for_sess_cmds
target: Remove unused wait_for_tasks bit in target_wait_for_sess_cmds

+128 -91
+25 -9
drivers/infiniband/ulp/srpt/ib_srpt.c
··· 2227 2227 } 2228 2228 2229 2229 /** 2230 + * srpt_shutdown_session() - Whether or not a session may be shut down. 2231 + */ 2232 + static int srpt_shutdown_session(struct se_session *se_sess) 2233 + { 2234 + struct srpt_rdma_ch *ch = se_sess->fabric_sess_ptr; 2235 + unsigned long flags; 2236 + 2237 + spin_lock_irqsave(&ch->spinlock, flags); 2238 + if (ch->in_shutdown) { 2239 + spin_unlock_irqrestore(&ch->spinlock, flags); 2240 + return true; 2241 + } 2242 + 2243 + ch->in_shutdown = true; 2244 + target_sess_cmd_list_set_waiting(se_sess); 2245 + spin_unlock_irqrestore(&ch->spinlock, flags); 2246 + 2247 + return true; 2248 + } 2249 + 2250 + /** 2230 2251 * srpt_drain_channel() - Drain a channel by resetting the IB queue pair. 2231 2252 * @cm_id: Pointer to the CM ID of the channel to be drained. 2232 2253 * ··· 2285 2264 spin_unlock_irq(&sdev->spinlock); 2286 2265 2287 2266 if (do_reset) { 2267 + if (ch->sess) 2268 + srpt_shutdown_session(ch->sess); 2269 + 2288 2270 ret = srpt_ch_qp_err(ch); 2289 2271 if (ret < 0) 2290 2272 printk(KERN_ERR "Setting queue pair in error state" ··· 2352 2328 se_sess = ch->sess; 2353 2329 BUG_ON(!se_sess); 2354 2330 2355 - target_wait_for_sess_cmds(se_sess, 0); 2331 + target_wait_for_sess_cmds(se_sess); 2356 2332 2357 2333 transport_deregister_session_configfs(se_sess); 2358 2334 transport_deregister_session(se_sess); ··· 3488 3464 spin_lock_irqsave(&ch->spinlock, flags); 3489 3465 list_add(&ioctx->free_list, &ch->free_list); 3490 3466 spin_unlock_irqrestore(&ch->spinlock, flags); 3491 - } 3492 - 3493 - /** 3494 - * srpt_shutdown_session() - Whether or not a session may be shut down. 3495 - */ 3496 - static int srpt_shutdown_session(struct se_session *se_sess) 3497 - { 3498 - return true; 3499 3467 } 3500 3468 3501 3469 /**
+1
drivers/infiniband/ulp/srpt/ib_srpt.h
··· 325 325 u8 sess_name[36]; 326 326 struct work_struct release_work; 327 327 struct completion *release_done; 328 + bool in_shutdown; 328 329 }; 329 330 330 331 /**
+1 -1
drivers/scsi/qla2xxx/tcm_qla2xxx.c
··· 1370 1370 dump_stack(); 1371 1371 return; 1372 1372 } 1373 - target_wait_for_sess_cmds(se_sess, 0); 1373 + target_wait_for_sess_cmds(se_sess); 1374 1374 1375 1375 transport_deregister_session_configfs(sess->se_sess); 1376 1376 transport_deregister_session(sess->se_sess);
+6 -6
drivers/target/iscsi/iscsi_target.c
··· 651 651 cmd->buf_ptr = kmemdup(buf, ISCSI_HDR_LEN, GFP_KERNEL); 652 652 if (!cmd->buf_ptr) { 653 653 pr_err("Unable to allocate memory for cmd->buf_ptr\n"); 654 - iscsit_release_cmd(cmd); 654 + iscsit_free_cmd(cmd, false); 655 655 return -1; 656 656 } 657 657 ··· 697 697 cmd->buf_ptr = kmemdup(buf, ISCSI_HDR_LEN, GFP_KERNEL); 698 698 if (!cmd->buf_ptr) { 699 699 pr_err("Unable to allocate memory for cmd->buf_ptr\n"); 700 - iscsit_release_cmd(cmd); 700 + iscsit_free_cmd(cmd, false); 701 701 return -1; 702 702 } 703 703 ··· 1743 1743 return 0; 1744 1744 out: 1745 1745 if (cmd) 1746 - iscsit_release_cmd(cmd); 1746 + iscsit_free_cmd(cmd, false); 1747 1747 ping_out: 1748 1748 kfree(ping_data); 1749 1749 return ret; ··· 2251 2251 if (conn->conn_state != TARG_CONN_STATE_LOGGED_IN) { 2252 2252 pr_err("Received logout request on connection that" 2253 2253 " is not in logged in state, ignoring request.\n"); 2254 - iscsit_release_cmd(cmd); 2254 + iscsit_free_cmd(cmd, false); 2255 2255 return 0; 2256 2256 } 2257 2257 ··· 3665 3665 list_del(&cmd->i_conn_node); 3666 3666 spin_unlock_bh(&conn->cmd_lock); 3667 3667 3668 - iscsit_free_cmd(cmd); 3668 + iscsit_free_cmd(cmd, false); 3669 3669 break; 3670 3670 case ISTATE_SEND_NOPIN_WANT_RESPONSE: 3671 3671 iscsit_mod_nopin_response_timer(conn); ··· 4122 4122 4123 4123 iscsit_increment_maxcmdsn(cmd, sess); 4124 4124 4125 - iscsit_free_cmd(cmd); 4125 + iscsit_free_cmd(cmd, true); 4126 4126 4127 4127 spin_lock_bh(&conn->cmd_lock); 4128 4128 }
+6 -6
drivers/target/iscsi/iscsi_target_erl2.c
··· 143 143 list_del(&cmd->i_conn_node); 144 144 cmd->conn = NULL; 145 145 spin_unlock(&cr->conn_recovery_cmd_lock); 146 - iscsit_free_cmd(cmd); 146 + iscsit_free_cmd(cmd, true); 147 147 spin_lock(&cr->conn_recovery_cmd_lock); 148 148 } 149 149 spin_unlock(&cr->conn_recovery_cmd_lock); ··· 165 165 list_del(&cmd->i_conn_node); 166 166 cmd->conn = NULL; 167 167 spin_unlock(&cr->conn_recovery_cmd_lock); 168 - iscsit_free_cmd(cmd); 168 + iscsit_free_cmd(cmd, true); 169 169 spin_lock(&cr->conn_recovery_cmd_lock); 170 170 } 171 171 spin_unlock(&cr->conn_recovery_cmd_lock); ··· 248 248 iscsit_remove_cmd_from_connection_recovery(cmd, sess); 249 249 250 250 spin_unlock(&cr->conn_recovery_cmd_lock); 251 - iscsit_free_cmd(cmd); 251 + iscsit_free_cmd(cmd, true); 252 252 spin_lock(&cr->conn_recovery_cmd_lock); 253 253 } 254 254 spin_unlock(&cr->conn_recovery_cmd_lock); ··· 302 302 list_del(&cmd->i_conn_node); 303 303 304 304 spin_unlock_bh(&conn->cmd_lock); 305 - iscsit_free_cmd(cmd); 305 + iscsit_free_cmd(cmd, true); 306 306 spin_lock_bh(&conn->cmd_lock); 307 307 } 308 308 spin_unlock_bh(&conn->cmd_lock); ··· 355 355 356 356 list_del(&cmd->i_conn_node); 357 357 spin_unlock_bh(&conn->cmd_lock); 358 - iscsit_free_cmd(cmd); 358 + iscsit_free_cmd(cmd, true); 359 359 spin_lock_bh(&conn->cmd_lock); 360 360 continue; 361 361 } ··· 375 375 iscsi_sna_gte(cmd->cmd_sn, conn->sess->exp_cmd_sn)) { 376 376 list_del(&cmd->i_conn_node); 377 377 spin_unlock_bh(&conn->cmd_lock); 378 - iscsit_free_cmd(cmd); 378 + iscsit_free_cmd(cmd, true); 379 379 spin_lock_bh(&conn->cmd_lock); 380 380 continue; 381 381 }
+3 -5
drivers/target/iscsi/iscsi_target_parameters.c
··· 758 758 } 759 759 INIT_LIST_HEAD(&extra_response->er_list); 760 760 761 - strncpy(extra_response->key, key, strlen(key) + 1); 762 - strncpy(extra_response->value, NOTUNDERSTOOD, 763 - strlen(NOTUNDERSTOOD) + 1); 761 + strlcpy(extra_response->key, key, sizeof(extra_response->key)); 762 + strlcpy(extra_response->value, NOTUNDERSTOOD, 763 + sizeof(extra_response->value)); 764 764 765 765 list_add_tail(&extra_response->er_list, 766 766 &param_list->extra_response_list); ··· 1629 1629 1630 1630 if (phase & PHASE_SECURITY) { 1631 1631 if (iscsi_check_for_auth_key(key) > 0) { 1632 - char *tmpptr = key + strlen(key); 1633 - *tmpptr = '='; 1634 1632 kfree(tmpbuf); 1635 1633 return 1; 1636 1634 }
+3 -1
drivers/target/iscsi/iscsi_target_parameters.h
··· 1 1 #ifndef ISCSI_PARAMETERS_H 2 2 #define ISCSI_PARAMETERS_H 3 3 4 + #include <scsi/iscsi_proto.h> 5 + 4 6 struct iscsi_extra_response { 5 - char key[64]; 7 + char key[KEY_MAXLEN]; 6 8 char value[32]; 7 9 struct list_head er_list; 8 10 } ____cacheline_aligned;
+39 -15
drivers/target/iscsi/iscsi_target_util.c
··· 676 676 677 677 void iscsit_release_cmd(struct iscsi_cmd *cmd) 678 678 { 679 - struct iscsi_conn *conn = cmd->conn; 680 - 681 - iscsit_free_r2ts_from_list(cmd); 682 - iscsit_free_all_datain_reqs(cmd); 683 - 684 679 kfree(cmd->buf_ptr); 685 680 kfree(cmd->pdu_list); 686 681 kfree(cmd->seq_list); 687 682 kfree(cmd->tmr_req); 688 683 kfree(cmd->iov_data); 689 684 690 - if (conn) { 691 - iscsit_remove_cmd_from_immediate_queue(cmd, conn); 692 - iscsit_remove_cmd_from_response_queue(cmd, conn); 693 - } 694 - 695 685 kmem_cache_free(lio_cmd_cache, cmd); 696 686 } 697 687 698 - void iscsit_free_cmd(struct iscsi_cmd *cmd) 688 + static void __iscsit_free_cmd(struct iscsi_cmd *cmd, bool scsi_cmd, 689 + bool check_queues) 699 690 { 691 + struct iscsi_conn *conn = cmd->conn; 692 + 693 + if (scsi_cmd) { 694 + if (cmd->data_direction == DMA_TO_DEVICE) { 695 + iscsit_stop_dataout_timer(cmd); 696 + iscsit_free_r2ts_from_list(cmd); 697 + } 698 + if (cmd->data_direction == DMA_FROM_DEVICE) 699 + iscsit_free_all_datain_reqs(cmd); 700 + } 701 + 702 + if (conn && check_queues) { 703 + iscsit_remove_cmd_from_immediate_queue(cmd, conn); 704 + iscsit_remove_cmd_from_response_queue(cmd, conn); 705 + } 706 + } 707 + 708 + void iscsit_free_cmd(struct iscsi_cmd *cmd, bool shutdown) 709 + { 710 + struct se_cmd *se_cmd = NULL; 711 + int rc; 700 712 /* 701 713 * Determine if a struct se_cmd is associated with 702 714 * this struct iscsi_cmd. 703 715 */ 704 716 switch (cmd->iscsi_opcode) { 705 717 case ISCSI_OP_SCSI_CMD: 706 - if (cmd->data_direction == DMA_TO_DEVICE) 707 - iscsit_stop_dataout_timer(cmd); 718 + se_cmd = &cmd->se_cmd; 719 + __iscsit_free_cmd(cmd, true, shutdown); 708 720 /* 709 721 * Fallthrough 710 722 */ 711 723 case ISCSI_OP_SCSI_TMFUNC: 712 - transport_generic_free_cmd(&cmd->se_cmd, 1); 724 + rc = transport_generic_free_cmd(&cmd->se_cmd, 1); 725 + if (!rc && shutdown && se_cmd && se_cmd->se_sess) { 726 + __iscsit_free_cmd(cmd, true, shutdown); 727 + target_put_sess_cmd(se_cmd->se_sess, se_cmd); 728 + } 713 729 break; 714 730 case ISCSI_OP_REJECT: 715 731 /* ··· 734 718 * associated cmd->se_cmd needs to be released. 735 719 */ 736 720 if (cmd->se_cmd.se_tfo != NULL) { 737 - transport_generic_free_cmd(&cmd->se_cmd, 1); 721 + se_cmd = &cmd->se_cmd; 722 + __iscsit_free_cmd(cmd, true, shutdown); 723 + 724 + rc = transport_generic_free_cmd(&cmd->se_cmd, 1); 725 + if (!rc && shutdown && se_cmd->se_sess) { 726 + __iscsit_free_cmd(cmd, true, shutdown); 727 + target_put_sess_cmd(se_cmd->se_sess, se_cmd); 728 + } 738 729 break; 739 730 } 740 731 /* Fall-through */ 741 732 default: 733 + __iscsit_free_cmd(cmd, false, shutdown); 742 734 cmd->release_cmd(cmd); 743 735 break; 744 736 }
+1 -1
drivers/target/iscsi/iscsi_target_util.h
··· 29 29 extern bool iscsit_conn_all_queues_empty(struct iscsi_conn *); 30 30 extern void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *); 31 31 extern void iscsit_release_cmd(struct iscsi_cmd *); 32 - extern void iscsit_free_cmd(struct iscsi_cmd *); 32 + extern void iscsit_free_cmd(struct iscsi_cmd *, bool); 33 33 extern int iscsit_check_session_usage_count(struct iscsi_session *); 34 34 extern void iscsit_dec_session_usage_count(struct iscsi_session *); 35 35 extern void iscsit_inc_session_usage_count(struct iscsi_session *);
+6 -5
drivers/target/target_core_file.c
··· 153 153 struct request_queue *q = bdev_get_queue(inode->i_bdev); 154 154 unsigned long long dev_size; 155 155 156 + fd_dev->fd_block_size = bdev_logical_block_size(inode->i_bdev); 156 157 /* 157 158 * Determine the number of bytes from i_size_read() minus 158 159 * one (1) logical sector from underlying struct block_device ··· 200 199 goto fail; 201 200 } 202 201 202 + fd_dev->fd_block_size = FD_BLOCKSIZE; 203 203 /* 204 204 * Limit UNMAP emulation to 8k Number of LBAs (NoLB) 205 205 */ ··· 219 217 dev->dev_attrib.max_write_same_len = 0x1000; 220 218 } 221 219 222 - fd_dev->fd_block_size = dev->dev_attrib.hw_block_size; 223 - 224 - dev->dev_attrib.hw_block_size = FD_BLOCKSIZE; 220 + dev->dev_attrib.hw_block_size = fd_dev->fd_block_size; 225 221 dev->dev_attrib.hw_max_sectors = FD_MAX_SECTORS; 226 222 dev->dev_attrib.hw_queue_depth = FD_MAX_DEVICE_QUEUE_DEPTH; 227 223 ··· 694 694 * to handle underlying block_device resize operations. 695 695 */ 696 696 if (S_ISBLK(i->i_mode)) 697 - dev_size = (i_size_read(i) - fd_dev->fd_block_size); 697 + dev_size = i_size_read(i); 698 698 else 699 699 dev_size = fd_dev->fd_dev_size; 700 700 701 - return div_u64(dev_size, dev->dev_attrib.block_size); 701 + return div_u64(dev_size - dev->dev_attrib.block_size, 702 + dev->dev_attrib.block_size); 702 703 } 703 704 704 705 static struct sbc_ops fd_sbc_ops = {
+34 -40
drivers/target/target_core_transport.c
··· 65 65 static void transport_handle_queue_full(struct se_cmd *cmd, 66 66 struct se_device *dev); 67 67 static int transport_generic_get_mem(struct se_cmd *cmd); 68 - static void transport_put_cmd(struct se_cmd *cmd); 68 + static int transport_put_cmd(struct se_cmd *cmd); 69 69 static void target_complete_ok_work(struct work_struct *work); 70 70 71 71 int init_se_kmem_caches(void) ··· 221 221 INIT_LIST_HEAD(&se_sess->sess_list); 222 222 INIT_LIST_HEAD(&se_sess->sess_acl_list); 223 223 INIT_LIST_HEAD(&se_sess->sess_cmd_list); 224 + INIT_LIST_HEAD(&se_sess->sess_wait_list); 224 225 spin_lock_init(&se_sess->sess_cmd_lock); 225 226 kref_init(&se_sess->sess_kref); 226 227 ··· 1944 1943 * This routine unconditionally frees a command, and reference counting 1945 1944 * or list removal must be done in the caller. 1946 1945 */ 1947 - static void transport_release_cmd(struct se_cmd *cmd) 1946 + static int transport_release_cmd(struct se_cmd *cmd) 1948 1947 { 1949 1948 BUG_ON(!cmd->se_tfo); 1950 1949 ··· 1956 1955 * If this cmd has been setup with target_get_sess_cmd(), drop 1957 1956 * the kref and call ->release_cmd() in kref callback. 1958 1957 */ 1959 - if (cmd->check_release != 0) { 1960 - target_put_sess_cmd(cmd->se_sess, cmd); 1961 - return; 1962 - } 1958 + if (cmd->check_release != 0) 1959 + return target_put_sess_cmd(cmd->se_sess, cmd); 1960 + 1963 1961 cmd->se_tfo->release_cmd(cmd); 1962 + return 1; 1964 1963 } 1965 1964 1966 1965 /** ··· 1969 1968 * 1970 1969 * This routine releases our reference to the command and frees it if possible. 1971 1970 */ 1972 - static void transport_put_cmd(struct se_cmd *cmd) 1971 + static int transport_put_cmd(struct se_cmd *cmd) 1973 1972 { 1974 1973 unsigned long flags; 1975 1974 ··· 1977 1976 if (atomic_read(&cmd->t_fe_count) && 1978 1977 !atomic_dec_and_test(&cmd->t_fe_count)) { 1979 1978 spin_unlock_irqrestore(&cmd->t_state_lock, flags); 1980 - return; 1979 + return 0; 1981 1980 } 1982 1981 1983 1982 if (cmd->transport_state & CMD_T_DEV_ACTIVE) { ··· 1987 1986 spin_unlock_irqrestore(&cmd->t_state_lock, flags); 1988 1987 1989 1988 transport_free_pages(cmd); 1990 - transport_release_cmd(cmd); 1991 - return; 1989 + return transport_release_cmd(cmd); 1992 1990 } 1993 1991 1994 1992 void *transport_kmap_data_sg(struct se_cmd *cmd) ··· 2152 2152 } 2153 2153 } 2154 2154 2155 - void transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) 2155 + int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) 2156 2156 { 2157 + int ret = 0; 2158 + 2157 2159 if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD)) { 2158 2160 if (wait_for_tasks && (cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)) 2159 2161 transport_wait_for_tasks(cmd); 2160 2162 2161 - transport_release_cmd(cmd); 2163 + ret = transport_release_cmd(cmd); 2162 2164 } else { 2163 2165 if (wait_for_tasks) 2164 2166 transport_wait_for_tasks(cmd); ··· 2168 2166 if (cmd->se_lun) 2169 2167 transport_lun_remove_cmd(cmd); 2170 2168 2171 - transport_put_cmd(cmd); 2169 + ret = transport_put_cmd(cmd); 2172 2170 } 2171 + return ret; 2173 2172 } 2174 2173 EXPORT_SYMBOL(transport_generic_free_cmd); 2175 2174 ··· 2253 2250 unsigned long flags; 2254 2251 2255 2252 spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); 2256 - 2257 - WARN_ON(se_sess->sess_tearing_down); 2253 + if (se_sess->sess_tearing_down) { 2254 + spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); 2255 + return; 2256 + } 2258 2257 se_sess->sess_tearing_down = 1; 2258 + list_splice_init(&se_sess->sess_cmd_list, &se_sess->sess_wait_list); 2259 2259 2260 - list_for_each_entry(se_cmd, &se_sess->sess_cmd_list, se_cmd_list) 2260 + list_for_each_entry(se_cmd, &se_sess->sess_wait_list, se_cmd_list) 2261 2261 se_cmd->cmd_wait_set = 1; 2262 2262 2263 2263 spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); ··· 2269 2263 2270 2264 /* target_wait_for_sess_cmds - Wait for outstanding descriptors 2271 2265 * @se_sess: session to wait for active I/O 2272 - * @wait_for_tasks: Make extra transport_wait_for_tasks call 2273 2266 */ 2274 - void target_wait_for_sess_cmds( 2275 - struct se_session *se_sess, 2276 - int wait_for_tasks) 2267 + void target_wait_for_sess_cmds(struct se_session *se_sess) 2277 2268 { 2278 2269 struct se_cmd *se_cmd, *tmp_cmd; 2279 - bool rc = false; 2270 + unsigned long flags; 2280 2271 2281 2272 list_for_each_entry_safe(se_cmd, tmp_cmd, 2282 - &se_sess->sess_cmd_list, se_cmd_list) { 2273 + &se_sess->sess_wait_list, se_cmd_list) { 2283 2274 list_del(&se_cmd->se_cmd_list); 2284 2275 2285 2276 pr_debug("Waiting for se_cmd: %p t_state: %d, fabric state:" 2286 2277 " %d\n", se_cmd, se_cmd->t_state, 2287 2278 se_cmd->se_tfo->get_cmd_state(se_cmd)); 2288 2279 2289 - if (wait_for_tasks) { 2290 - pr_debug("Calling transport_wait_for_tasks se_cmd: %p t_state: %d," 2291 - " fabric state: %d\n", se_cmd, se_cmd->t_state, 2292 - se_cmd->se_tfo->get_cmd_state(se_cmd)); 2293 - 2294 - rc = transport_wait_for_tasks(se_cmd); 2295 - 2296 - pr_debug("After transport_wait_for_tasks se_cmd: %p t_state: %d," 2297 - " fabric state: %d\n", se_cmd, se_cmd->t_state, 2298 - se_cmd->se_tfo->get_cmd_state(se_cmd)); 2299 - } 2300 - 2301 - if (!rc) { 2302 - wait_for_completion(&se_cmd->cmd_wait_comp); 2303 - pr_debug("After cmd_wait_comp: se_cmd: %p t_state: %d" 2304 - " fabric state: %d\n", se_cmd, se_cmd->t_state, 2305 - se_cmd->se_tfo->get_cmd_state(se_cmd)); 2306 - } 2280 + wait_for_completion(&se_cmd->cmd_wait_comp); 2281 + pr_debug("After cmd_wait_comp: se_cmd: %p t_state: %d" 2282 + " fabric state: %d\n", se_cmd, se_cmd->t_state, 2283 + se_cmd->se_tfo->get_cmd_state(se_cmd)); 2307 2284 2308 2285 se_cmd->se_tfo->release_cmd(se_cmd); 2309 2286 } 2287 + 2288 + spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); 2289 + WARN_ON(!list_empty(&se_sess->sess_cmd_list)); 2290 + spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); 2291 + 2310 2292 } 2311 2293 EXPORT_SYMBOL(target_wait_for_sess_cmds); 2312 2294
+1
include/target/target_core_base.h
··· 543 543 struct list_head sess_list; 544 544 struct list_head sess_acl_list; 545 545 struct list_head sess_cmd_list; 546 + struct list_head sess_wait_list; 546 547 spinlock_t sess_cmd_lock; 547 548 struct kref sess_kref; 548 549 };
+2 -2
include/target/target_core_fabric.h
··· 114 114 115 115 void target_execute_cmd(struct se_cmd *cmd); 116 116 117 - void transport_generic_free_cmd(struct se_cmd *, int); 117 + int transport_generic_free_cmd(struct se_cmd *, int); 118 118 119 119 bool transport_wait_for_tasks(struct se_cmd *); 120 120 int transport_check_aborted_status(struct se_cmd *, int); ··· 123 123 int target_get_sess_cmd(struct se_session *, struct se_cmd *, bool); 124 124 int target_put_sess_cmd(struct se_session *, struct se_cmd *); 125 125 void target_sess_cmd_list_set_waiting(struct se_session *); 126 - void target_wait_for_sess_cmds(struct se_session *, int); 126 + void target_wait_for_sess_cmds(struct se_session *); 127 127 128 128 int core_alua_check_nonop_delay(struct se_cmd *); 129 129