|
1 |
| -Fix build errors with linux kernel v3.19 and above |
| 1 | +Description: Fix source to compile on 3.19 kernels |
| 2 | +Author: Stefan Bader < [email protected]> |
| 3 | +Forward: no |
2 | 4 |
|
3 |
| -Below errors came up while building iscsitarget for |
4 |
| -qemux86-64 (and others) because, |
5 |
| -1. 'struct user_msghdr' is being used for userland-side msghdr instead |
6 |
| -of 'struct msghdr', which is used for kernel-side msghdr in linux v3.19 |
7 |
| -and above. |
| 5 | +Fixes below inconsistent crash when trying to login to iSCSI target |
| 6 | +server, observed with linux kernel v4.1. |
8 | 7 |
|
9 |
| -error snippet: |
10 | 8 | -- snip --
|
11 |
| -| /CGE7_SHDD/project_yocto_1.8/poky/build/tmp/work/qemux86_64-poky-linux/iscsitarget/1.4.20.3+svn502-r0/iscsitarget-1.4.20.3+svn502/kernel/iscsi.c: In function 'cmnd_skip_pdu': |
12 |
| -| /CGE7_SHDD/project_yocto_1.8/poky/build/tmp/work/qemux86_64-poky-linux/iscsitarget/1.4.20.3+svn502-r0/iscsitarget-1.4.20.3+svn502/kernel/iscsi.c:492:16: error: 'struct msghdr' has no member named 'msg_iov' |
13 |
| -| conn->read_msg.msg_iov = conn->read_iov; |
14 |
| --- CUT -- |
15 |
| - |
16 |
| -Reference: |
17 |
| -https://github.com/torvalds/linux/commit/666547ff591cebdedc4679bf6b1b3f3383a8dea3 |
18 |
| - |
19 |
| -2. 'SERVICE_ACTION_IN' has been renamed to SERVICE_ACTION_IN_16 in linux v3.19 |
20 |
| -and above. |
21 |
| - |
22 |
| -error snippet: |
23 |
| --- snip -- |
24 |
| -| /CGE7_SHDD/project_yocto_1.8/poky/build/tmp/work/qemux86_64-poky-linux/iscsitarget/1.4.20.3+svn502-r0/iscsitarget-1.4.20.3+svn502/kernel/iscsi.c: In function 'scsi_cmnd_start': |
25 |
| -| /CGE7_SHDD/project_yocto_1.8/poky/build/tmp/work/qemux86_64-poky-linux/iscsitarget/1.4.20.3+svn502-r0/iscsitarget-1.4.20.3+svn502/kernel/iscsi.c:989:7: error: 'SERVICE_ACTION_IN' undeclared (first use in this function) |
26 |
| -| case SERVICE_ACTION_IN: |
27 |
| --- CUT -- |
28 |
| - |
29 |
| -Reference: |
30 |
| -https://github.com/torvalds/linux/commit/eb846d9f147455e4e5e1863bfb5e31974bb69b7c |
31 |
| - |
32 |
| -3. In linux v3.19 and above, f_dentry member has been removed from |
33 |
| -'struct file' structure. |
34 |
| - |
35 |
| -error snippet: |
| 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 ]------------ |
36 | 63 | -- snip --
|
37 |
| -| /CGE7_SHDD/project_yocto_1.8/poky/build/tmp/work/qemux86_64-poky-linux/iscsitarget/1.4.20.3+svn502-r0/iscsitarget-1.4.20.3+svn502/kernel/conn.c: In function 'iet_socket_bind': |
38 |
| -| /CGE7_SHDD/project_yocto_1.8/poky/build/tmp/work/qemux86_64-poky-linux/iscsitarget/1.4.20.3+svn502-r0/iscsitarget-1.4.20.3+svn502/kernel/conn.c:130:34: error: 'struct file' has no member named 'f_dentry' |
39 |
| -| conn->sock = SOCKET_I(conn->file->f_dentry->d_inode); |
40 |
| --- CUT -- |
41 |
| - |
42 |
| -new helper function file_inode(file) should be used instead. |
43 | 64 |
|
44 |
| -References: |
45 |
| -1. https://github.com/torvalds/linux/commit/78d28e651f97866d608d9b41f8ad291e65d47dd5 |
46 |
| -2. https://github.com/torvalds/linux/commit/496ad9aa8ef448058e36ca7a787c61f2e63f0f54 |
| 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. |
47 | 69 |
|
48 |
| -Upstream-Status: Pending |
| 70 | +Upstream-Status: Submitted [http://launchpadlibrarian.net/218100509/iscsitarget_1.4.20.3+svn499-0ubuntu2_1.4.20.3+svn499-0ubuntu2.1.diff.gz] |
49 | 71 |
|
50 | 72 | Signed-off-by: Jagadeesh Krishnanjanappa < [email protected]>
|
51 | 73 |
|
52 |
| ---- iscsitarget-1.4.20.3+svn502_org/kernel/conn.c 2015-08-24 16:13:26.481924679 +0530 |
53 |
| -+++ iscsitarget-1.4.20.3+svn502/kernel/conn.c 2015-08-24 17:27:06.897653698 +0530 |
54 |
| -@@ -127,7 +127,11 @@ static void iet_socket_bind(struct iscsi |
| 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 |
55 | 78 |
|
56 | 79 | dprintk(D_GENERIC, "%llu\n", (unsigned long long) session->sid);
|
57 | 80 |
|
|
63 | 86 | conn->sock->sk->sk_user_data = conn;
|
64 | 87 |
|
65 | 88 | write_lock_bh(&conn->sock->sk->sk_callback_lock);
|
66 |
| ---- iscsitarget-1.4.20.3+svn502_org/kernel/file-io.c 2015-08-24 16:13:26.481924679 +0530 |
67 |
| -+++ iscsitarget-1.4.20.3+svn502/kernel/file-io.c 2015-08-24 17:30:54.390131100 +0530 |
| 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 |
68 | 92 | @@ -69,7 +69,11 @@ static int fileio_make_request(struct ie
|
69 | 93 | static int fileio_sync(struct iet_volume *lu, struct tio *tio)
|
70 | 94 | {
|
|
89 | 113 |
|
90 | 114 | if (S_ISREG(inode->i_mode))
|
91 | 115 | ;
|
92 |
| ---- iscsitarget-1.4.20.3+svn502_org/kernel/iscsi.c 2015-08-24 16:13:26.481924679 +0530 |
93 |
| -+++ iscsitarget-1.4.20.3+svn502/kernel/iscsi.c 2015-08-24 17:33:50.950490156 +0530 |
94 |
| -@@ -986,7 +986,11 @@ static void scsi_cmnd_start(struct iscsi |
| 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 |
95 | 191 | set_cmnd_lunit(req);
|
96 | 192 |
|
97 | 193 | switch (req_hdr->scb[0]) {
|
|
103 | 199 | if ((req_hdr->scb[1] & 0x1f) != 0x10)
|
104 | 200 | goto error;
|
105 | 201 | case INQUIRY:
|
106 |
| ---- iscsitarget-1.4.20.3+svn502_org/kernel/iscsi.h 2015-08-24 16:13:26.481924679 +0530 |
107 |
| -+++ iscsitarget-1.4.20.3+svn502/kernel/iscsi.h 2015-08-24 17:35:31.354690051 +0530 |
108 |
| -@@ -257,7 +257,11 @@ struct iscsi_conn { |
109 |
| - struct timer_list nop_timer; |
110 |
| - |
111 |
| - struct iscsi_cmnd *read_cmnd; |
| 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; |
112 | 214 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
|
113 |
| -+ struct user_msghdr read_msg; |
114 |
| -+#else |
115 |
| - struct msghdr read_msg; |
| 215 | ++ iov_iter_init(&conn->read_msg.msg_iter, READ, conn->read_iov, 1, conn->read_size); |
116 | 216 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */
|
117 |
| - struct iovec read_iov[ISCSI_CONN_IOV_MAX]; |
118 |
| - u32 read_size; |
119 |
| - u32 read_overflow; |
120 |
| ---- iscsitarget-1.4.20.3+svn502_org/kernel/nthread.c 2015-08-24 16:13:26.481924679 +0530 |
121 |
| -+++ iscsitarget-1.4.20.3+svn502/kernel/nthread.c 2015-08-24 17:41:56.187428925 +0530 |
122 |
| -@@ -80,8 +80,11 @@ static int is_data_available(struct iscs |
123 |
| - set_fs(oldfs); |
124 |
| - return (res >= 0) ? avail : res; |
125 | 217 | }
|
126 |
| -- |
127 |
| -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) |
128 |
| -+static void forward_iov(struct user_msghdr *msg, int len) |
129 |
| -+#else |
| 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 | + |
130 | 222 | static void forward_iov(struct msghdr *msg, int len)
|
131 |
| -+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ |
132 | 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 |
133 | 233 | while (msg->msg_iov->iov_len <= len) {
|
134 | 234 | len -= msg->msg_iov->iov_len;
|
135 |
| -@@ -96,7 +99,11 @@ static void forward_iov(struct msghdr *m |
136 |
| - static int do_recv(struct iscsi_conn *conn, int state) |
137 |
| - { |
138 |
| - mm_segment_t oldfs; |
| 235 | + msg->msg_iov++; |
| 236 | + msg->msg_iovlen--; |
| 237 | + } |
| 238 | ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ |
| 239 | + |
139 | 240 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
|
140 |
| -+ struct user_msghdr msg; |
| 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; |
141 | 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; |
142 | 254 | struct msghdr msg;
|
143 |
| -+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ |
144 | 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) */ |
145 | 259 | int i, len, res;
|
146 | 260 |
|
147 |
| -@@ -461,7 +468,11 @@ static void exit_tx(struct iscsi_conn *c |
148 |
| - static int tx_ddigest(struct iscsi_cmnd *cmnd, int state) |
149 |
| - { |
150 |
| - int res, rest = cmnd->conn->write_size; |
| 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 | + |
151 | 266 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
|
152 |
| -+ struct user_msghdr msg = {.msg_flags = MSG_NOSIGNAL | MSG_DONTWAIT}; |
| 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); |
153 | 275 | +#else
|
154 |
| - struct msghdr msg = {.msg_flags = MSG_NOSIGNAL | MSG_DONTWAIT}; |
| 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 | + } |
155 | 282 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */
|
156 |
| - struct kvec iov; |
157 | 283 |
|
158 |
| - iov.iov_base = (char *) (&cmnd->ddigest) + (sizeof(u32) - rest); |
159 |
| ---- iscsitarget-1.4.20.3+svn502_org/kernel/target_disk.c 2015-08-24 16:13:26.481924679 +0530 |
160 |
| -+++ iscsitarget-1.4.20.3+svn502/kernel/target_disk.c 2015-08-24 17:43:42.167625159 +0530 |
| 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 |
161 | 289 | @@ -606,7 +606,11 @@ static int disk_execute_cmnd(struct iscs
|
162 | 290 | case REQUEST_SENSE:
|
163 | 291 | send_data_rsp(cmnd, build_request_sense_response);
|
|
166 | 294 | + case SERVICE_ACTION_IN_16:
|
167 | 295 | +#else
|
168 | 296 | case SERVICE_ACTION_IN:
|
169 |
| -+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ |
| 297 | ++#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ |
170 | 298 | send_data_rsp(cmnd, build_service_action_in_response);
|
171 | 299 | break;
|
172 | 300 | case READ_6:
|
173 |
| ---- iscsitarget-1.4.20.3+svn502_org/kernel/volume.c 2015-08-24 16:13:26.477924674 +0530 |
174 |
| -+++ iscsitarget-1.4.20.3+svn502/kernel/volume.c 2015-08-24 18:28:15.697074780 +0530 |
| 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 |
175 | 304 | @@ -398,7 +398,11 @@ int is_volume_reserved(struct iet_volume
|
176 | 305 | case READ_CAPACITY:
|
177 | 306 | /* allowed commands when reserved */
|
178 | 307 | break;
|
179 |
| -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) |
| 308 | ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) |
180 | 309 | + case SERVICE_ACTION_IN_16:
|
181 | 310 | +#else
|
182 | 311 | case SERVICE_ACTION_IN:
|
|
0 commit comments