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; 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 \ 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 53bf79b71..333e1968f 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/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 3bdff95db..d854f08f5 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -6214,10 +6214,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) @@ -6225,6 +6230,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 " @@ -6232,6 +6238,7 @@ static void blockio_endio(struct bio *bio, int error) error = -EIO; } } +#endif if (unlikely(error != 0)) { unsigned long flags; @@ -6482,7 +6489,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; @@ -6651,8 +6662,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(); @@ -6753,10 +6770,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) @@ -6764,10 +6786,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); @@ -6812,7 +6836,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 5ce89413a..face5bba3 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -7030,8 +7030,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) { @@ -7645,7 +7651,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; diff --git a/scst/src/scst_tg.c b/scst/src/scst_tg.c index be84d62c7..3dc891a7a 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) { @@ -291,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. */ @@ -321,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, diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 3a65eb082..3405bbdfb 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; 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;