From d85e33dbcc0a832c11ddb7e1de23a768baf7fa6d Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 23 Dec 2019 18:51:02 +0000 Subject: [PATCH 1/8] iscsi-scst: Serialize socket disconnect calls properly This patch fixes the following kernel complaint: WARNING: suspicious RCU usage include/net/sock.h:1907 suspicious rcu_dereference_protected() usage! other info that might help us debug this: rcu_scheduler_active = 2, debug_locks = 1 no locks held by iscsi_conn_clea/18329. stack backtrace: Call Trace: dump_stack+0xa5/0xe6 lockdep_rcu_suspicious+0x107/0x111 tcp_disconnect+0x9ee/0xa60 iscsi_tcp_conn_close+0x5d/0x90 [iscsi_scst] close_conn+0xcfe/0x1470 [iscsi_scst] close_conn_thr+0x54/0x80 [iscsi_scst] kthread+0x1bc/0x210 ret_from_fork+0x24/0x30 Fixes: commit ba3062fe6b4c ("iscsi-scst: Improve connection shutdown time"; r297). git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8693 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/iscsi.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/iscsi-scst/kernel/iscsi.c b/iscsi-scst/kernel/iscsi.c index dd53fb96f..b211d6b4d 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -3464,10 +3464,15 @@ static int iscsi_tcp_send_locally(struct iscsi_cmnd *req, static void iscsi_tcp_conn_close(struct iscsi_conn *conn, int flags) { - if (!flags) - conn->sock->sk->sk_prot->disconnect(conn->sock->sk, 0); - else + struct sock *sk = conn->sock->sk; + + if (!flags) { + lock_sock(sk); + sk->sk_prot->disconnect(sk, 0); + release_sock(sk); + } else { conn->sock->ops->shutdown(conn->sock, flags); + } } static int iscsi_xmit_response(struct scst_cmd *scst_cmd) From d91851cccc2093614e876c7b120ed4716c7d0cad Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 23 Dec 2019 18:52:15 +0000 Subject: [PATCH 2/8] scst: Convert mutex_release() and rwlock_release() to the kernel v5.5 prototypes git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8694 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/backport.h | 11 +++++++++++ scst/src/scst_main.c | 4 ++-- scst/src/scst_sysfs.c | 4 ++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/scst/include/backport.h b/scst/include/backport.h index 0ece4c6b0..2be9912bd 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -853,6 +853,17 @@ static inline void lockdep_unregister_key(struct lock_class_key *key) } #endif +/* + * See also commit 5facae4f3549 ("locking/lockdep: Remove unused @nested + * argument from lock_release()"). + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0) +#undef rwlock_release +#define rwlock_release(l, i) lock_release(l, 1, i) +#undef mutex_release +#define mutex_release(l, i) lock_release(l, 0, i) +#endif + /* */ #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) /* diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index b3a00f745..7ea991e17 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -979,7 +979,7 @@ out: if (res == 0) lock_acquired(&scst_suspend_dep_map, _RET_IP_); else - rwlock_release(&scst_suspend_dep_map, 1, _RET_IP_); + rwlock_release(&scst_suspend_dep_map, _RET_IP_); #endif TRACE_EXIT_RES(res); @@ -1059,7 +1059,7 @@ void scst_resume_activity(void) TRACE_ENTRY(); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) - rwlock_release(&scst_suspend_dep_map, 1, _RET_IP_); + rwlock_release(&scst_suspend_dep_map, _RET_IP_); #endif mutex_lock(&scst_suspend_mutex); diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index c756c39b9..3d6bc0432 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -464,7 +464,7 @@ static void scst_process_sysfs_works(void) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) if (work->dep_map) - mutex_release(work->dep_map, 0, _RET_IP_); + mutex_release(work->dep_map, _RET_IP_); #endif spin_lock(&sysfs_work_lock); @@ -1213,7 +1213,7 @@ void scst_kobject_put_and_wait(struct kobject *kobj, const char *category, out_free: #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) lock_acquired(dep_map, _RET_IP_); - mutex_release(dep_map, 0, _RET_IP_); + mutex_release(dep_map, _RET_IP_); #endif kfree(name); From 2ec09741db407d133c269a3f7998a1fde477d74f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 23 Dec 2019 18:52:57 +0000 Subject: [PATCH 3/8] scripts/checkpatch: Suppress more checkpatch complaints about long lines git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8695 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scripts/checkpatch | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/checkpatch b/scripts/checkpatch index bddb1b765..d9519526c 100755 --- a/scripts/checkpatch +++ b/scripts/checkpatch @@ -3,6 +3,8 @@ ignore=( CONSTANT_COMPARISON LINUX_VERSION_CODE + LONG_LINE + LONG_LINE_COMMENT LONG_LINE_STRING RETURN_VOID SPDX_LICENSE_TAG From 60bf4671a49df5fc11c4f7b5b5bb474d32da4f5c Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 23 Dec 2019 18:53:43 +0000 Subject: [PATCH 4/8] scst: Change static const char * into static const char* const git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8696 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t/qla_def.h | 2 +- scst/src/dev_handlers/scst_vdisk.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/qla2x00t/qla_def.h b/qla2x00t/qla_def.h index 31d4e79ca..6991e9016 100644 --- a/qla2x00t/qla_def.h +++ b/qla2x00t/qla_def.h @@ -1796,7 +1796,7 @@ typedef struct fc_port { #define FCS_DEVICE_LOST 3 #define FCS_ONLINE 4 -static const char *port_state_str[] = { +static const char *const port_state_str[] = { "Unknown", "UNCONFIGURED", "DEAD", diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 613259b94..d6bd52239 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -9871,7 +9871,7 @@ static const struct attribute *vdisk_fileio_attrs[] = { NULL, }; -static const char *fileio_add_dev_params[] = { +static const char *const fileio_add_dev_params[] = { "async", "blocksize", "cluster_mode", @@ -9962,7 +9962,7 @@ static const struct attribute *vdisk_blockio_attrs[] = { NULL, }; -static const char *blockio_add_dev_params[] = { +static const char *const blockio_add_dev_params[] = { "active", "bind_alua_state", "blocksize", @@ -10038,7 +10038,7 @@ static const struct attribute *vdisk_nullio_attrs[] = { NULL, }; -static const char *nullio_add_dev_params[] = { +static const char *const nullio_add_dev_params[] = { "blocksize", "cluster_mode", "dif_mode", From 6fde88d57bb92a698aca2862cf9cd7ef3439c5bf Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 23 Dec 2019 18:54:35 +0000 Subject: [PATCH 5/8] scst, qla2x00t: Use pr_warn() instead of pr_warning() pr_warning() has been removed from kernel v5.5. Hence use pr_warn() instead of pr_warning(). git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8697 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t/qla_dbg.c | 10 +++++----- scst/include/backport.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/qla2x00t/qla_dbg.c b/qla2x00t/qla_dbg.c index 4ce10d7c3..0a96d1e09 100644 --- a/qla2x00t/qla_dbg.c +++ b/qla2x00t/qla_dbg.c @@ -2265,11 +2265,11 @@ ql_dbg(uint32_t level, scsi_qla_host_t *vha, int32_t id, const char *fmt, ...) if (vha != NULL) { const struct pci_dev *pdev = vha->hw->pdev; /* : Message */ - pr_warning("%s [%s]-%04x:%ld: ", + pr_warn("%s [%s]-%04x:%ld: ", QL_MSGHDR, dev_name(&(pdev->dev)), id + ql_dbg_offset, vha->host_no); } else { - pr_warning("%s [%s]-%04x: ", + pr_warn("%s [%s]-%04x: ", QL_MSGHDR, "0000:00:00.0", id + ql_dbg_offset); } @@ -2306,7 +2306,7 @@ ql_dbg_pci(uint32_t level, struct pci_dev *pdev, int32_t id, va_start(va, fmt); /* : Message */ - pr_warning("%s [%s]-%04x: ", + pr_warn("%s [%s]-%04x: ", QL_MSGHDR, dev_name(&(pdev->dev)), id + ql_dbg_offset); vprintk(fmt, va); @@ -2356,7 +2356,7 @@ ql_log(uint32_t level, scsi_qla_host_t *vha, int32_t id, const char *fmt, ...) pr_err("%s", pbuf); break; case ql_log_info: - pr_warning("%s", pbuf); + pr_warn("%s", pbuf); break; default: pr_info("%s", pbuf); @@ -2406,7 +2406,7 @@ ql_log_pci(uint32_t level, struct pci_dev *pdev, int32_t id, pr_err("%s", pbuf); break; case ql_log_info: - pr_warning("%s", pbuf); + pr_warn("%s", pbuf); break; default: pr_info("%s", pbuf); diff --git a/scst/include/backport.h b/scst/include/backport.h index 2be9912bd..32d624d5d 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -1159,7 +1159,7 @@ static inline bool percpu_ref_is_zero(struct percpu_ref *ref) #define pr_alert(fmt, ...) printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) #define pr_crit(fmt, ...) printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) #define pr_err(fmt, ...) printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) -#define pr_warning(fmt, ...) printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) +#define pr_warn(fmt, ...) printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) #define pr_notice(fmt, ...) printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) #endif /* pr_emerg */ From 5ca9d97b658d8917f38411bc111afadad8e4d993 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 23 Dec 2019 18:55:58 +0000 Subject: [PATCH 6/8] scst: Remove the code that depends on the SCSI_EXEC_REQ_FIFO_DEFINED macro The exec_req_fifo patches have been removed some time ago. Hence also remove the code that depends on these patches having been applied. See also commit 78d6da4517a4 ("scst: Remove obsolete exec_req_fifo kernel patches"; r8022). git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8698 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scripts/generate-kernel-patch | 1 - scripts/specialize-patch | 25 +++---------------------- scst/src/scst_lib.c | 5 ----- scst/src/scst_main.c | 5 +---- scst/src/scst_priv.h | 5 +---- 5 files changed, 5 insertions(+), 36 deletions(-) diff --git a/scripts/generate-kernel-patch b/scripts/generate-kernel-patch index 5d8a61a03..8800e589e 100755 --- a/scripts/generate-kernel-patch +++ b/scripts/generate-kernel-patch @@ -114,7 +114,6 @@ function specialize_patch { "$(dirname "$0")/specialize-patch" \ "${specialize_patch_options[@]}" \ -v kernel_version="${kver3}" \ - -v SCSI_EXEC_REQ_FIFO_DEFINED="${scsi_exec_req_fifo_defined}" \ -v SCST_IO_CONTEXT="${scst_io_context}" else cat diff --git a/scripts/specialize-patch b/scripts/specialize-patch index 40563a6fa..eb28570a4 100755 --- a/scripts/specialize-patch +++ b/scripts/specialize-patch @@ -226,14 +226,6 @@ function evaluate(stmnt, pattern, arg, op, result) { gsub("defined\\(UEK_KABI_RENAME\\)", "0", stmnt) - if (SCSI_EXEC_REQ_FIFO_DEFINED != "") - { - gsub("defined[[:blank:]]+SCSI_EXEC_REQ_FIFO_DEFINED", - SCSI_EXEC_REQ_FIFO_DEFINED, stmnt) - gsub("defined[[:blank:]]*\\([[:blank:]]*SCSI_EXEC_REQ_FIFO_DEFINED[[:blank:]]*\\)", - SCSI_EXEC_REQ_FIFO_DEFINED, stmnt) - } - if (SCST_IO_CONTEXT != "") { gsub("defined[[:blank:]]+SCST_IO_CONTEXT", SCST_IO_CONTEXT, stmnt) @@ -428,7 +420,6 @@ function handle_if(evaluated) && $0 ~ "GENERATING_UPSTREAM_PATCH" \ || $0 ~ "CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION" \ || ($0 ~ "CONFIG_SCST_PROC" && config_scst_proc_undefined) \ - || ($0 ~ "SCSI_EXEC_REQ_FIFO_DEFINED" && SCSI_EXEC_REQ_FIFO_DEFINED!="") \ || ($0 ~ "SCST_IO_CONTEXT" && SCST_IO_CONTEXT != "")) { } @@ -523,19 +514,9 @@ function process_preprocessor_statement(evaluated, condition) { printf "/* debug specialize-patch: (g2) %s: output = %d */\n", \ evaluated, output } - if (evaluated ~ "^+#define SCSI_EXEC_REQ_FIFO_DEFINED$" \ - && SCSI_EXEC_REQ_FIFO_DEFINED != "" \ - || evaluated ~ "^+#define SCST_IO_CONTEXT$" \ - && SCST_IO_CONTEXT != "" \ - || (evaluated ~ "^+#define CONFIG_SCST_PROC$" \ - && config_scst_proc_undefined)) - { - discard = 1 - delete_next_blank_line = 1 - } - else if (output && (!condition || \ - decision[if_nesting_level + (evaluated ~ "^+#endif$")] \ - !~ "^+#(el|)if [01]")) + if (output && (!condition || \ + decision[if_nesting_level + (evaluated ~ "^+#endif$")] \ + !~ "^+#(el|)if [01]")) { if (evaluated == "+#if undecided" \ || (evaluated !~ "^+#if" \ diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index a0b69aa02..e3c832110 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -147,8 +147,6 @@ int hex_to_bin(char ch) EXPORT_SYMBOL(hex_to_bin); #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) || \ - !defined(SCSI_EXEC_REQ_FIFO_DEFINED) static int sg_copy(struct scatterlist *dst_sg, struct scatterlist *src_sg, #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0) int nents_to_copy, size_t copy_len, @@ -156,7 +154,6 @@ static int sg_copy(struct scatterlist *dst_sg, struct scatterlist *src_sg, #else int nents_to_copy, size_t copy_len); #endif -#endif static void scst_free_descriptors(struct scst_cmd *cmd); static bool sg_cmp(struct scatterlist *dst_sg, struct scatterlist *src_sg, @@ -8393,7 +8390,6 @@ out: } #endif -#if !defined(SCSI_EXEC_REQ_FIFO_DEFINED) /* * Can switch to the next dst_sg element, so, to copy to strictly only * one dst_sg element, it must be either last in the chain, or @@ -8545,7 +8541,6 @@ static int sg_copy(struct scatterlist *dst_sg, struct scatterlist *src_sg, out: return res; } -#endif /* !defined(SCSI_EXEC_REQ_FIFO_DEFINED) */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30) #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) && \ diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 7ea991e17..f03210d4e 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -48,10 +48,8 @@ details. #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) && \ - !defined(SCSI_EXEC_REQ_FIFO_DEFINED) && \ !defined(CONFIG_SCST_STRICT_SERIALIZING) -#warning Patch scst_exec_req_fifo- was not applied on \ -your kernel and CONFIG_SCST_STRICT_SERIALIZING is not defined. \ +#warning CONFIG_SCST_STRICT_SERIALIZING has not been defined. \ Pass-through dev handlers will not work. #endif @@ -1538,7 +1536,6 @@ int __scst_register_dev_driver(struct scst_dev_type *dev_type, goto out; #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) && \ - !defined(SCSI_EXEC_REQ_FIFO_DEFINED) && \ !defined(CONFIG_SCST_STRICT_SERIALIZING) if (dev_type->exec == NULL) { PRINT_ERROR("Pass-through dev handlers (handler \"%s\") not " diff --git a/scst/src/scst_priv.h b/scst/src/scst_priv.h index 94d84f9eb..47483eec9 100644 --- a/scst/src/scst_priv.h +++ b/scst/src/scst_priv.h @@ -457,12 +457,9 @@ static inline int scst_exec_req(struct scsi_device *sdev, #if defined(CONFIG_SCST_STRICT_SERIALIZING) return scsi_execute_async(sdev, cmd, cmd_len, data_direction, (void *)sgl, bufflen, nents, timeout, retries, privdata, done, gfp); -#elif !defined(SCSI_EXEC_REQ_FIFO_DEFINED) +#else WARN_ON(1); return -1; -#else - return scsi_execute_async_fifo(sdev, cmd, cmd_len, data_direction, - (void *)sgl, bufflen, nents, timeout, retries, privdata, done, gfp); #endif } #endif From 105ac34449c422d98f314b0b2c83b82754dbbf8b Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 23 Dec 2019 18:56:47 +0000 Subject: [PATCH 7/8] scst_vdisk: Rename vdisk_parse() into fileio_parse() Since this function is only used by the vdisk_fileio handler, reflect this in the function name. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8699 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index d6bd52239..cc8e7c986 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -2718,7 +2718,7 @@ out_err: goto out; } -static int vdisk_parse(struct scst_cmd *cmd) +static int fileio_parse(struct scst_cmd *cmd) { int res, rc; @@ -9909,7 +9909,7 @@ static struct scst_dev_type vdisk_file_devtype = { .detach = vdisk_detach, .attach_tgt = vdisk_attach_tgt, .detach_tgt = vdisk_detach_tgt, - .parse = vdisk_parse, + .parse = fileio_parse, .exec = fileio_exec, .on_free_cmd = fileio_on_free_cmd, .task_mgmt_fn_done = vdisk_task_mgmt_fn_done, From 85f8ac3a1e8a0ee36fc4ae522a0c56c72b6b609e Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 23 Dec 2019 19:04:18 +0000 Subject: [PATCH 8/8] vdisk_blockio: Add support for unaligned buffers This patch prevents that the following warning is reported when running the libiscsi tests against the vdisk_blockio handler: Refused bio with invalid length 4080 and/or offset 16. WARNING: CPU: 3 PID: 16022 at /home/bvanassche/software/scst.git/scst/src/dev_handlers/scst_vdisk.c:6180 blockio_exec_rw+0xc89/0xcf0 [scst_vdisk] Call Trace: blockio_exec_write+0x9c/0xe0 [scst_vdisk] vdev_do_job+0xe8/0x220 [scst_vdisk] blockio_exec+0x140/0x370 [scst_vdisk] scst_do_real_exec+0xf4/0x610 [scst] scst_exec_check_blocking+0x24e/0x6b0 [scst] scst_exec_check_sn+0x222/0x6c0 [scst] scst_process_active_cmd+0xdff/0x31c0 [scst] scst_cmd_thread+0x36f/0xb60 [scst] kthread+0x1bc/0x210 ret_from_fork+0x24/0x30 See also https://github.com/sahlberg/libiscsi/issues/302. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8700 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index cc8e7c986..e333a7b16 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -3312,6 +3312,14 @@ static enum compl_status_e fileio_exec_async(struct vdisk_cmd_params *p) } #endif +static void blockio_on_free_cmd(struct scst_cmd *cmd) +{ + if (!scst_cmd_get_dh_data_buff_alloced(cmd)) + return; + sgv_pool_free(cmd->sgv, &cmd->dev->dev_mem_lim); + cmd->sgv = NULL; +} + static void vdisk_on_free_cmd_params(const struct vdisk_cmd_params *p) { if (!p->execute_async) { @@ -3403,6 +3411,29 @@ out: return res; } +static int blockio_alloc(struct scst_cmd *cmd) +{ + struct scst_tgt_dev *tgt_dev = cmd->tgt_dev; + struct sgv_pool *pool = tgt_dev->pools[raw_smp_processor_id()]; + int res = SCST_CMD_STATE_DEFAULT; + + if (cmd->sg && (cmd->sg->offset & 511) == 0) + return res; + + WARN_ON_ONCE(cmd->sgv); + cmd->sg = sgv_pool_alloc(pool, cmd->bufflen, cmd->cmd_gfp_mask, 0, + &cmd->sg_cnt, &cmd->sgv, + &cmd->dev->dev_mem_lim, NULL); + if (!cmd->sg) { + res = SCST_CMD_STATE_STOP; + goto out; + } + scst_cmd_set_dh_data_buff_alloced(cmd); + +out: + return res; +} + static enum scst_exec_res blockio_exec(struct scst_cmd *cmd) { struct scst_vdisk_dev *virt_dev = cmd->dev->dh_priv; @@ -9995,7 +10026,9 @@ static struct scst_dev_type vdisk_blk_devtype = { .attach_tgt = vdisk_attach_tgt, .detach_tgt = vdisk_detach_tgt, .parse = non_fileio_parse, + .dev_alloc_data_buf = blockio_alloc, .exec = blockio_exec, + .on_free_cmd = blockio_on_free_cmd, .on_alua_state_change_start = blockio_on_alua_state_change_start, .on_alua_state_change_finish = blockio_on_alua_state_change_finish, .task_mgmt_fn_done = vdisk_task_mgmt_fn_done,