From 0a3d69c31b00e22dfbef4f685ad43b82009f80f9 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 25 Jul 2016 17:03:06 +0000 Subject: [PATCH 1/4] scst_vdisk: Fix spelling of "reopening" git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6915 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 21b2383ba..c18a0ad6f 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -7362,7 +7362,7 @@ static void blockio_on_alua_state_change_finish(struct scst_device *dev, int rc = 0; TRACE_MGMT_DBG("ALUA state change from %s to %s finished (dev %s), " - "reopenning FD", scst_alua_state_name(old_state), + "reopening FD", scst_alua_state_name(old_state), scst_alua_state_name(new_state), dev->virt_name); /* From 1a244836780692b9be0d507ed61c5ebcd0bb3a74 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 25 Jul 2016 21:16:49 +0000 Subject: [PATCH 2/4] scst.h: Move more code to git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6916 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/backport.h | 34 ++++++++++++++++++++++++++++++++++ scst/include/scst.h | 32 -------------------------------- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/scst/include/backport.h b/scst/include/backport.h index 8e1a6afa0..c7c923eae 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -631,6 +631,40 @@ static inline void *vzalloc(unsigned long size) } #endif +/* */ + +#if defined(RHEL_MAJOR) && RHEL_MAJOR -0 <= 5 +static inline uint16_t get_unaligned_be16(const void *p) +{ + return be16_to_cpu(get_unaligned((__be16 *)p)); +} + +static inline void put_unaligned_be16(uint16_t i, void *p) +{ + put_unaligned(cpu_to_be16(i), (__be16 *)p); +} + +static inline uint32_t get_unaligned_be32(const void *p) +{ + return be32_to_cpu(get_unaligned((__be32 *)p)); +} + +static inline void put_unaligned_be32(uint32_t i, void *p) +{ + put_unaligned(cpu_to_be32(i), (__be32 *)p); +} + +static inline uint64_t get_unaligned_be64(const void *p) +{ + return be64_to_cpu(get_unaligned((__be64 *)p)); +} + +static inline void put_unaligned_be64(uint64_t i, void *p) +{ + put_unaligned(cpu_to_be64(i), (__be64 *)p); +} +#endif + /* */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) diff --git a/scst/include/scst.h b/scst/include/scst.h index 215800533..797d756f2 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -4656,38 +4656,6 @@ static inline __be16 scst_cmd_get_dif_app_tag(struct scst_cmd *cmd, return cmd->dev->dev_dif_static_app_tag; } -#if defined(RHEL_MAJOR) && RHEL_MAJOR -0 <= 5 -static inline uint16_t get_unaligned_be16(const void *p) -{ - return be16_to_cpu(get_unaligned((__be16 *)p)); -} - -static inline void put_unaligned_be16(uint16_t i, void *p) -{ - put_unaligned(cpu_to_be16(i), (__be16 *)p); -} - -static inline uint32_t get_unaligned_be32(const void *p) -{ - return be32_to_cpu(get_unaligned((__be32 *)p)); -} - -static inline void put_unaligned_be32(uint32_t i, void *p) -{ - put_unaligned(cpu_to_be32(i), (__be32 *)p); -} - -static inline uint64_t get_unaligned_be64(const void *p) -{ - return be64_to_cpu(get_unaligned((__be64 *)p)); -} - -static inline void put_unaligned_be64(uint64_t i, void *p) -{ - put_unaligned(cpu_to_be64(i), (__be64 *)p); -} -#endif - /* * Returns T10-PI type 2 expected initial reference tag as LBA, i.e. converted * into CPU endianness. Valid only with protection type 2. From 244271120e7cdc77ddecc1b5ecf3b6052b7b84d0 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Tue, 26 Jul 2016 01:42:26 +0000 Subject: [PATCH 3/4] iscsi-scst: increase past CmdSN window to 2048 On modern storage there might be more, than 128, commands queued, so previous CmdSN window might be too small and on unstable networks lead to infinite retries. For more infor see thread https://sourceforge.net/p/scst/mailman/message/35238904. Reported-By: Lev Vainblat git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6917 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/iscsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iscsi-scst/kernel/iscsi.c b/iscsi-scst/kernel/iscsi.c index 834e93ddb..4dc07f0b4 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -2458,9 +2458,9 @@ static int cmnd_abort_pre_checks(struct iscsi_cmnd *req, int *status) * Management function request is outside the valid CmdSN window, * then targets must return the "Task does not exist" response. * - * 128 seems to be a good "window". + * 2048 seems to be a good "window". */ - if (between(req_hdr->ref_cmd_sn, req_hdr->cmd_sn - 128, + if (between(req_hdr->ref_cmd_sn, req_hdr->cmd_sn - 2048, req_hdr->cmd_sn)) { *status = ISCSI_RESPONSE_FUNCTION_COMPLETE; res = 0; From cde21c669a159828a3640e236655c5032b5476bb Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Tue, 26 Jul 2016 02:04:34 +0000 Subject: [PATCH 4/4] scst: small post-r6913 cleanup git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6918 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_pres.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scst/src/scst_pres.c b/scst/src/scst_pres.c index 1627e792d..db2d8fdad 100644 --- a/scst/src/scst_pres.c +++ b/scst/src/scst_pres.c @@ -1019,11 +1019,17 @@ out_set_fs: set_fs(old_fs); out: - if (res != 0) + if (res != 0) { PRINT_CRIT_ERROR("Unable to save persistent information " "(device %s)", dev->virt_name); + /* + * It's safer to not return any error to the initiator and expect + * operator's intervention to be able to save the PR's state next + * time, than to screw up all the interactions with this initiator. + */ + } - TRACE_EXIT_RES(res); + TRACE_EXIT(); return; write_error: