From af841c5c53ac05da52ba32c750ca7af83aac3aa3 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Fri, 18 Sep 2015 01:24:10 +0000 Subject: [PATCH 1/7] Decrease MULTI_CMDS_CNT for better parallelism git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6516 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- usr/fileio/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/fileio/common.c b/usr/fileio/common.c index e308359bf..47b673fcc 100644 --- a/usr/fileio/common.c +++ b/usr/fileio/common.c @@ -702,7 +702,7 @@ void *main_loop(void *arg) struct vdisk_cmd vcmd = { -1, &cmd, dev, &reply, {0}}; int scst_usr_fd = dev->scst_usr_fd; struct pollfd pl; -#define MULTI_CMDS_CNT 128 +#define MULTI_CMDS_CNT 2 struct { struct scst_user_reply_cmd replies[MULTI_CMDS_CNT]; struct scst_user_get_multi multi_cmd; From 7a23817eed61f961c7ab4409849b8f139bce19f5 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 23 Sep 2015 13:18:19 +0000 Subject: [PATCH 2/7] nightly build: Update kernel versions git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6517 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- nightly/conf/nightly.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nightly/conf/nightly.conf b/nightly/conf/nightly.conf index 054f5fc42..daea216c1 100644 --- a/nightly/conf/nightly.conf +++ b/nightly/conf/nightly.conf @@ -3,19 +3,19 @@ ABT_DETAILS="x86_64" ABT_JOBS=5 ABT_KERNELS=" \ -4.2 \ -4.1.7-nc \ +4.2.1 \ +4.1.8-nc \ 4.0.9-nc \ 3.19.7-nc \ 3.18.19-nc \ 3.17.8-nc \ 3.16.7-nc \ 3.15.10-nc \ -3.14.52-nc \ +3.14.53-nc \ 3.13.11-nc \ 3.12.44-nc \ 3.11.10-nc \ -3.10.88-nc \ +3.10.89-nc \ 3.9.11-nc \ 3.8.13-nc \ 3.7.10-nc \ From 5f46c87febbf83fb9c60796cfad9c31b653731ef Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 23 Sep 2015 17:02:31 +0000 Subject: [PATCH 3/7] scst_tg: Let the unavailable filter accept more commands git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6518 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_tg.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scst/src/scst_tg.c b/scst/src/scst_tg.c index be84d62c7..2ab483608 100644 --- a/scst/src/scst_tg.c +++ b/scst/src/scst_tg.c @@ -267,6 +267,12 @@ static bool scst_tg_accept(struct scst_cmd *cmd) case READ_CAPACITY: case REPORT_LUNS: case REQUEST_SENSE: + case RELEASE: + case RELEASE_10: + case RESERVE: + case RESERVE_10: + case READ_BUFFER: + case WRITE_BUFFER: return true; case SERVICE_ACTION_IN_16: switch (cmd->cdb[1] & 0x1f) { From 4222dc483070614336724183ca4b69e612aee616 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 23 Sep 2015 17:10:10 +0000 Subject: [PATCH 4/7] scst_tg: Reject READ and WRITE commands for ports that are in the ALUA state "standby" git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6519 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/README | 4 ---- scst/include/scst_const.h | 1 + scst/src/scst_tg.c | 30 +++++++++++++++++++++++++++++- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/scst/README b/scst/README index a5d14625b..31228e452 100644 --- a/scst/README +++ b/scst/README @@ -1460,10 +1460,6 @@ information about how to associate iSCSI targets with a single physical interface. Notes: -- The ALUA specification allows but does not require that SCSI READ and WRITE - commands are rejected by ports that are not active. SCST processes READ and - WRITE commands unless these are received through a port that is in the - unavailable, transitioning or offline state. - In a H.A. setup it is the responsibility of the user to synchronize ALUA information between the individual systems running SCST. There are no provisions in SCST to exchange ALUA information automatically between diff --git a/scst/include/scst_const.h b/scst/include/scst_const.h index b695f1d4b..7d8ded58d 100644 --- a/scst/include/scst_const.h +++ b/scst/include/scst_const.h @@ -291,6 +291,7 @@ static inline int scst_sense_response_code(const uint8_t *sense) /* NOT_READY is 2 */ #define scst_sense_format_in_progress NOT_READY, 0x04, 0x04 #define scst_sense_tp_transitioning NOT_READY, 0x04, 0x0A +#define scst_sense_tp_standby NOT_READY, 0x04, 0x0B #define scst_sense_tp_unav NOT_READY, 0x04, 0x0C #define scst_sense_no_medium NOT_READY, 0x3a, 0 diff --git a/scst/src/scst_tg.c b/scst/src/scst_tg.c index 2ab483608..3dc891a7a 100644 --- a/scst/src/scst_tg.c +++ b/scst/src/scst_tg.c @@ -297,6 +297,34 @@ static bool scst_tg_accept(struct scst_cmd *cmd) return false; } +/* + * Whether or not to accept a command in the ALUA standby state. + */ +static bool scst_tg_accept_standby(struct scst_cmd *cmd) +{ + bool process_cmd = scst_tg_accept(cmd); + + if (process_cmd) + return process_cmd; + + switch (cmd->cdb[0]) { + case MODE_SELECT: + case MODE_SELECT_10: + case LOG_SELECT: + case LOG_SENSE: + case RECEIVE_DIAGNOSTIC: + case SEND_DIAGNOSTIC: + case PERSISTENT_RESERVE_IN: + case PERSISTENT_RESERVE_OUT: + return true; + } + + scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_tp_standby)); + + return false; +} + + /* * Whether or not to accept a command in the ALUA unavailable state. */ @@ -327,7 +355,7 @@ static bool scst_tg_accept_transitioning(struct scst_cmd *cmd) static bool (*scst_alua_filter[])(struct scst_cmd *cmd) = { [SCST_TG_STATE_OPTIMIZED] = NULL, [SCST_TG_STATE_NONOPTIMIZED] = NULL, - [SCST_TG_STATE_STANDBY] = NULL, + [SCST_TG_STATE_STANDBY] = scst_tg_accept_standby, [SCST_TG_STATE_UNAVAILABLE] = scst_tg_accept_unav, [SCST_TG_STATE_LBA_DEPENDENT] = NULL, [SCST_TG_STATE_OFFLINE] = scst_tg_accept_unav, From 17f1770fab75a80f8c4d16d1955e01aedc791cad Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 29 Sep 2015 00:06:08 +0000 Subject: [PATCH 5/7] ib_srpt: Port to Linux kernel v4.3.0 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6520 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 6c9a9bbc0..9c65ae56b 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -4202,8 +4202,11 @@ static void srpt_add_one(struct ib_device *device) * in the system as service_id; therefore, the target_id will change * if this HCA is gone bad and replaced by different HCA */ - ret = ib_cm_listen(sdev->cm_id, cpu_to_be64(srpt_service_guid), 0, - NULL); + ret = ib_cm_listen(sdev->cm_id, cpu_to_be64(srpt_service_guid), 0 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) + , NULL +#endif + ); if (ret) { pr_err("ib_cm_listen() failed: %d (cm_id state = %d)\n", ret, sdev->cm_id->state); @@ -4277,12 +4280,18 @@ err: /** * srpt_remove_one() - InfiniBand device removal callback function. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) static void srpt_remove_one(struct ib_device *device) { + void *client_data = ib_get_client_data(device, &srpt_client); +#else +static void srpt_remove_one(struct ib_device *device, void *client_data) +{ +#endif struct srpt_device *sdev; int i; - sdev = ib_get_client_data(device, &srpt_client); + sdev = client_data; if (!sdev) { pr_info("%s(%s): nothing to do.\n", __func__, device->name); return; From bd6d12aa3848731d29e0077ddd25b003a2fa3c48 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 29 Sep 2015 00:07:48 +0000 Subject: [PATCH 6/7] isert-scst: Kernel v4.3 build fix git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6521 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/isert-scst/iser_rdma.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/iscsi-scst/kernel/isert-scst/iser_rdma.c b/iscsi-scst/kernel/isert-scst/iser_rdma.c index f25efc80f..b645c4cf9 100644 --- a/iscsi-scst/kernel/isert-scst/iser_rdma.c +++ b/iscsi-scst/kernel/isert-scst/iser_rdma.c @@ -1039,9 +1039,7 @@ static void isert_device_release(struct isert_device *isert_dev) err = ib_dereg_mr(isert_dev->mr); if (unlikely(err)) pr_err("Failed to destroy mr, err:%d\n", err); - err = ib_dealloc_pd(isert_dev->pd); - if (unlikely(err)) - pr_err("Failed to destroy pd, err:%d\n", err); + ib_dealloc_pd(isert_dev->pd); vfree(isert_dev->cq_desc); isert_dev->cq_desc = NULL; From f8954fe5f75102e7b9b22c8cb447dbefb6c6b9bf Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 29 Sep 2015 00:08:51 +0000 Subject: [PATCH 7/7] scst: Port to Linux kernel v4.3 Signed-off-by: Sebastian Herbszt git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6522 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 40 +++++++++++++++++++++++++----- scst/src/scst_lib.c | 11 ++++++++ 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 939cc3afc..547eff2fc 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -6186,10 +6186,15 @@ static void blockio_bio_destructor(struct bio *bio) #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) static int blockio_endio(struct bio *bio, unsigned int bytes_done, int error) -#else -static void blockio_endio(struct bio *bio, int error) -#endif { +#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) +static void blockio_endio(struct bio *bio, int error) +{ +#else +static void blockio_endio(struct bio *bio) +{ + int error = bio->bi_error; +#endif struct scst_blockio_work *blockio_work = bio->bi_private; #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) @@ -6197,6 +6202,7 @@ static void blockio_endio(struct bio *bio, int error) return 1; #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) if (unlikely(!bio_flagged(bio, BIO_UPTODATE))) { if (error == 0) { PRINT_ERROR("Not up to date bio with error 0 for " @@ -6204,6 +6210,7 @@ static void blockio_endio(struct bio *bio, int error) error = -EIO; } } +#endif if (unlikely(error != 0)) { unsigned long flags; @@ -6454,7 +6461,11 @@ static void blockio_exec_rw(struct vdisk_cmd_params *p, bool write, bool fua) #endif if (q) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) + max_nr_vecs = BIO_MAX_PAGES; +#else max_nr_vecs = min(bio_get_nr_vecs(bdev), BIO_MAX_PAGES); +#endif else max_nr_vecs = 1; @@ -6618,8 +6629,14 @@ finish_cmd: } #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) static void vdev_flush_end_io(struct bio *bio, int error) { +#else +static void vdev_flush_end_io(struct bio *bio) +{ + int error = bio->bi_error; +#endif struct scst_cmd *cmd = bio->bi_private; TRACE_ENTRY(); @@ -6720,10 +6737,15 @@ static void blockio_bio_destructor_sync(struct bio *bio) #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) static int blockio_end_sync_io(struct bio *bio, unsigned int bytes_done, int error) -#else -static void blockio_end_sync_io(struct bio *bio, int error) -#endif { +#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) +static void blockio_end_sync_io(struct bio *bio, int error) +{ +#else +static void blockio_end_sync_io(struct bio *bio) +{ + int error = bio->bi_error; +#endif struct bio_priv_sync *s = bio->bi_private; #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) @@ -6731,10 +6753,12 @@ static void blockio_end_sync_io(struct bio *bio, int error) return 1; #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) if (!bio_flagged(bio, BIO_UPTODATE) && error == 0) { PRINT_ERROR("Not up to date bio with error 0; returning -EIO"); error = -EIO; } +#endif s->error = error; complete(&s->c); @@ -6779,7 +6803,11 @@ static ssize_t blockio_rw_sync(struct scst_vdisk_dev *virt_dev, void *buf, bool submitted = false; #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) + max_nr_vecs = BIO_MAX_PAGES; +#else max_nr_vecs = min(bio_get_nr_vecs(bdev), BIO_MAX_PAGES); +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30) bio = bio_alloc_bioset(GFP_KERNEL, max_nr_vecs, virt_dev->vdisk_bioset); diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 53f2b71ca..a3b689a81 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -6858,8 +6858,14 @@ static void blk_free_kern_sg_work(struct blk_kern_sg_work *bw) return; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) static void blk_bio_map_kern_endio(struct bio *bio, int err) { +#else +static void blk_bio_map_kern_endio(struct bio *bio) +{ + int err = bio->bi_error; +#endif struct blk_kern_sg_work *bw = bio->bi_private; if (bw != NULL) { @@ -7467,7 +7473,12 @@ out_free_unmap: while (bio) { b = bio; bio = bio->bi_next; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) b->bi_end_io(b, res); +#else + b->bi_error = res; + b->bi_end_io(b); +#endif } } rq->bio = NULL;