diff --git a/iscsi-scst/kernel/isert-scst/iser_rdma.c b/iscsi-scst/kernel/isert-scst/iser_rdma.c index 10051f7cd..c97924d01 100644 --- a/iscsi-scst/kernel/isert-scst/iser_rdma.c +++ b/iscsi-scst/kernel/isert-scst/iser_rdma.c @@ -989,7 +989,8 @@ static struct isert_device *isert_device_create(struct ib_device *ib_dev) sizeof(*isert_dev->cq_qps), GFP_KERNEL); if (unlikely(isert_dev->cq_qps == NULL)) { - PRINT_ERROR("Failed to allocate iser cq_qps"); + PRINT_ERROR("Failed to allocate %d iser cq_qps", + isert_dev->num_cqs); err = -ENOMEM; goto free_isert_dev; } diff --git a/nightly/conf/nightly.conf b/nightly/conf/nightly.conf index 2af04cb1a..68d13337f 100644 --- a/nightly/conf/nightly.conf +++ b/nightly/conf/nightly.conf @@ -3,7 +3,8 @@ ABT_DETAILS="x86_64" ABT_JOBS=5 ABT_KERNELS=" \ -4.12.9 \ +4.13.4 \ +4.12.14-nc \ 4.11.12-nc \ 4.10.17-nc \ 4.9.45-nc \ diff --git a/scripts/generate-kernel-patch b/scripts/generate-kernel-patch index 672ea1a2a..c3221eaf0 100755 --- a/scripts/generate-kernel-patch +++ b/scripts/generate-kernel-patch @@ -272,6 +272,9 @@ done # General kernel patches. +scsi_exec_req_fifo_defined=0 +scst_io_context=0 + scst_03_public_headers="scst/include/scst.h scst/include/scst_const.h \ scst/include/scst_event.h scst/include/backport.h" scst_04_main="scst/src/scst_main.c scst/src/scst_module.c scst/src/scst_priv.h \ diff --git a/scripts/specialize-patch b/scripts/specialize-patch index 5cf79b948..942ae35f3 100755 --- a/scripts/specialize-patch +++ b/scripts/specialize-patch @@ -108,6 +108,10 @@ function evaluate(stmnt, pattern, arg, op, result) { gsub("defined\\(HAVE_IB_DMA_MAP_OPS\\)", "(LINUX_VERSION_CODE >= KERNEL_VERSION(0, 0, 0))", stmnt) + gsub("defined(ENABLE_NPIV)", 0, stmnt) + + gsub("defined(FC_VPORT_CREATE_DEFINED)", 0, stmnt) + gsub("LINUX_VERSION_CODE", LINUX_VERSION_CODE, stmnt) pattern="KERNEL_VERSION\\([[:blank:]]*([0-9]+)[[:blank:]]*,[[:blank:]]*([0-9]+)[[:blank:]]*,[[:blank:]]*([0-9]+)[[:blank:]]*\\)" @@ -122,6 +126,8 @@ function evaluate(stmnt, pattern, arg, op, result) { gsub("defined\\(CONFIG_SUSE_KERNEL\\)", "0", stmnt) + gsub("defined\\(CONFIG_SCST_STRICT_SERIALIZING\\)", "0", stmnt) + if (RHEL_MAJOR == "") { gsub("defined\\(RHEL_MAJOR\\)", "0", stmnt) @@ -337,6 +343,8 @@ function handle_if(evaluated) if ($0 ~ "LINUX_VERSION_CODE" \ || $0 ~ "CONFIG_SCST_PROC" \ || $0 ~ "CREATE_SEND_MAD_HAS_BASE_ARG" \ + || $0 ~ "ENABLE_NPIV" \ + || $0 ~ "FC_VPORT_CREATE_DEFINED" \ || $0 ~ "HAVE_IB_DMA_MAP_OPS" \ || $0 ~ "HAVE_IB_QUERY_DEVICE" \ || $0 ~ "HAVE_IB_SET_CPI_RESP_TIME" \ @@ -349,6 +357,7 @@ function handle_if(evaluated) || $0 ~ "IB_QUERY_GID_HAS_ATTR_ARG" \ || $0 ~ "INSIDE_KERNEL_TREE" \ || $0 ~ "MAD_HANDLER_TAKES_SEND_BUF" \ + || $0 ~ "CONFIG_SCST_STRICT_SERIALIZING" \ || $0 ~ "MOFED_MAJOR" \ || $0 ~ "RDMA_CREATE_ID_TAKES_NET_ARG" \ || $0 ~ "REGISTER_MAD_AGENT_HAS_FLAGS_ARG" \ diff --git a/scst/include/backport.h b/scst/include/backport.h index 6f67ec001..c7fd7909f 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -20,6 +20,7 @@ * GNU General Public License for more details. */ +#include #include /* struct request_queue */ #include /* struct scatterlist */ #include /* kmalloc() */ @@ -45,6 +46,19 @@ #endif #endif +/* */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) +static inline struct bio_set *bioset_create_backport(unsigned int pool_size, + unsigned int front_pad, + int flags) +{ + WARN_ON_ONCE(flags != 0); + return bioset_create(pool_size, front_pad); +} +#define bioset_create bioset_create_backport +#endif + /* */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31) diff --git a/scst/include/scst.h b/scst/include/scst.h index bac87224d..4d0c18db1 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -5495,6 +5495,7 @@ void scst_dev_inquiry_data_changed(struct scst_device *dev); * allows exclusive wake ups of threads in LIFO order. We need it to let (yet) * unneeded threads sleep and not pollute CPU cache by their stacks. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) static inline void prepare_to_wait_exclusive_head(wait_queue_head_t *q, wait_queue_t *wait, int state) { @@ -5507,6 +5508,20 @@ static inline void prepare_to_wait_exclusive_head(wait_queue_head_t *q, set_current_state(state); spin_unlock_irqrestore(&q->lock, flags); } +#else +static inline void prepare_to_wait_exclusive_head(struct wait_queue_head *wq_head, + struct wait_queue_entry *wq_entry, int state) +{ + unsigned long flags; + + wq_entry->flags |= WQ_FLAG_EXCLUSIVE; + spin_lock_irqsave(&wq_head->lock, flags); + if (list_empty(&wq_entry->entry)) + __add_wait_queue(wq_head, wq_entry); + set_current_state(state); + spin_unlock_irqrestore(&wq_head->lock, flags); +} +#endif /** * wait_event_locked() - Wait until a condition becomes true. diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index c19eb50e8..e621cf115 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -6563,7 +6563,11 @@ static void blockio_endio(struct bio *bio, int error) #else static void blockio_endio(struct bio *bio) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) int error = bio->bi_error; +#else + int error = blk_status_to_errno(bio->bi_status); +#endif #endif struct scst_blockio_work *blockio_work = bio->bi_private; @@ -7039,7 +7043,11 @@ static void vdev_flush_end_io(struct bio *bio, int error) #else static void vdev_flush_end_io(struct bio *bio) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) int error = bio->bi_error; +#else + int error = blk_status_to_errno(bio->bi_status); +#endif #endif struct scst_cmd *cmd = bio->bi_private; @@ -7155,7 +7163,11 @@ static void blockio_end_sync_io(struct bio *bio, int error) #else static void blockio_end_sync_io(struct bio *bio) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) int error = bio->bi_error; +#else + int error = blk_status_to_errno(bio->bi_status); +#endif #endif struct bio_priv_sync *s = bio->bi_private; @@ -7788,7 +7800,7 @@ static int vdisk_create_bioset(struct scst_vdisk_dev *virt_dev) EXTRACHECKS_BUG_ON(virt_dev->vdisk_bioset || !virt_dev->blockio); /* Pool size doesn't really matter */ - virt_dev->vdisk_bioset = bioset_create(2, 0); + virt_dev->vdisk_bioset = bioset_create(2, 0, 0); if (virt_dev->vdisk_bioset == NULL) { PRINT_ERROR("Failed to create bioset (dev %s)", virt_dev->name); res = -ENOMEM; diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 5e394d01e..51ec8d5e2 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -7809,7 +7809,11 @@ static void blk_bio_map_kern_endio(struct bio *bio, int err) #else static void blk_bio_map_kern_endio(struct bio *bio) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) int err = bio->bi_error; +#else + int err = blk_status_to_errno(bio->bi_status); +#endif #endif struct blk_kern_sg_work *bw = bio->bi_private; @@ -7961,22 +7965,33 @@ static struct request *blk_make_request(struct request_queue *q, if (IS_ERR(rq)) return rq; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) + scsi_req_init(scsi_req(rq)); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) scsi_req_init(rq); #else blk_rq_set_block_pc(rq); #endif for_each_bio(bio) { - struct bio *bounce_bio = bio; int ret; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) + struct bio *bounce_bio = bio; + blk_queue_bounce(q, &bounce_bio); ret = blk_rq_append_bio(rq, bounce_bio); if (unlikely(ret)) { blk_put_request(rq); return ERR_PTR(ret); } +#else + ret = blk_rq_append_bio(rq, bio); + if (unlikely(ret)) { + blk_put_request(rq); + return ERR_PTR(ret); + } +#endif } return rq; @@ -8175,7 +8190,9 @@ static struct request *blk_map_kern_sg(struct request_queue *q, if (unlikely(!rq)) return ERR_PTR(-ENOMEM); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) + scsi_req_init(scsi_req(rq)); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) scsi_req_init(rq); #else rq->cmd_type = REQ_TYPE_BLOCK_PC; @@ -8361,7 +8378,11 @@ out: #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) static void scsi_end_async(struct request *req, int error) +#else +static void scsi_end_async(struct request *req, blk_status_t error) +#endif { struct scsi_io_context *sioc = req->end_io_data; int result; @@ -8520,7 +8541,11 @@ out_free_unmap: #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) b->bi_end_io(b, res); #else +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) b->bi_error = res; +#else + b->bi_status = errno_to_blk_status(res); +#endif b->bi_end_io(b); #endif }