diff options
8 files changed, 0 insertions, 1194 deletions
diff --git a/meta-networking/recipes-extended/iscsitarget/files/0001-kernel-event-netlink_ack-now-requires-4-arguments.patch b/meta-networking/recipes-extended/iscsitarget/files/0001-kernel-event-netlink_ack-now-requires-4-arguments.patch deleted file mode 100644 index 4426d3552d..0000000000 --- a/meta-networking/recipes-extended/iscsitarget/files/0001-kernel-event-netlink_ack-now-requires-4-arguments.patch +++ /dev/null | |||
| @@ -1,40 +0,0 @@ | |||
| 1 | From cbc5f8151017f45231b75a826f18354a81c287c4 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sat, 26 Aug 2017 07:52:59 -0700 | ||
| 4 | Subject: [PATCH] kernel/event: netlink_ack() now requires 4 arguments | ||
| 5 | |||
| 6 | see https://patchwork.kernel.org/patch/9670181/ | ||
| 7 | |||
| 8 | event.c:32:4: error: too few arguments to function 'netlink_ack' | ||
| 9 | | netlink_ack(skb, nlh, 0); | ||
| 10 | | ^~~~~~~~~~~ | ||
| 11 | |||
| 12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 13 | --- | ||
| 14 | kernel/event.c | 2 +- | ||
| 15 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 16 | |||
| 17 | Index: iscsitarget-1.4.20.3+svn502/kernel/event.c | ||
| 18 | =================================================================== | ||
| 19 | --- iscsitarget-1.4.20.3+svn502.orig/kernel/event.c | ||
| 20 | +++ iscsitarget-1.4.20.3+svn502/kernel/event.c | ||
| 21 | @@ -6,6 +6,7 @@ | ||
| 22 | * Some functions are based on audit code. | ||
| 23 | */ | ||
| 24 | |||
| 25 | +#include <linux/version.h> | ||
| 26 | #include <linux/module.h> | ||
| 27 | #include <net/tcp.h> | ||
| 28 | #include "iet_u.h" | ||
| 29 | @@ -29,7 +30,11 @@ static void event_recv_skb(struct sk_buf | ||
| 30 | ietd_pid = NETLINK_CB(skb).portid; | ||
| 31 | WARN_ON(ietd_pid == 0); | ||
| 32 | if (nlh->nlmsg_flags & NLM_F_ACK) | ||
| 33 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) | ||
| 34 | + netlink_ack(skb, nlh, 0, NULL); | ||
| 35 | +#else | ||
| 36 | netlink_ack(skb, nlh, 0); | ||
| 37 | +#endif | ||
| 38 | skb_pull(skb, rlen); | ||
| 39 | } | ||
| 40 | } | ||
diff --git a/meta-networking/recipes-extended/iscsitarget/files/access-sk_v6_daddr-iff-IPV6-defined.patch b/meta-networking/recipes-extended/iscsitarget/files/access-sk_v6_daddr-iff-IPV6-defined.patch deleted file mode 100644 index 4444234b2e..0000000000 --- a/meta-networking/recipes-extended/iscsitarget/files/access-sk_v6_daddr-iff-IPV6-defined.patch +++ /dev/null | |||
| @@ -1,28 +0,0 @@ | |||
| 1 | The element skc_v6_daddr (in struct sock_common) is defined in | ||
| 2 | kernel source only when CONFIG_IPV6 is enabled. Hence, access | ||
| 3 | sk_v6_daddr element (i.e __sk_common.skc_v6_daddr) only when CONFIG_IPV6 | ||
| 4 | is defined; to fix below error in world build: | ||
| 5 | |||
| 6 | -- snip -- | ||
| 7 | /home/jenkins/oe/world/shr-core/tmp-glibc/work-shared/qemux86/kernel-source/include/net/sock.h:330:33: error: 'struct sock_common' has no member named 'skc_v6_daddr' | ||
| 8 | -- CUT -- | ||
| 9 | |||
| 10 | Upstream-Status: Pending | ||
| 11 | |||
| 12 | Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa@mvista.com> | ||
| 13 | |||
| 14 | --- iscsitarget-1.4.20.3+svn502_org/kernel/conn.c 2015-12-29 21:57:50.547932217 -0800 | ||
| 15 | +++ iscsitarget-1.4.20.3+svn502/kernel/conn.c 2015-12-29 22:47:25.254657627 -0800 | ||
| 16 | @@ -46,10 +46,12 @@ void conn_info_show(struct seq_file *seq | ||
| 17 | snprintf(buf, sizeof(buf), | ||
| 18 | "%pI4", &inet_sk(sk)->inet_daddr); | ||
| 19 | break; | ||
| 20 | +#if defined(CONFIG_IPV6) | ||
| 21 | case AF_INET6: | ||
| 22 | snprintf(buf, sizeof(buf), "[%pI6]", | ||
| 23 | &(sk)->sk_v6_daddr); | ||
| 24 | break; | ||
| 25 | +#endif /* defined(CONFIG_IPV6) */ | ||
| 26 | default: | ||
| 27 | break; | ||
| 28 | } | ||
diff --git a/meta-networking/recipes-extended/iscsitarget/files/build_with_updated_bio_struct_of_linux_v4.3_and_above.patch b/meta-networking/recipes-extended/iscsitarget/files/build_with_updated_bio_struct_of_linux_v4.3_and_above.patch deleted file mode 100644 index bce38baee5..0000000000 --- a/meta-networking/recipes-extended/iscsitarget/files/build_with_updated_bio_struct_of_linux_v4.3_and_above.patch +++ /dev/null | |||
| @@ -1,108 +0,0 @@ | |||
| 1 | Description: Fix source to compile with 4.3+ kernels | ||
| 2 | commit 4246a0b63bd8f56a1469b12eafeb875b1041a451 | ||
| 3 | block: add a bi_error field to struct bio | ||
| 4 | -> Removes BIO_UPTODATE and error argument to bio_endio. | ||
| 5 | commit b54ffb73cadcdcff9cc1ae0e11f502407e3e2e4c | ||
| 6 | block: remove bio_get_nr_vecs() | ||
| 7 | -> Removed that call (always use BIO_MAX_PAGES) | ||
| 8 | commit 676d23690fb62b5d51ba5d659935e9f7d9da9f8e | ||
| 9 | net: Fix use after free by removing length arg from sk_data_ready callbacks. | ||
| 10 | -> Removes len argument from sk_data_ready() callback. | ||
| 11 | Author: Stefan Bader <stefan.bader@canonical.com> | ||
| 12 | |||
| 13 | The original patch is at http://launchpadlibrarian.net/227478885/iscsitarget_1.4.20.3+svn502-2ubuntu2_1.4.20.3+svn502-2ubuntu3.diff.gz, | ||
| 14 | those changes were taken using #ifs to allow compilation of iscsitarget | ||
| 15 | package with kernel versions < 4.3. | ||
| 16 | |||
| 17 | Upstream-Status: Submitted [http://launchpadlibrarian.net/227478885/iscsitarget_1.4.20.3+svn502-2ubuntu2_1.4.20.3+svn502-2ubuntu3.diff.gz] | ||
| 18 | |||
| 19 | Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa@mvista.com> | ||
| 20 | |||
| 21 | diff -Naurp iscsitarget-1.4.20.3+svn502_org/kernel/block-io.c iscsitarget-1.4.20.3+svn502/kernel/block-io.c | ||
| 22 | --- iscsitarget-1.4.20.3+svn502_org/kernel/block-io.c 2014-05-06 13:59:55.000000000 -0700 | ||
| 23 | +++ iscsitarget-1.4.20.3+svn502/kernel/block-io.c 2017-01-19 00:46:28.263951115 -0800 | ||
| 24 | @@ -29,14 +29,23 @@ struct tio_work { | ||
| 25 | struct completion tio_complete; | ||
| 26 | }; | ||
| 27 | |||
| 28 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) | ||
| 29 | +static void blockio_bio_endio(struct bio *bio) | ||
| 30 | +#else | ||
| 31 | static void blockio_bio_endio(struct bio *bio, int error) | ||
| 32 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) */ | ||
| 33 | { | ||
| 34 | struct tio_work *tio_work = bio->bi_private; | ||
| 35 | |||
| 36 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) | ||
| 37 | + if (bio->bi_error) | ||
| 38 | + atomic_set(&tio_work->error, bio->bi_error); | ||
| 39 | +#else | ||
| 40 | error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? error : -EIO; | ||
| 41 | |||
| 42 | if (error) | ||
| 43 | atomic_set(&tio_work->error, error); | ||
| 44 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) */ | ||
| 45 | |||
| 46 | /* If last bio signal completion */ | ||
| 47 | if (atomic_dec_and_test(&tio_work->bios_remaining)) | ||
| 48 | @@ -61,14 +70,20 @@ blockio_make_request(struct iet_volume * | ||
| 49 | u32 size = tio->size; | ||
| 50 | u32 tio_index = 0; | ||
| 51 | |||
| 52 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) | ||
| 53 | + int max_pages = bdev_q ? BIO_MAX_PAGES : 1; | ||
| 54 | +#else | ||
| 55 | int max_pages = 1; | ||
| 56 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) */ | ||
| 57 | int err = 0; | ||
| 58 | |||
| 59 | loff_t ppos = tio->offset; | ||
| 60 | |||
| 61 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) | ||
| 62 | /* Calculate max_pages for bio_alloc (memory saver) */ | ||
| 63 | if (bdev_q) | ||
| 64 | max_pages = bio_get_nr_vecs(bio_data->bdev); | ||
| 65 | +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) */ | ||
| 66 | |||
| 67 | tio_work = kzalloc(sizeof (*tio_work), GFP_KERNEL); | ||
| 68 | if (!tio_work) | ||
| 69 | diff -Naurp iscsitarget-1.4.20.3+svn502_org/kernel/conn.c iscsitarget-1.4.20.3+svn502/kernel/conn.c | ||
| 70 | --- iscsitarget-1.4.20.3+svn502_org/kernel/conn.c 2017-01-19 00:39:09.737117778 -0800 | ||
| 71 | +++ iscsitarget-1.4.20.3+svn502/kernel/conn.c 2017-01-19 00:52:30.037223901 -0800 | ||
| 72 | @@ -89,13 +89,21 @@ static void iet_state_change(struct sock | ||
| 73 | target->nthread_info.old_state_change(sk); | ||
| 74 | } | ||
| 75 | |||
| 76 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) | ||
| 77 | +static void iet_data_ready(struct sock *sk) | ||
| 78 | +#else | ||
| 79 | static void iet_data_ready(struct sock *sk, int len) | ||
| 80 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) */ | ||
| 81 | { | ||
| 82 | struct iscsi_conn *conn = sk->sk_user_data; | ||
| 83 | struct iscsi_target *target = conn->session->target; | ||
| 84 | |||
| 85 | nthread_wakeup(target); | ||
| 86 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) | ||
| 87 | + target->nthread_info.old_data_ready(sk); | ||
| 88 | +#else | ||
| 89 | target->nthread_info.old_data_ready(sk, len); | ||
| 90 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) */ | ||
| 91 | } | ||
| 92 | |||
| 93 | /* | ||
| 94 | diff -Naurp iscsitarget-1.4.20.3+svn502_org/kernel/iscsi.h iscsitarget-1.4.20.3+svn502/kernel/iscsi.h | ||
| 95 | --- iscsitarget-1.4.20.3+svn502_org/kernel/iscsi.h 2014-05-06 13:59:55.000000000 -0700 | ||
| 96 | +++ iscsitarget-1.4.20.3+svn502/kernel/iscsi.h 2017-01-19 00:48:02.102837260 -0800 | ||
| 97 | @@ -81,7 +81,11 @@ struct network_thread_info { | ||
| 98 | spinlock_t nthread_lock; | ||
| 99 | |||
| 100 | void (*old_state_change)(struct sock *); | ||
| 101 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) | ||
| 102 | + void (*old_data_ready)(struct sock *); | ||
| 103 | +#else | ||
| 104 | void (*old_data_ready)(struct sock *, int); | ||
| 105 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) */ | ||
| 106 | void (*old_write_space)(struct sock *); | ||
| 107 | }; | ||
| 108 | |||
diff --git a/meta-networking/recipes-extended/iscsitarget/files/build_with_updated_interfaces_of_linux_v4.8_and_above.patch b/meta-networking/recipes-extended/iscsitarget/files/build_with_updated_interfaces_of_linux_v4.8_and_above.patch deleted file mode 100644 index e508a5e6cd..0000000000 --- a/meta-networking/recipes-extended/iscsitarget/files/build_with_updated_interfaces_of_linux_v4.8_and_above.patch +++ /dev/null | |||
| @@ -1,475 +0,0 @@ | |||
| 1 | Resolve build error with linux kernel 4.8 | ||
| 2 | |||
| 3 | The below changes in kernel source, triggered iscsitarget | ||
| 4 | build fail with linux kernel v4.8. | ||
| 5 | |||
| 6 | 1. An extra 'flags' argument has been passed to vfs_readv/vfs_writev | ||
| 7 | syscalls in v4.8. So, set this argument to "0" for now | ||
| 8 | (as there is no real need for that). | ||
| 9 | Ref: https://github.com/torvalds/linux/commit/793b80ef14af56d20c998265287648ad34239b6f | ||
| 10 | Solves: | ||
| 11 | -- snip -- | ||
| 12 | TOPDIR/tmp-glibc/work/qemux86-oe-linux/iscsitarget/1.4.20.3+svn502-r0/iscsitarget-1.4.20.3+svn502/kernel/nthread.c: In function 'write_data': | ||
| 13 | TOPDIR/tmp-glibc/work/qemux86-oe-linux/iscsitarget/1.4.20.3+svn502-r0/iscsitarget-1.4.20.3+svn502/kernel/nthread.c:350:9: error: too few arguments to function 'vfs_writev' | ||
| 14 | res = vfs_writev(file, (struct iovec __user *) iop, count, &off); | ||
| 15 | ^~~~~~~~~~ | ||
| 16 | -- snip -- | ||
| 17 | |||
| 18 | 2. Redefine dropped PAGE_CACHE_* and page_cache_{get,release} definitions, | ||
| 19 | as they have been dropped with v4.8 | ||
| 20 | Ref: https://github.com/torvalds/linux/commit/1fa64f198b9f8d6ec0f7aec7c18dc94684391140 | ||
| 21 | Solves: | ||
| 22 | -- snip -- | ||
| 23 | TOPDIR/tmp-glibc/work/qemux86-oe-linux/iscsitarget/1.4.20.3+svn502-r0/iscsitarget-1.4.20.3+svn502/kernel/param.c: In function 'sess_param_check': | ||
| 24 | TOPDIR/tmp-glibc/work/qemux86-oe-linux/iscsitarget/1.4.20.3+svn502-r0/iscsitarget-1.4.20.3+svn502/kernel/param.c:48:41: error: 'PAGE_CACHE_SIZE' undeclared (first use in this function) | ||
| 25 | (u32) ((ISCSI_CONN_IOV_MAX - 1) * PAGE_CACHE_SIZE)); | ||
| 26 | ^ | ||
| 27 | -- snip -- | ||
| 28 | |||
| 29 | 3. Replace crypto_hash interfaces with crypto_ahash interfaces, | ||
| 30 | Ref: https://github.com/torvalds/linux/commit/896545098777564212b9e91af4c973f094649aa7 | ||
| 31 | Ref: https://www.redhat.com/archives/dm-devel/2016-January/msg00244.html | ||
| 32 | Solves: | ||
| 33 | -- snip -- | ||
| 34 | TOPDIR/tmp-glibc/work/qemux86-oe-linux/iscsitarget/1.4.20.3+svn502-r0/iscsitarget-1.4.20.3+svn502/kernel/digest.c: In function 'digest_init': | ||
| 35 | TOPDIR/tmp-glibc/work/qemux86-oe-linux/iscsitarget/1.4.20.3+svn502-r0/iscsitarget-1.4.20.3+svn502/kernel/digest.c:42:23: error: implicit declaration of function 'crypto_alloc_hash' [-Werror=implicit-function-declaration] | ||
| 36 | conn->rx_hash.tfm = crypto_alloc_hash("crc32c", 0, | ||
| 37 | ^~~~~~~~~~~~~~~~~ | ||
| 38 | TOPDIR/tmp-glibc/work/qemux86-oe-linux/iscsitarget/1.4.20.3+svn502-r0/iscsitarget-1.4.20.3+svn502/kernel/digest.c: In function 'digest_cleanup': | ||
| 39 | TOPDIR/tmp-glibc/work/qemux86-oe-linux/iscsitarget/1.4.20.3+svn502-r0/iscsitarget-1.4.20.3+svn502/kernel/digest.c:77:3: error: implicit declaration of function 'crypto_free_hash' [-Werror=implicit-function-declaration] | ||
| 40 | crypto_free_hash(conn->tx_hash.tfm); | ||
| 41 | ^~~~~~~~~~~~~~~~ | ||
| 42 | -- snip -- | ||
| 43 | |||
| 44 | 4. The earlier "rw" parameter has been set in "bi_rw" within | ||
| 45 | bio structure, hence remove "rw" argument. | ||
| 46 | Ref: https://github.com/torvalds/linux/commit/4e49ea4a3d276365bf7396c9b77b4d1d5923835a | ||
| 47 | Solves: | ||
| 48 | -- snip -- | ||
| 49 | TOPDIR/tmp-glibc/work/qemux86-oe-linux/iscsitarget/1.4.20.3+svn502-r0/iscsitarget-1.4.20.3+svn502/kernel/block-io.c:140:14: warning: passing argument 1 of 'submit_bio' makes pointer from integer without a cast [-Wint-conversion] | ||
| 50 | submit_bio(rw, bio); | ||
| 51 | ^~ | ||
| 52 | -- snip -- | ||
| 53 | |||
| 54 | 5. The 'len' argument from sk_data_ready() callback has been removed in | ||
| 55 | linux kernel v4.3 and above. | ||
| 56 | Ref: https://github.com/torvalds/linux/commit/676d23690fb62b5d51ba5d659935e9f7d9da9f8e | ||
| 57 | Solves: | ||
| 58 | -- snip -- | ||
| 59 | TOPDIR/tmp-glibc/work/qemux86-oe-linux/iscsitarget/1.4.20.3+svn502-r0/iscsitarget-1.4.20.3+svn502/kernel/conn.c: In function 'iet_socket_bind': | ||
| 60 | TOPDIR/tmp-glibc/work/qemux86-oe-linux/iscsitarget/1.4.20.3+svn502-r0/iscsitarget-1.4.20.3+svn502/kernel/conn.c:143:38: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types] | ||
| 61 | target->nthread_info.old_data_ready = conn->sock->sk->sk_data_ready; | ||
| 62 | ^ | ||
| 63 | TOPDIR/tmp-glibc/work/qemux86-oe-linux/iscsitarget/1.4.20.3+svn502-r0/iscsitarget-1.4.20.3+svn502/kernel/conn.c:144:32: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types] | ||
| 64 | conn->sock->sk->sk_data_ready = iet_data_ready; | ||
| 65 | ^ | ||
| 66 | -- snip -- | ||
| 67 | |||
| 68 | 6. | ||
| 69 | A. The "size" argument has been dropped from sock_recvmsg syscall in v4.8, | ||
| 70 | as all callers have it equal to msg_data_left(msg). | ||
| 71 | B. 'struct user_msghdr' is being used for userland-side msghdr instead | ||
| 72 | of 'struct msghdr', which is used for kernel-side msghdr in linux v3.19 | ||
| 73 | and above, so typecase it while calling sock_recvmsg syscall. | ||
| 74 | Ref: https://github.com/torvalds/linux/commit/2da62906b1e298695e1bb725927041cd59942c98 | ||
| 75 | https://github.com/torvalds/linux/commit/666547ff591cebdedc4679bf6b1b3f3383a8dea3 | ||
| 76 | Solves: | ||
| 77 | -- snip -- | ||
| 78 | TOPDIR/tmp-glibc/work-shared/qemux86/kernel-source/include/linux/net.h:222:5: note: expected 'struct msghdr *' but argument is of type 'struct user_msghdr *' | ||
| 79 | int sock_recvmsg(struct socket *sock, struct msghdr *msg, int flags); | ||
| 80 | ^~~~~~~~~~~~ | ||
| 81 | TOPDIR/tmp-glibc/work/qemux86-oe-linux/iscsitarget/1.4.20.3+svn502-r0/iscsitarget-1.4.20.3+svn502/kernel/nthread.c:129:8: error: too many arguments to function 'sock_recvmsg' | ||
| 82 | res = sock_recvmsg(conn->sock, &msg, len, MSG_DONTWAIT | MSG_NOSIGNAL); | ||
| 83 | ^~~~~~~~~~~~ | ||
| 84 | -- snip -- | ||
| 85 | |||
| 86 | Detailed error log is at: http://errors.yoctoproject.org/Errors/Details/83334/ | ||
| 87 | |||
| 88 | Upstream-Status: Pending | ||
| 89 | |||
| 90 | Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa@mvista.com> | ||
| 91 | |||
| 92 | diff -Naurp iscsitarget-1.4.20.3+svn502_org/kernel/block-io.c iscsitarget-1.4.20.3+svn502/kernel/block-io.c | ||
| 93 | --- iscsitarget-1.4.20.3+svn502_org/kernel/block-io.c 2017-01-19 20:19:27.400507354 -0800 | ||
| 94 | +++ iscsitarget-1.4.20.3+svn502/kernel/block-io.c 2017-01-19 20:32:22.977988593 -0800 | ||
| 95 | @@ -104,7 +104,11 @@ blockio_make_request(struct iet_volume * | ||
| 96 | /* bi_sector is ALWAYS in units of 512 bytes */ | ||
| 97 | bio->bi_iter.bi_sector = ppos >> 9; | ||
| 98 | bio->bi_bdev = bio_data->bdev; | ||
| 99 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 100 | + bio->bi_end_io = (bio_end_io_t *) blockio_bio_endio; | ||
| 101 | +#else | ||
| 102 | bio->bi_end_io = blockio_bio_endio; | ||
| 103 | +#endif | ||
| 104 | bio->bi_private = tio_work; | ||
| 105 | |||
| 106 | if (tio_bio) | ||
| 107 | @@ -139,7 +143,12 @@ blockio_make_request(struct iet_volume * | ||
| 108 | tio_bio = tio_bio->bi_next; | ||
| 109 | bio->bi_next = NULL; | ||
| 110 | |||
| 111 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 112 | + bio_set_op_attrs(bio, REQ_OP_WRITE, 0); | ||
| 113 | + submit_bio(bio); | ||
| 114 | +#else | ||
| 115 | submit_bio(rw, bio); | ||
| 116 | +#endif | ||
| 117 | } | ||
| 118 | |||
| 119 | blk_finish_plug(&plug); | ||
| 120 | diff -Naurp iscsitarget-1.4.20.3+svn502_org/kernel/conn.c iscsitarget-1.4.20.3+svn502/kernel/conn.c | ||
| 121 | --- iscsitarget-1.4.20.3+svn502_org/kernel/conn.c 2017-01-19 20:19:27.400507354 -0800 | ||
| 122 | +++ iscsitarget-1.4.20.3+svn502/kernel/conn.c 2017-01-19 20:32:22.978988614 -0800 | ||
| 123 | @@ -148,8 +148,14 @@ static void iet_socket_bind(struct iscsi | ||
| 124 | target->nthread_info.old_state_change = conn->sock->sk->sk_state_change; | ||
| 125 | conn->sock->sk->sk_state_change = iet_state_change; | ||
| 126 | |||
| 127 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 128 | + target->nthread_info.old_data_ready = (void (*) (struct sock *)) \ | ||
| 129 | + conn->sock->sk->sk_data_ready; | ||
| 130 | + conn->sock->sk->sk_data_ready = (void (*) (struct sock *)) iet_data_ready; | ||
| 131 | +#else | ||
| 132 | target->nthread_info.old_data_ready = conn->sock->sk->sk_data_ready; | ||
| 133 | conn->sock->sk->sk_data_ready = iet_data_ready; | ||
| 134 | +#endif | ||
| 135 | |||
| 136 | target->nthread_info.old_write_space = conn->sock->sk->sk_write_space; | ||
| 137 | conn->sock->sk->sk_write_space = iet_write_space; | ||
| 138 | diff -Naurp iscsitarget-1.4.20.3+svn502_org/kernel/digest.c iscsitarget-1.4.20.3+svn502/kernel/digest.c | ||
| 139 | --- iscsitarget-1.4.20.3+svn502_org/kernel/digest.c 2014-05-06 13:59:55.000000000 -0700 | ||
| 140 | +++ iscsitarget-1.4.20.3+svn502/kernel/digest.c 2017-01-19 20:32:22.978988614 -0800 | ||
| 141 | @@ -30,6 +30,9 @@ void digest_alg_available(unsigned int * | ||
| 142 | int digest_init(struct iscsi_conn *conn) | ||
| 143 | { | ||
| 144 | int err = 0; | ||
| 145 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 146 | + struct crypto_ahash *tfm; | ||
| 147 | +#endif | ||
| 148 | |||
| 149 | if (!(conn->hdigest_type & DIGEST_ALL)) | ||
| 150 | conn->hdigest_type = DIGEST_NONE; | ||
| 151 | @@ -39,15 +42,40 @@ int digest_init(struct iscsi_conn *conn) | ||
| 152 | |||
| 153 | if (conn->hdigest_type & DIGEST_CRC32C || | ||
| 154 | conn->ddigest_type & DIGEST_CRC32C) { | ||
| 155 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 156 | + tfm = crypto_alloc_ahash("crc32c", 0, CRYPTO_ALG_ASYNC); | ||
| 157 | + if (IS_ERR(tfm)) { | ||
| 158 | + tfm = NULL; | ||
| 159 | +#else | ||
| 160 | conn->rx_hash.tfm = crypto_alloc_hash("crc32c", 0, | ||
| 161 | CRYPTO_ALG_ASYNC); | ||
| 162 | conn->rx_hash.flags = 0; | ||
| 163 | if (IS_ERR(conn->rx_hash.tfm)) { | ||
| 164 | conn->rx_hash.tfm = NULL; | ||
| 165 | +#endif | ||
| 166 | err = -ENOMEM; | ||
| 167 | goto out; | ||
| 168 | } | ||
| 169 | - | ||
| 170 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 171 | + conn->rx_hash = ahash_request_alloc(tfm, GFP_KERNEL); | ||
| 172 | + if (!conn->rx_hash) { | ||
| 173 | + pr_err("ahash_request_alloc() failed for conn->rx_hash\n"); | ||
| 174 | + crypto_free_ahash(tfm); | ||
| 175 | + err = -ENOMEM; | ||
| 176 | + goto out; | ||
| 177 | + } | ||
| 178 | + ahash_request_set_callback(conn->rx_hash, 0, NULL, NULL); | ||
| 179 | + conn->tx_hash = ahash_request_alloc(tfm, GFP_KERNEL); | ||
| 180 | + if(!conn->tx_hash) { | ||
| 181 | + pr_err("ahash_request_alloc() failed for conn->tx_hash\n"); | ||
| 182 | + ahash_request_free(conn->rx_hash); | ||
| 183 | + conn->rx_hash = NULL; | ||
| 184 | + crypto_free_ahash(tfm); | ||
| 185 | + err = -ENOMEM; | ||
| 186 | + goto out; | ||
| 187 | + } | ||
| 188 | + ahash_request_set_callback(conn->tx_hash, 0, NULL, NULL); | ||
| 189 | +#else | ||
| 190 | conn->tx_hash.tfm = crypto_alloc_hash("crc32c", 0, | ||
| 191 | CRYPTO_ALG_ASYNC); | ||
| 192 | conn->tx_hash.flags = 0; | ||
| 193 | @@ -56,6 +84,7 @@ int digest_init(struct iscsi_conn *conn) | ||
| 194 | err = -ENOMEM; | ||
| 195 | goto out; | ||
| 196 | } | ||
| 197 | +#endif | ||
| 198 | } | ||
| 199 | |||
| 200 | out: | ||
| 201 | @@ -73,10 +102,21 @@ out: | ||
| 202 | */ | ||
| 203 | void digest_cleanup(struct iscsi_conn *conn) | ||
| 204 | { | ||
| 205 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 206 | + ahash_request_free(conn->tx_hash); | ||
| 207 | + if (conn->rx_hash) { | ||
| 208 | + struct crypto_ahash *tfm; | ||
| 209 | + tfm = crypto_ahash_reqtfm(conn->rx_hash); | ||
| 210 | + ahash_request_free(conn->rx_hash); | ||
| 211 | + crypto_free_ahash(tfm); | ||
| 212 | + } | ||
| 213 | + | ||
| 214 | +#else | ||
| 215 | if (conn->tx_hash.tfm) | ||
| 216 | crypto_free_hash(conn->tx_hash.tfm); | ||
| 217 | if (conn->rx_hash.tfm) | ||
| 218 | crypto_free_hash(conn->rx_hash.tfm); | ||
| 219 | +#endif | ||
| 220 | } | ||
| 221 | |||
| 222 | /** | ||
| 223 | @@ -160,8 +200,13 @@ static inline void __dbg_simulate_data_d | ||
| 224 | } | ||
| 225 | } | ||
| 226 | |||
| 227 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 228 | +static void digest_header(struct ahash_request *hash, struct iscsi_pdu *pdu, | ||
| 229 | + u8 *crc) | ||
| 230 | +#else | ||
| 231 | static void digest_header(struct hash_desc *hash, struct iscsi_pdu *pdu, | ||
| 232 | u8 *crc) | ||
| 233 | +#endif | ||
| 234 | { | ||
| 235 | struct scatterlist sg[2]; | ||
| 236 | unsigned int nbytes = sizeof(struct iscsi_hdr); | ||
| 237 | @@ -174,16 +219,27 @@ static void digest_header(struct hash_de | ||
| 238 | nbytes += pdu->ahssize; | ||
| 239 | } | ||
| 240 | |||
| 241 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 242 | + crypto_ahash_init(hash); | ||
| 243 | + ahash_request_set_crypt(hash, sg, crc, nbytes); | ||
| 244 | + crypto_ahash_update(hash); | ||
| 245 | + crypto_ahash_digest(hash); | ||
| 246 | +#else | ||
| 247 | crypto_hash_init(hash); | ||
| 248 | crypto_hash_update(hash, sg, nbytes); | ||
| 249 | crypto_hash_final(hash, crc); | ||
| 250 | +#endif | ||
| 251 | } | ||
| 252 | |||
| 253 | int digest_rx_header(struct iscsi_cmnd *cmnd) | ||
| 254 | { | ||
| 255 | u32 crc; | ||
| 256 | |||
| 257 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 258 | + digest_header(cmnd->conn->rx_hash, &cmnd->pdu, (u8 *) &crc); | ||
| 259 | +#else | ||
| 260 | digest_header(&cmnd->conn->rx_hash, &cmnd->pdu, (u8 *) &crc); | ||
| 261 | +#endif | ||
| 262 | if (crc != cmnd->hdigest) | ||
| 263 | return -EIO; | ||
| 264 | |||
| 265 | @@ -192,11 +248,20 @@ int digest_rx_header(struct iscsi_cmnd * | ||
| 266 | |||
| 267 | void digest_tx_header(struct iscsi_cmnd *cmnd) | ||
| 268 | { | ||
| 269 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 270 | + digest_header(cmnd->conn->tx_hash, &cmnd->pdu, (u8 *) &cmnd->hdigest); | ||
| 271 | +#else | ||
| 272 | digest_header(&cmnd->conn->tx_hash, &cmnd->pdu, (u8 *) &cmnd->hdigest); | ||
| 273 | +#endif | ||
| 274 | } | ||
| 275 | |||
| 276 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 277 | +static void digest_data(struct ahash_request *hash, struct iscsi_cmnd *cmnd, | ||
| 278 | + struct tio *tio, u32 offset, u8 *crc) | ||
| 279 | +#else | ||
| 280 | static void digest_data(struct hash_desc *hash, struct iscsi_cmnd *cmnd, | ||
| 281 | struct tio *tio, u32 offset, u8 *crc) | ||
| 282 | +#endif | ||
| 283 | { | ||
| 284 | struct scatterlist *sg = cmnd->conn->hash_sg; | ||
| 285 | u32 size, length, npages; | ||
| 286 | @@ -214,7 +279,11 @@ static void digest_data(struct hash_desc | ||
| 287 | BUG_ON(npages > ISCSI_CONN_IOV_MAX); | ||
| 288 | |||
| 289 | sg_init_table(sg, ARRAY_SIZE(cmnd->conn->hash_sg)); | ||
| 290 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 291 | + crypto_ahash_init(hash); | ||
| 292 | +#else | ||
| 293 | crypto_hash_init(hash); | ||
| 294 | +#endif | ||
| 295 | |||
| 296 | for (i = 0; size > 0; i++) { | ||
| 297 | length = min_t(u32, PAGE_CACHE_SIZE - offset, size); | ||
| 298 | @@ -225,8 +294,14 @@ static void digest_data(struct hash_desc | ||
| 299 | |||
| 300 | sg_mark_end(&sg[i - 1]); | ||
| 301 | |||
| 302 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 303 | + ahash_request_set_crypt(hash, sg, crc, nbytes); | ||
| 304 | + crypto_ahash_update(hash); | ||
| 305 | + crypto_ahash_digest(hash); | ||
| 306 | +#else | ||
| 307 | crypto_hash_update(hash, sg, nbytes); | ||
| 308 | crypto_hash_final(hash, crc); | ||
| 309 | +#endif | ||
| 310 | } | ||
| 311 | |||
| 312 | int digest_rx_data(struct iscsi_cmnd *cmnd) | ||
| 313 | @@ -251,8 +326,11 @@ int digest_rx_data(struct iscsi_cmnd *cm | ||
| 314 | tio = cmnd->tio; | ||
| 315 | offset = 0; | ||
| 316 | } | ||
| 317 | - | ||
| 318 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 319 | + digest_data(cmnd->conn->rx_hash, cmnd, tio, offset, (u8 *) &crc); | ||
| 320 | +#else | ||
| 321 | digest_data(&cmnd->conn->rx_hash, cmnd, tio, offset, (u8 *) &crc); | ||
| 322 | +#endif | ||
| 323 | |||
| 324 | if (!cmnd->conn->read_overflow && | ||
| 325 | (cmnd_opcode(cmnd) != ISCSI_OP_PDU_REJECT)) { | ||
| 326 | @@ -269,6 +347,11 @@ void digest_tx_data(struct iscsi_cmnd *c | ||
| 327 | struct iscsi_data_out_hdr *req = (struct iscsi_data_out_hdr *)&cmnd->pdu.bhs; | ||
| 328 | |||
| 329 | assert(tio); | ||
| 330 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 331 | + digest_data(cmnd->conn->tx_hash, cmnd, tio, | ||
| 332 | + be32_to_cpu(req->buffer_offset), (u8 *) &cmnd->ddigest); | ||
| 333 | +#else | ||
| 334 | digest_data(&cmnd->conn->tx_hash, cmnd, tio, | ||
| 335 | be32_to_cpu(req->buffer_offset), (u8 *) &cmnd->ddigest); | ||
| 336 | +#endif | ||
| 337 | } | ||
| 338 | diff -Naurp iscsitarget-1.4.20.3+svn502_org/kernel/iscsi.h iscsitarget-1.4.20.3+svn502/kernel/iscsi.h | ||
| 339 | --- iscsitarget-1.4.20.3+svn502_org/kernel/iscsi.h 2017-01-19 20:19:27.400507354 -0800 | ||
| 340 | +++ iscsitarget-1.4.20.3+svn502/kernel/iscsi.h 2017-01-19 20:32:22.979988634 -0800 | ||
| 341 | @@ -14,6 +14,7 @@ | ||
| 342 | #include <linux/pagemap.h> | ||
| 343 | #include <linux/seq_file.h> | ||
| 344 | #include <linux/mm.h> | ||
| 345 | +#include <crypto/hash.h> | ||
| 346 | #include <linux/crypto.h> | ||
| 347 | #include <linux/scatterlist.h> | ||
| 348 | #include <net/sock.h> | ||
| 349 | @@ -275,8 +276,13 @@ struct iscsi_conn { | ||
| 350 | u32 write_offset; | ||
| 351 | int write_state; | ||
| 352 | |||
| 353 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 354 | + struct ahash_request *rx_hash; | ||
| 355 | + struct ahash_request *tx_hash; | ||
| 356 | +#else | ||
| 357 | struct hash_desc rx_hash; | ||
| 358 | struct hash_desc tx_hash; | ||
| 359 | +#endif | ||
| 360 | struct scatterlist hash_sg[ISCSI_CONN_IOV_MAX]; | ||
| 361 | }; | ||
| 362 | |||
| 363 | @@ -552,4 +558,10 @@ enum cmnd_flags { | ||
| 364 | #define PRODUCT_ID "VIRTUAL-DISK" | ||
| 365 | #define PRODUCT_REV "0" | ||
| 366 | |||
| 367 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 368 | +#define PAGE_CACHE_SHIFT PAGE_SHIFT | ||
| 369 | +#define PAGE_CACHE_SIZE PAGE_SIZE | ||
| 370 | +#define PAGE_CACHE_MASK PAGE_MASK | ||
| 371 | +#endif | ||
| 372 | + | ||
| 373 | #endif /* __ISCSI_H__ */ | ||
| 374 | diff -Naurp iscsitarget-1.4.20.3+svn502_org/kernel/nthread.c iscsitarget-1.4.20.3+svn502/kernel/nthread.c | ||
| 375 | --- iscsitarget-1.4.20.3+svn502_org/kernel/nthread.c 2017-01-19 20:19:27.276504928 -0800 | ||
| 376 | +++ iscsitarget-1.4.20.3+svn502/kernel/nthread.c 2017-01-19 20:32:22.979988634 -0800 | ||
| 377 | @@ -155,7 +155,12 @@ static int do_recv(struct iscsi_conn *co | ||
| 378 | |||
| 379 | oldfs = get_fs(); | ||
| 380 | set_fs(get_ds()); | ||
| 381 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 382 | + res = sock_recvmsg(conn->sock, (struct msghdr *) &msg, \ | ||
| 383 | + MSG_DONTWAIT | MSG_NOSIGNAL); | ||
| 384 | +#else | ||
| 385 | res = sock_recvmsg(conn->sock, &msg, len, MSG_DONTWAIT | MSG_NOSIGNAL); | ||
| 386 | +#endif | ||
| 387 | set_fs(oldfs); | ||
| 388 | |||
| 389 | if (res <= 0) { | ||
| 390 | @@ -376,7 +381,11 @@ static int write_data(struct iscsi_conn | ||
| 391 | ; | ||
| 392 | oldfs = get_fs(); | ||
| 393 | set_fs(KERNEL_DS); | ||
| 394 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 395 | + res = vfs_writev(file, (struct iovec __user *) iop, count, &off, 0); | ||
| 396 | +#else | ||
| 397 | res = vfs_writev(file, (struct iovec __user *) iop, count, &off); | ||
| 398 | +#endif | ||
| 399 | set_fs(oldfs); | ||
| 400 | dprintk(D_DATA, "%#Lx:%u: %d(%ld)\n", | ||
| 401 | (unsigned long long) conn->session->sid, conn->cid, | ||
| 402 | @@ -503,7 +512,11 @@ static int tx_ddigest(struct iscsi_cmnd | ||
| 403 | iov.iov_base = (char *) (&cmnd->ddigest) + (sizeof(u32) - rest); | ||
| 404 | iov.iov_len = rest; | ||
| 405 | |||
| 406 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 407 | + res = kernel_sendmsg(cmnd->conn->sock, (struct msghdr *) &msg, &iov, 1, rest); | ||
| 408 | +#else | ||
| 409 | res = kernel_sendmsg(cmnd->conn->sock, &msg, &iov, 1, rest); | ||
| 410 | +#endif | ||
| 411 | |||
| 412 | if (res > 0) { | ||
| 413 | cmnd->conn->write_size -= res; | ||
| 414 | @@ -702,7 +715,12 @@ static void close_conn(struct iscsi_conn | ||
| 415 | |||
| 416 | write_lock_bh(&conn->sock->sk->sk_callback_lock); | ||
| 417 | conn->sock->sk->sk_state_change = target->nthread_info.old_state_change; | ||
| 418 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 419 | + conn->sock->sk->sk_data_ready = (void (*) (struct sock *)) \ | ||
| 420 | + target->nthread_info.old_data_ready; | ||
| 421 | +#else | ||
| 422 | conn->sock->sk->sk_data_ready = target->nthread_info.old_data_ready; | ||
| 423 | +#endif | ||
| 424 | conn->sock->sk->sk_write_space = target->nthread_info.old_write_space; | ||
| 425 | write_unlock_bh(&conn->sock->sk->sk_callback_lock); | ||
| 426 | |||
| 427 | diff -Naurp iscsitarget-1.4.20.3+svn502_org/kernel/volume.c iscsitarget-1.4.20.3+svn502/kernel/volume.c | ||
| 428 | --- iscsitarget-1.4.20.3+svn502_org/kernel/volume.c 2017-01-19 20:19:27.276504928 -0800 | ||
| 429 | +++ iscsitarget-1.4.20.3+svn502/kernel/volume.c 2017-01-19 20:32:22.979988634 -0800 | ||
| 430 | @@ -84,12 +84,25 @@ static int set_scsisn(struct iet_volume | ||
| 431 | /* Generate a MD5 hash of the target IQN and LUN number */ | ||
| 432 | static void gen_scsiid(struct iet_volume *volume) | ||
| 433 | { | ||
| 434 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 435 | + struct ahash_request *hash; | ||
| 436 | + struct crypto_ahash *tfm; | ||
| 437 | +#else | ||
| 438 | struct hash_desc hash; | ||
| 439 | +#endif | ||
| 440 | |||
| 441 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 442 | + tfm = crypto_alloc_ahash("md5", 0, CRYPTO_ALG_ASYNC); | ||
| 443 | +#else | ||
| 444 | hash.tfm = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC); | ||
| 445 | hash.flags = 0; | ||
| 446 | +#endif | ||
| 447 | |||
| 448 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 449 | + if (!IS_ERR(tfm)) { | ||
| 450 | +#else | ||
| 451 | if (!IS_ERR(hash.tfm)) { | ||
| 452 | +#endif | ||
| 453 | struct scatterlist sg[2]; | ||
| 454 | unsigned int nbytes = 0; | ||
| 455 | |||
| 456 | @@ -102,11 +115,19 @@ static void gen_scsiid(struct iet_volume | ||
| 457 | sg_set_buf(&sg[1], &volume->lun, sizeof(volume->lun)); | ||
| 458 | nbytes += sizeof(volume->lun); | ||
| 459 | |||
| 460 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 461 | + crypto_ahash_init(hash); | ||
| 462 | + ahash_request_set_crypt(hash, sg, volume->scsi_id, nbytes); | ||
| 463 | + crypto_ahash_update(hash); | ||
| 464 | + crypto_ahash_digest(hash); | ||
| 465 | + crypto_free_ahash(tfm); | ||
| 466 | +#else | ||
| 467 | crypto_hash_init(&hash); | ||
| 468 | crypto_hash_update(&hash, sg, nbytes); | ||
| 469 | crypto_hash_final(&hash, volume->scsi_id); | ||
| 470 | |||
| 471 | crypto_free_hash(hash.tfm); | ||
| 472 | +#endif | ||
| 473 | } else { | ||
| 474 | /* If no MD5 available set ID to TID and LUN */ | ||
| 475 | memcpy(volume->scsi_id, &volume->target->tid, | ||
diff --git a/meta-networking/recipes-extended/iscsitarget/files/fix-call-trace-of-ahash-API-calling.patch b/meta-networking/recipes-extended/iscsitarget/files/fix-call-trace-of-ahash-API-calling.patch deleted file mode 100644 index c99683478b..0000000000 --- a/meta-networking/recipes-extended/iscsitarget/files/fix-call-trace-of-ahash-API-calling.patch +++ /dev/null | |||
| @@ -1,85 +0,0 @@ | |||
| 1 | The previous build_with_updated_interfaces_of_linux_v4.8_and_above.patch | ||
| 2 | does not alloc struct ahash_request before using it. This will cause the | ||
| 3 | kernel call trace below when calling gen_scsiid on kernel 4.8 or later | ||
| 4 | version. | ||
| 5 | |||
| 6 | This patch normalizes the calling of ahash API according to the example | ||
| 7 | in kernel doc Documentation/crypto/api-intro.txt. | ||
| 8 | |||
| 9 | BUG: unable to handle kernel NULL pointer dereference at 0000000000000020 | ||
| 10 | IP: [<ffffffffa0008d45>] volume_add+0x625/0x7f0 [iscsi_trgt] | ||
| 11 | PGD dd77067 PUD dd7c067 PMD 0 | ||
| 12 | Oops: 0000 [#1] PREEMPT SMP | ||
| 13 | Modules linked in: iscsi_trgt(O) | ||
| 14 | CPU: 0 PID: 350 Comm: ietd Tainted: G O 4.8.12-yocto-standard #1 | ||
| 15 | Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014 | ||
| 16 | task: ffff88000dfe2c00 task.stack: ffff88000de88000 | ||
| 17 | RIP: 0010:[<ffffffffa0008d45>] [<ffffffffa0008d45>] volume_add+0x625/0x7f0 [iscsi_trgt] | ||
| 18 | RSP: 0018:ffff88000de8bd90 EFLAGS: 00000206 | ||
| 19 | RAX: 000000000000ddfa RBX: ffff88000ddd1d78 RCX: ffffea0000000000 | ||
| 20 | RDX: 0000000000000600 RSI: 0000000000000000 RDI: ffff88000ddd1c14 | ||
| 21 | RBP: ffff88000de8be38 R08: ffff88000de44180 R09: ffff88000de8bdd0 | ||
| 22 | R10: 000000000000002c R11: 0000000000000000 R12: ffff88000ddfa600 | ||
| 23 | R13: 0000000000000000 R14: 0000000000000000 R15: ffff88000de92200 | ||
| 24 | FS: 00007f767548b700(0000) GS:ffff88000fc00000(0000) knlGS:0000000000000000 | ||
| 25 | CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 | ||
| 26 | CR2: 0000000000000020 CR3: 000000000dd2d000 CR4: 00000000000006f0 | ||
| 27 | Stack: | ||
| 28 | ffff88000de8bdd0 ffff88000dc1b3d0 ffff88000ddfa650 ffff88000ddfa660 | ||
| 29 | ffff88000df8f000 ffff88000ddd1c00 ffff88000de44180 0000000000000000 | ||
| 30 | ffffea0000377440 0000000f00000c14 0000000000000000 0000000000000000 | ||
| 31 | Call Trace: | ||
| 32 | [<ffffffffa0006547>] ioctl+0x217/0x390 [iscsi_trgt] | ||
| 33 | [<ffffffff81192574>] do_vfs_ioctl+0x94/0x5c0 | ||
| 34 | [<ffffffff8117ff73>] ? vfs_read+0xf3/0x120 | ||
| 35 | [<ffffffff81192b19>] SyS_ioctl+0x79/0x90 | ||
| 36 | [<ffffffff8191a45b>] entry_SYSCALL_64_fastpath+0x13/0x8f | ||
| 37 | Code: 4c 01 e0 0f 82 a2 01 00 00 48 b9 00 00 00 80 ff 77 00 00 48 01 | ||
| 38 | c8 45 31 f6 48 b9 00 00 00 00 00 ea ff ff 89 54 24 68 48 c1 e8 0c <49> | ||
| 39 | 8b 56 20 4c 89 44 24 20 4c 89 f7 48 c1 e0 06 c7 44 24 6c 04 | ||
| 40 | RIP [<ffffffffa0008d45>] volume_add+0x625/0x7f0 [iscsi_trgt] | ||
| 41 | RSP <ffff88000de8bd90> | ||
| 42 | CR2: 0000000000000020 | ||
| 43 | end trace cd2016297df21635 ] | ||
| 44 | ietd_response_recv 200 0 -5 | ||
| 45 | Input/output error. | ||
| 46 | |||
| 47 | Upstream-Status: Pending [This patch is based on the previous one which | ||
| 48 | has not been merged upstream.] | ||
| 49 | |||
| 50 | Signed-off-by: Zhe He <zhe.he@windriver.com> | ||
| 51 | |||
| 52 | --- iscsitarget-1.4.20.3+svn502_orig/kernel/volume.c 2017-01-18 08:57:56.752187402 +0800 | ||
| 53 | +++ iscsitarget-1.4.20.3+svn502/kernel/volume.c 2017-01-18 09:02:44.164195234 +0800 | ||
| 54 | @@ -93,13 +93,14 @@ static void gen_scsiid(struct iet_volume | ||
| 55 | |||
| 56 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 57 | tfm = crypto_alloc_ahash("md5", 0, CRYPTO_ALG_ASYNC); | ||
| 58 | + hash = ahash_request_alloc(tfm, GFP_ATOMIC); | ||
| 59 | #else | ||
| 60 | hash.tfm = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC); | ||
| 61 | hash.flags = 0; | ||
| 62 | #endif | ||
| 63 | |||
| 64 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 65 | - if (!IS_ERR(tfm)) { | ||
| 66 | + if (tfm && !IS_ERR(tfm)) { | ||
| 67 | #else | ||
| 68 | if (!IS_ERR(hash.tfm)) { | ||
| 69 | #endif | ||
| 70 | @@ -116,10 +117,13 @@ static void gen_scsiid(struct iet_volume | ||
| 71 | nbytes += sizeof(volume->lun); | ||
| 72 | |||
| 73 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
| 74 | - crypto_ahash_init(hash); | ||
| 75 | + ahash_request_set_callback(hash, 0, NULL, NULL); | ||
| 76 | ahash_request_set_crypt(hash, sg, volume->scsi_id, nbytes); | ||
| 77 | - crypto_ahash_update(hash); | ||
| 78 | crypto_ahash_digest(hash); | ||
| 79 | + crypto_ahash_init(hash); | ||
| 80 | + crypto_ahash_update(hash); | ||
| 81 | + crypto_ahash_final(hash); | ||
| 82 | + ahash_request_free(hash); | ||
| 83 | crypto_free_ahash(tfm); | ||
| 84 | #else | ||
| 85 | crypto_hash_init(&hash); | ||
diff --git a/meta-networking/recipes-extended/iscsitarget/files/fix-errors-observed-with-linux-3.19-and-greater.patch b/meta-networking/recipes-extended/iscsitarget/files/fix-errors-observed-with-linux-3.19-and-greater.patch deleted file mode 100644 index 1e6a1d6d3f..0000000000 --- a/meta-networking/recipes-extended/iscsitarget/files/fix-errors-observed-with-linux-3.19-and-greater.patch +++ /dev/null | |||
| @@ -1,327 +0,0 @@ | |||
| 1 | Description: Fix source to compile on 3.19 kernels | ||
| 2 | Author: Stefan Bader <stefan.bader@canonical.com> | ||
| 3 | Forward: no | ||
| 4 | |||
| 5 | Fixes below inconsistent crash when trying to login to iSCSI target | ||
| 6 | server, observed with linux kernel v4.1. | ||
| 7 | |||
| 8 | -- snip -- | ||
| 9 | CPU: 1 PID: 29883 Comm: istd1 Tainted: G O 4.1.35-rt40-yocto-standard #1 | ||
| 10 | Hardware name: To be filled by O.E.M. To be filled by O.E.M./Larne CRB, BIOS 4.6.5.4 09/18/2014 | ||
| 11 | task: ffff88020f1f30c0 ti: ffff8800d7f3c000 task.ti: ffff8800d7f3c000 | ||
| 12 | RIP: 0010:[<ffffffff8140d1ae>] [<ffffffff8140d1ae>] copy_to_iter+0x3e/0x280 | ||
| 13 | RSP: 0018:ffff8800d7f3f728 EFLAGS: 00010246 | ||
| 14 | RAX: 00000000d7f3f928 RBX: 0000000000000030 RCX: 0000000000000030 | ||
| 15 | RDX: ffff8800d7f3f900 RSI: 0000000000000030 RDI: ffff8800d1501e82 | ||
| 16 | RBP: ffff8800d7f3f768 R08: 00000000c127d467 R09: 0000000000000000 | ||
| 17 | R10: ffff88020f29e118 R11: 0000000000000004 R12: ffff8800d7f3f900 | ||
| 18 | R13: 0000000000000030 R14: 0000000000000001 R15: 0000000000000246 | ||
| 19 | FS: 00007f86f9c4c700(0000) GS:ffff88021ec80000(0000) knlGS:00000000f7733700 | ||
| 20 | CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 | ||
| 21 | CR2: 000000000000024e CR3: 00000000d38b0000 CR4: 00000000000406e0 | ||
| 22 | Stack: | ||
| 23 | ffff880214f14ec0 ffff8800d1501e82 ffff8800d7f3f748 0000000000000030 | ||
| 24 | ffff88020f122500 0000000000000030 0000000000000000 0000000000000030 | ||
| 25 | ffff8800d7f3f7c8 ffffffff81806981 ffff8800d7f3f798 ffffffff8105d72a | ||
| 26 | Call Trace: | ||
| 27 | [<ffffffff81806981>] skb_copy_datagram_iter+0x71/0x2b0 | ||
| 28 | [<ffffffff8105d72a>] ? __local_bh_enable_ip+0x4a/0xb0 | ||
| 29 | [<ffffffff8186c9c0>] tcp_recvmsg+0x5e0/0xbb0 | ||
| 30 | [<ffffffff81898ded>] inet_recvmsg+0x8d/0xb0 | ||
| 31 | [<ffffffff817f49f3>] sock_recvmsg+0x13/0x20 | ||
| 32 | [<ffffffffa01655c3>] do_recv+0xe3/0x1f0 [iscsi_trgt] | ||
| 33 | [<ffffffff81153097>] ? __mod_zone_page_state+0x77/0xb0 | ||
| 34 | [<ffffffff81417613>] ? __this_cpu_preempt_check+0x13/0x20 | ||
| 35 | [<ffffffff81153097>] ? __mod_zone_page_state+0x77/0xb0 | ||
| 36 | [<ffffffff8140fed5>] ? find_next_bit+0x15/0x30 | ||
| 37 | [<ffffffff813fa8e0>] ? cpumask_next_and+0x30/0x50 | ||
| 38 | [<ffffffff8113f785>] ? __alloc_pages_nodemask+0x165/0x980 | ||
| 39 | [<ffffffff8107e370>] ? preempt_count_add+0xd0/0xf0 | ||
| 40 | [<ffffffff8195da8b>] ? _raw_spin_lock+0x1b/0x60 | ||
| 41 | [<ffffffff8109cfa8>] ? cpuacct_charge+0x58/0x70 | ||
| 42 | [<ffffffff81089039>] ? update_curr+0xb9/0x190 | ||
| 43 | [<ffffffff81417613>] ? __this_cpu_preempt_check+0x13/0x20 | ||
| 44 | [<ffffffff8112b43f>] ? __perf_event_task_sched_in+0x4f/0x90 | ||
| 45 | [<ffffffff8195dbbd>] ? _raw_spin_unlock_irq+0x1d/0x40 | ||
| 46 | [<ffffffff8107e223>] ? finish_task_switch+0x63/0xe0 | ||
| 47 | [<ffffffff81959e3b>] ? __schedule+0x38b/0x980 | ||
| 48 | [<ffffffff8107e370>] ? preempt_count_add+0xd0/0xf0 | ||
| 49 | [<ffffffffa0165c65>] istd+0x4d5/0x1390 [iscsi_trgt] | ||
| 50 | [<ffffffff81959e3b>] ? __schedule+0x38b/0x980 | ||
| 51 | [<ffffffffa0165790>] ? nthread_wakeup+0x40/0x40 [iscsi_trgt] | ||
| 52 | [<ffffffffa0165790>] ? nthread_wakeup+0x40/0x40 [iscsi_trgt] | ||
| 53 | [<ffffffff8107748b>] kthread+0xbb/0xe0 | ||
| 54 | [<ffffffff81950000>] ? wireless_dev_seq_show+0x100/0x180 | ||
| 55 | [<ffffffff810773d0>] ? kthread_worker_fn+0x170/0x170 | ||
| 56 | [<ffffffff8195e7a2>] ret_from_fork+0x42/0x70 | ||
| 57 | [<ffffffff810773d0>] ? kthread_worker_fn+0x170/0x170 | ||
| 58 | Code: 5a 10 48 89 7d c8 48 39 f3 48 0f 47 de 48 85 db 0f 84 6f 01 00 00 8b 02 49 89 | ||
| 59 | d4 4c 8b 72 08 4c 8b 7a 18 a8 04 0f 85 a2 00 00 00 <4d> 8b 6f 08 4d 29 f5 49 39 dd 4c 0f 47 eb a8 02 0f 85 5c 01 00 | ||
| 60 | RSP <ffff8800d7f3f728> | ||
| 61 | CR2: 000000000000024e | ||
| 62 | ------------[ cut here ]------------ | ||
| 63 | -- snip -- | ||
| 64 | |||
| 65 | The original patch is at | ||
| 66 | http://launchpadlibrarian.net/218100509/iscsitarget_1.4.20.3+svn499-0ubuntu2_1.4.20.3+svn499-0ubuntu2.1.diff.gz, | ||
| 67 | those changes were taken using #ifs, inorder to allow compilation of | ||
| 68 | iscsitarget package with linux kernels < 3.19. | ||
| 69 | |||
| 70 | Upstream-Status: Submitted [http://launchpadlibrarian.net/218100509/iscsitarget_1.4.20.3+svn499-0ubuntu2_1.4.20.3+svn499-0ubuntu2.1.diff.gz] | ||
| 71 | |||
| 72 | Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa@mvista.com> | ||
| 73 | |||
| 74 | diff -Naurp iscsitarget-1.4.20.3+svn502_org/kernel/conn.c iscsitarget-1.4.20.3+svn502/kernel/conn.c | ||
| 75 | --- iscsitarget-1.4.20.3+svn502_org/kernel/conn.c 2017-01-18 22:27:02.713167436 -0800 | ||
| 76 | +++ iscsitarget-1.4.20.3+svn502/kernel/conn.c 2017-01-18 23:13:11.909214379 -0800 | ||
| 77 | @@ -129,7 +129,11 @@ static void iet_socket_bind(struct iscsi | ||
| 78 | |||
| 79 | dprintk(D_GENERIC, "%llu\n", (unsigned long long) session->sid); | ||
| 80 | |||
| 81 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
| 82 | + conn->sock = SOCKET_I(file_inode(conn->file)); | ||
| 83 | +#else | ||
| 84 | conn->sock = SOCKET_I(conn->file->f_dentry->d_inode); | ||
| 85 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
| 86 | conn->sock->sk->sk_user_data = conn; | ||
| 87 | |||
| 88 | write_lock_bh(&conn->sock->sk->sk_callback_lock); | ||
| 89 | diff -Naurp iscsitarget-1.4.20.3+svn502_org/kernel/file-io.c iscsitarget-1.4.20.3+svn502/kernel/file-io.c | ||
| 90 | --- iscsitarget-1.4.20.3+svn502_org/kernel/file-io.c 2014-05-06 13:59:55.000000000 -0700 | ||
| 91 | +++ iscsitarget-1.4.20.3+svn502/kernel/file-io.c 2017-01-18 23:54:38.505717079 -0800 | ||
| 92 | @@ -69,7 +69,11 @@ static int fileio_make_request(struct ie | ||
| 93 | static int fileio_sync(struct iet_volume *lu, struct tio *tio) | ||
| 94 | { | ||
| 95 | struct fileio_data *p = lu->private; | ||
| 96 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
| 97 | + struct inode *inode = file_inode(p->filp); | ||
| 98 | +#else | ||
| 99 | struct inode *inode = p->filp->f_dentry->d_inode; | ||
| 100 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
| 101 | struct address_space *mapping = inode->i_mapping; | ||
| 102 | loff_t ppos, count; | ||
| 103 | int res; | ||
| 104 | @@ -213,7 +217,11 @@ static int fileio_attach(struct iet_volu | ||
| 105 | eprintk("%d\n", err); | ||
| 106 | goto out; | ||
| 107 | } | ||
| 108 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
| 109 | + inode = file_inode(p->filp); | ||
| 110 | +#else | ||
| 111 | inode = p->filp->f_dentry->d_inode; | ||
| 112 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
| 113 | |||
| 114 | if (S_ISREG(inode->i_mode)) | ||
| 115 | ; | ||
| 116 | diff -Naurp iscsitarget-1.4.20.3+svn502_org/kernel/iscsi.c iscsitarget-1.4.20.3+svn502/kernel/iscsi.c | ||
| 117 | --- iscsitarget-1.4.20.3+svn502_org/kernel/iscsi.c 2014-05-06 13:59:55.000000000 -0700 | ||
| 118 | +++ iscsitarget-1.4.20.3+svn502/kernel/iscsi.c 2017-01-18 23:37:36.462970326 -0800 | ||
| 119 | @@ -489,8 +489,12 @@ static void cmnd_skip_pdu(struct iscsi_c | ||
| 120 | } | ||
| 121 | conn->read_iov[i].iov_base = addr; | ||
| 122 | conn->read_iov[i].iov_len = size; | ||
| 123 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
| 124 | + iov_iter_init(&conn->read_msg.msg_iter, READ, conn->read_iov, ++i, conn->read_size); | ||
| 125 | +#else | ||
| 126 | conn->read_msg.msg_iov = conn->read_iov; | ||
| 127 | conn->read_msg.msg_iovlen = ++i; | ||
| 128 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
| 129 | } | ||
| 130 | |||
| 131 | static void iscsi_cmnd_reject(struct iscsi_cmnd *req, int reason) | ||
| 132 | @@ -718,7 +722,9 @@ static int cmnd_recv_pdu(struct iscsi_co | ||
| 133 | idx = offset >> PAGE_CACHE_SHIFT; | ||
| 134 | offset &= ~PAGE_CACHE_MASK; | ||
| 135 | |||
| 136 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) | ||
| 137 | conn->read_msg.msg_iov = conn->read_iov; | ||
| 138 | +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) */ | ||
| 139 | conn->read_size = size = (size + 3) & -4; | ||
| 140 | conn->read_overflow = 0; | ||
| 141 | |||
| 142 | @@ -730,16 +736,25 @@ static int cmnd_recv_pdu(struct iscsi_co | ||
| 143 | conn->read_iov[i].iov_base = addr + offset; | ||
| 144 | if (offset + size <= PAGE_CACHE_SIZE) { | ||
| 145 | conn->read_iov[i].iov_len = size; | ||
| 146 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
| 147 | + iov_iter_init(&conn->read_msg.msg_iter, READ, conn->read_iov, ++i, conn->read_size); | ||
| 148 | +#else | ||
| 149 | conn->read_msg.msg_iovlen = ++i; | ||
| 150 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
| 151 | break; | ||
| 152 | } | ||
| 153 | conn->read_iov[i].iov_len = PAGE_CACHE_SIZE - offset; | ||
| 154 | size -= conn->read_iov[i].iov_len; | ||
| 155 | offset = 0; | ||
| 156 | if (++i >= ISCSI_CONN_IOV_MAX) { | ||
| 157 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) | ||
| 158 | conn->read_msg.msg_iovlen = i; | ||
| 159 | +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) */ | ||
| 160 | conn->read_overflow = size; | ||
| 161 | conn->read_size -= size; | ||
| 162 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
| 163 | + iov_iter_init(&conn->read_msg.msg_iter, READ, conn->read_iov, i, conn->read_size); | ||
| 164 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
| 165 | break; | ||
| 166 | } | ||
| 167 | |||
| 168 | @@ -918,7 +933,9 @@ static int nop_out_start(struct iscsi_co | ||
| 169 | |||
| 170 | if ((size = cmnd->pdu.datasize)) { | ||
| 171 | size = (size + 3) & -4; | ||
| 172 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) | ||
| 173 | conn->read_msg.msg_iov = conn->read_iov; | ||
| 174 | +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) */ | ||
| 175 | if (cmnd->pdu.bhs.itt != cpu_to_be32(ISCSI_RESERVED_TAG)) { | ||
| 176 | struct tio *tio; | ||
| 177 | int pg_cnt = get_pgcnt(size); | ||
| 178 | @@ -946,7 +963,11 @@ static int nop_out_start(struct iscsi_co | ||
| 179 | } | ||
| 180 | assert(!size); | ||
| 181 | conn->read_overflow = size; | ||
| 182 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
| 183 | + iov_iter_init(&conn->read_msg.msg_iter, READ, conn->read_iov, i, conn->read_size); | ||
| 184 | +#else | ||
| 185 | conn->read_msg.msg_iovlen = i; | ||
| 186 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
| 187 | } | ||
| 188 | |||
| 189 | out: | ||
| 190 | @@ -986,7 +1007,11 @@ static void scsi_cmnd_start(struct iscsi | ||
| 191 | set_cmnd_lunit(req); | ||
| 192 | |||
| 193 | switch (req_hdr->scb[0]) { | ||
| 194 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
| 195 | + case SERVICE_ACTION_IN_16: | ||
| 196 | +#else | ||
| 197 | case SERVICE_ACTION_IN: | ||
| 198 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
| 199 | if ((req_hdr->scb[1] & 0x1f) != 0x10) | ||
| 200 | goto error; | ||
| 201 | case INQUIRY: | ||
| 202 | diff -Naurp iscsitarget-1.4.20.3+svn502_org/kernel/nthread.c iscsitarget-1.4.20.3+svn502/kernel/nthread.c | ||
| 203 | --- iscsitarget-1.4.20.3+svn502_org/kernel/nthread.c 2014-05-06 13:59:55.000000000 -0700 | ||
| 204 | +++ iscsitarget-1.4.20.3+svn502/kernel/nthread.c 2017-01-18 23:45:03.291033881 -0800 | ||
| 205 | @@ -42,9 +42,14 @@ static inline void iscsi_conn_init_read( | ||
| 206 | len = (len + 3) & -4; // XXX ??? | ||
| 207 | conn->read_iov[0].iov_base = data; | ||
| 208 | conn->read_iov[0].iov_len = len; | ||
| 209 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) | ||
| 210 | conn->read_msg.msg_iov = conn->read_iov; | ||
| 211 | conn->read_msg.msg_iovlen = 1; | ||
| 212 | +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) */ | ||
| 213 | conn->read_size = (len + 3) & -4; | ||
| 214 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
| 215 | + iov_iter_init(&conn->read_msg.msg_iter, READ, conn->read_iov, 1, conn->read_size); | ||
| 216 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
| 217 | } | ||
| 218 | |||
| 219 | static void iscsi_conn_read_ahs(struct iscsi_conn *conn, struct iscsi_cmnd *cmnd) | ||
| 220 | @@ -83,14 +88,31 @@ static int is_data_available(struct iscs | ||
| 221 | |||
| 222 | static void forward_iov(struct msghdr *msg, int len) | ||
| 223 | { | ||
| 224 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
| 225 | + struct iovec *iov; | ||
| 226 | + | ||
| 227 | + while (msg->msg_iter.iov->iov_len <= len) { | ||
| 228 | + len -= msg->msg_iter.iov->iov_len; | ||
| 229 | + msg->msg_iter.iov++; | ||
| 230 | + msg->msg_iter.nr_segs--; | ||
| 231 | + } | ||
| 232 | +#else | ||
| 233 | while (msg->msg_iov->iov_len <= len) { | ||
| 234 | len -= msg->msg_iov->iov_len; | ||
| 235 | msg->msg_iov++; | ||
| 236 | msg->msg_iovlen--; | ||
| 237 | } | ||
| 238 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
| 239 | |||
| 240 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
| 241 | + /* XXX: discards const ... */ | ||
| 242 | + iov = msg->msg_iter.iov; | ||
| 243 | + iov->iov_base = (char *) msg->msg_iter.iov->iov_base + len; | ||
| 244 | + iov->iov_len -= len; | ||
| 245 | +#else | ||
| 246 | msg->msg_iov->iov_base = (char *) msg->msg_iov->iov_base + len; | ||
| 247 | msg->msg_iov->iov_len -= len; | ||
| 248 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
| 249 | } | ||
| 250 | |||
| 251 | static int do_recv(struct iscsi_conn *conn, int state) | ||
| 252 | @@ -98,6 +120,9 @@ static int do_recv(struct iscsi_conn *co | ||
| 253 | mm_segment_t oldfs; | ||
| 254 | struct msghdr msg; | ||
| 255 | struct iovec iov[ISCSI_CONN_IOV_MAX]; | ||
| 256 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
| 257 | + size_t iovlen = ISCSI_CONN_IOV_MAX; | ||
| 258 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
| 259 | int i, len, res; | ||
| 260 | |||
| 261 | if (!test_bit(CONN_ACTIVE, &conn->state)) { | ||
| 262 | @@ -110,12 +135,23 @@ static int do_recv(struct iscsi_conn *co | ||
| 263 | goto out; | ||
| 264 | } | ||
| 265 | |||
| 266 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
| 267 | + if (conn->read_msg.msg_iter.nr_segs < iovlen) | ||
| 268 | + iovlen = conn->read_msg.msg_iter.nr_segs; | ||
| 269 | + | ||
| 270 | + for (i = 0, len = 0; i < iovlen; i++) { | ||
| 271 | + iov[i] = conn->read_msg.msg_iter.iov[i]; | ||
| 272 | + len += iov[i].iov_len; | ||
| 273 | + } | ||
| 274 | + iov_iter_init(&msg.msg_iter, READ, iov, iovlen, len); | ||
| 275 | +#else | ||
| 276 | msg.msg_iov = iov; | ||
| 277 | msg.msg_iovlen = min_t(size_t, conn->read_msg.msg_iovlen, ISCSI_CONN_IOV_MAX); | ||
| 278 | for (i = 0, len = 0; i < msg.msg_iovlen; i++) { | ||
| 279 | iov[i] = conn->read_msg.msg_iov[i]; | ||
| 280 | len += iov[i].iov_len; | ||
| 281 | } | ||
| 282 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
| 283 | |||
| 284 | oldfs = get_fs(); | ||
| 285 | set_fs(get_ds()); | ||
| 286 | diff -Naurp iscsitarget-1.4.20.3+svn502_org/kernel/target_disk.c iscsitarget-1.4.20.3+svn502/kernel/target_disk.c | ||
| 287 | --- iscsitarget-1.4.20.3+svn502_org/kernel/target_disk.c 2014-05-06 13:59:55.000000000 -0700 | ||
| 288 | +++ iscsitarget-1.4.20.3+svn502/kernel/target_disk.c 2017-01-18 23:45:51.451010417 -0800 | ||
| 289 | @@ -606,7 +606,11 @@ static int disk_execute_cmnd(struct iscs | ||
| 290 | case REQUEST_SENSE: | ||
| 291 | send_data_rsp(cmnd, build_request_sense_response); | ||
| 292 | break; | ||
| 293 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
| 294 | + case SERVICE_ACTION_IN_16: | ||
| 295 | +#else | ||
| 296 | case SERVICE_ACTION_IN: | ||
| 297 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
| 298 | send_data_rsp(cmnd, build_service_action_in_response); | ||
| 299 | break; | ||
| 300 | case READ_6: | ||
| 301 | diff -Naurp iscsitarget-1.4.20.3+svn502_org/kernel/volume.c iscsitarget-1.4.20.3+svn502/kernel/volume.c | ||
| 302 | --- iscsitarget-1.4.20.3+svn502_org/kernel/volume.c 2014-05-06 13:59:55.000000000 -0700 | ||
| 303 | +++ iscsitarget-1.4.20.3+svn502/kernel/volume.c 2017-01-18 23:47:07.957561600 -0800 | ||
| 304 | @@ -398,7 +398,11 @@ int is_volume_reserved(struct iet_volume | ||
| 305 | case READ_CAPACITY: | ||
| 306 | /* allowed commands when reserved */ | ||
| 307 | break; | ||
| 308 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
| 309 | + case SERVICE_ACTION_IN_16: | ||
| 310 | +#else | ||
| 311 | case SERVICE_ACTION_IN: | ||
| 312 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
| 313 | if ((scb[1] & 0x1F) == 0x10) | ||
| 314 | break; | ||
| 315 | /* fall through */ | ||
| 316 | @@ -465,7 +469,11 @@ int is_volume_reserved(struct iet_volume | ||
| 317 | if (excl_access_ro && !registered) | ||
| 318 | err = -EBUSY; | ||
| 319 | break; | ||
| 320 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
| 321 | + case SERVICE_ACTION_IN_16: | ||
| 322 | +#else | ||
| 323 | case SERVICE_ACTION_IN: | ||
| 324 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
| 325 | if ((scb[1] & 0x1F) == 0x10) | ||
| 326 | break; | ||
| 327 | /* fall through */ | ||
diff --git a/meta-networking/recipes-extended/iscsitarget/files/use-kernel-makefile-to-get-kernel-version.patch b/meta-networking/recipes-extended/iscsitarget/files/use-kernel-makefile-to-get-kernel-version.patch deleted file mode 100644 index 95bd047b97..0000000000 --- a/meta-networking/recipes-extended/iscsitarget/files/use-kernel-makefile-to-get-kernel-version.patch +++ /dev/null | |||
| @@ -1,67 +0,0 @@ | |||
| 1 | Get linux kernel version from Makefile of kernel source | ||
| 2 | |||
| 3 | We get below messages while building iscsitarget, | ||
| 4 | |||
| 5 | -- snip -- | ||
| 6 | x86_64-poky-linux-gcc: error: | ||
| 7 | /CGE7_SHDD/project_yocto_1.8/poky/build/tmp/work-shared/qemux86-64/kernel-source/include/linux/version.h: | ||
| 8 | No such file or directory | ||
| 9 | x86_64-poky-linux-gcc: fatal error: no input files | ||
| 10 | compilation terminated. | ||
| 11 | /bin/sh: line 0: [: too many arguments | ||
| 12 | /bin/sh: line 0: [: too many arguments | ||
| 13 | /bin/sh: line 0: [: too many arguments | ||
| 14 | /bin/sh: line 0: [: too many arguments | ||
| 15 | /bin/sh: line 0: [: too many arguments | ||
| 16 | /bin/sh: line 0: [: too many arguments | ||
| 17 | /bin/sh: line 0: [: too many arguments | ||
| 18 | /bin/sh: line 0: [: too many arguments | ||
| 19 | /bin/sh: line 0: [: too many arguments | ||
| 20 | /bin/sh: line 0: [: too many arguments | ||
| 21 | /bin/sh: line 0: [: too many arguments | ||
| 22 | /bin/sh: line 0: [: too many arguments | ||
| 23 | -- CUT -- | ||
| 24 | |||
| 25 | These messages are due to absence of include/linux/version.h file in | ||
| 26 | kernel source directory and failed to compute linux kernel version. | ||
| 27 | So, use kernel source Makefile ( i.e $(KSRC)/Makefile) to find out | ||
| 28 | actual kernel version. | ||
| 29 | |||
| 30 | Upstream-Status: Pending | ||
| 31 | |||
| 32 | Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa@mvista.com> | ||
| 33 | |||
| 34 | --- iscsitarget-1.4.20.3+svn499_org/Makefile 2014-01-27 00:00:45.000000000 +0530 | ||
| 35 | +++ iscsitarget-1.4.20.3+svn499/Makefile 2015-07-23 10:44:47.013600285 +0530 | ||
| 36 | @@ -18,27 +18,11 @@ ifeq ($(KSRC),) | ||
| 37 | endif | ||
| 38 | |||
| 39 | |||
| 40 | -ifneq ($(wildcard $(KSRC)/include/generated/utsrelease.h),) | ||
| 41 | - VERSION_FILE := $(KSRC)/include/generated/utsrelease.h | ||
| 42 | -else | ||
| 43 | - ifneq ($(wildcard $(KSRC)/include/linux/utsrelease.h),) | ||
| 44 | - VERSION_FILE := $(KSRC)/include/linux/utsrelease.h | ||
| 45 | - else | ||
| 46 | - VERSION_FILE := $(KSRC)/include/linux/version.h | ||
| 47 | - endif | ||
| 48 | -endif | ||
| 49 | - | ||
| 50 | -KVER := $(shell $(CC) $(CFLAGS) $(LDFLAGS) -E -dM $(VERSION_FILE) | \ | ||
| 51 | - grep UTS_RELEASE | awk '{ print $$3 }' | sed 's/\"//g') | ||
| 52 | - | ||
| 53 | KMOD := /lib/modules/$(KVER)/extra | ||
| 54 | - | ||
| 55 | -KMAJ := $(shell echo $(KVER) | \ | ||
| 56 | - sed -e 's/^\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*.*/\1/') | ||
| 57 | -KMIN := $(shell echo $(KVER) | \ | ||
| 58 | - sed -e 's/^[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*.*/\1/') | ||
| 59 | -KREV := $(shell echo $(KVER) | \ | ||
| 60 | - sed -e 's/^[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/') | ||
| 61 | +KMAJ := $(shell cat $(KSRC)/Makefile | grep ^VERSION | gawk -F " " '{ print $$NF }') | ||
| 62 | +KMIN := $(shell cat $(KSRC)/Makefile | grep ^PATCHLEVEL | gawk -F " " '{ print $$NF }') | ||
| 63 | +KREV := $(shell cat $(KSRC)/Makefile | grep ^SUBLEVEL | gawk -F " " '{ print $$NF }') | ||
| 64 | +KVER := ${KMAJ}.${KMIN}.${KREV} | ||
| 65 | |||
| 66 | kver_eq = $(shell [ $(KMAJ) -eq $(1) -a $(KMIN) -eq $(2) -a $(KREV) -eq $(3) ] && \ | ||
| 67 | echo 1 || echo 0) | ||
diff --git a/meta-networking/recipes-extended/iscsitarget/iscsitarget_1.4.20.3+svn502.bb b/meta-networking/recipes-extended/iscsitarget/iscsitarget_1.4.20.3+svn502.bb deleted file mode 100644 index 5d1359165a..0000000000 --- a/meta-networking/recipes-extended/iscsitarget/iscsitarget_1.4.20.3+svn502.bb +++ /dev/null | |||
| @@ -1,64 +0,0 @@ | |||
| 1 | DESCRIPTION = "iSCSI Enterprise Target is aimed to develop an \ | ||
| 2 | open source iSCSI target with professional features, \ | ||
| 3 | that works well in enterprise environment under real \ | ||
| 4 | workload, and is scalable and versatile enough to meet the \ | ||
| 5 | challenge of future storage needs and developments." | ||
| 6 | HOMEPAGE = "http://iscsitarget.sourceforge.net/" | ||
| 7 | LICENSE = "GPLv2" | ||
| 8 | LIC_FILES_CHKSUM = "file://COPYING;md5=6e233eda45c807aa29aeaa6d94bc48a2" | ||
| 9 | DEPENDS = "openssl virtual/kernel" | ||
| 10 | |||
| 11 | SRC_URI = "http://ftp.heanet.ie/mirrors/ubuntu/pool/universe/i/${BPN}/${BPN}_${PV}.orig.tar.gz \ | ||
| 12 | file://use-kernel-makefile-to-get-kernel-version.patch \ | ||
| 13 | file://fix-errors-observed-with-linux-3.19-and-greater.patch \ | ||
| 14 | file://access-sk_v6_daddr-iff-IPV6-defined.patch \ | ||
| 15 | file://build_with_updated_bio_struct_of_linux_v4.3_and_above.patch \ | ||
| 16 | file://build_with_updated_interfaces_of_linux_v4.8_and_above.patch \ | ||
| 17 | file://fix-call-trace-of-ahash-API-calling.patch \ | ||
| 18 | file://0001-kernel-event-netlink_ack-now-requires-4-arguments.patch \ | ||
| 19 | " | ||
| 20 | |||
| 21 | SRC_URI[md5sum] = "ef9bc823bbabd3c772208c00d5f2d089" | ||
| 22 | SRC_URI[sha256sum] = "d3196ccb78a43266dce28587bfe30d8ab4db7566d7bce96057dfbb84100babb5" | ||
| 23 | |||
| 24 | inherit module | ||
| 25 | |||
| 26 | do_configure[noexec] = "1" | ||
| 27 | |||
| 28 | # make_scripts requires kernel source directory to create | ||
| 29 | # kernel scripts | ||
| 30 | do_make_scripts[depends] += "virtual/kernel:do_shared_workdir" | ||
| 31 | |||
| 32 | do_compile() { | ||
| 33 | oe_runmake KSRC=${STAGING_KERNEL_DIR} LDFLAGS='' V=1 kernel | ||
| 34 | oe_runmake KSRC=${STAGING_KERNEL_DIR} usr | ||
| 35 | } | ||
| 36 | |||
| 37 | do_install() { | ||
| 38 | # Module | ||
| 39 | install -d ${D}/lib/modules/${KERNEL_VERSION}/kernel/iscsi | ||
| 40 | install -m 0644 kernel/iscsi_trgt.ko \ | ||
| 41 | ${D}/lib/modules/${KERNEL_VERSION}/kernel/iscsi/iscsi_trgt.ko | ||
| 42 | |||
| 43 | # Userspace utilities | ||
| 44 | install -d ${D}${sbindir} | ||
| 45 | install -m 0755 usr/ietd ${D}${sbindir}/ietd | ||
| 46 | install -m 0755 usr/ietadm ${D}${sbindir}/ietadm | ||
| 47 | |||
| 48 | # Config files, init scripts | ||
| 49 | mkdir -p ${D}${sysconfdir}/iet | ||
| 50 | install -m 0644 etc/ietd.conf ${D}/${sysconfdir}/iet/ietd.conf | ||
| 51 | install -m 0644 etc/initiators.allow ${D}${sysconfdir}/iet/initiators.allow | ||
| 52 | install -m 0644 etc/targets.allow ${D}${sysconfdir}/iet/targets.allow | ||
| 53 | mkdir -p ${D}${sysconfdir}/init.d | ||
| 54 | install -m 0755 etc/initd/initd ${D}${sysconfdir}/init.d/iscsi-target | ||
| 55 | install -m 0644 etc/initiators.deny ${D}${sysconfdir}/iet/initiators.deny | ||
| 56 | } | ||
| 57 | |||
| 58 | FILES_${PN} += "${sbindir} \ | ||
| 59 | ${sysconfdir}" | ||
| 60 | |||
| 61 | RDEPENDS_${PN} = "kernel-module-iscsi-trgt" | ||
| 62 | RRECOMMENDS_${PN} = "kernel-module-crc32c kernel-module-libcrc32c" | ||
| 63 | |||
| 64 | PNBLACKLIST[iscsitarget] = "error: implicit declaration of function 'init_timer'; did you mean 'init_timers'?; 4.15 kernel issues" | ||
