diff options
Diffstat (limited to 'meta-networking/recipes-extended/iscsitarget/files/fix-errors-observed-with-linux-3.19-and-greater.patch')
-rw-r--r-- | meta-networking/recipes-extended/iscsitarget/files/fix-errors-observed-with-linux-3.19-and-greater.patch | 198 |
1 files changed, 198 insertions, 0 deletions
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 new file mode 100644 index 0000000000..6878ca2d06 --- /dev/null +++ b/meta-networking/recipes-extended/iscsitarget/files/fix-errors-observed-with-linux-3.19-and-greater.patch | |||
@@ -0,0 +1,198 @@ | |||
1 | Fix build errors with linux kernel v3.19 and above | ||
2 | |||
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. | ||
8 | |||
9 | error snippet: | ||
10 | -- 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: | ||
36 | -- 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 | |||
44 | References: | ||
45 | 1. https://github.com/torvalds/linux/commit/78d28e651f97866d608d9b41f8ad291e65d47dd5 | ||
46 | 2. https://github.com/torvalds/linux/commit/496ad9aa8ef448058e36ca7a787c61f2e63f0f54 | ||
47 | |||
48 | Upstream-Status: Pending | ||
49 | |||
50 | Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa@mvista.com> | ||
51 | |||
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 | ||
55 | |||
56 | dprintk(D_GENERIC, "%llu\n", (unsigned long long) session->sid); | ||
57 | |||
58 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
59 | + conn->sock = SOCKET_I(file_inode(conn->file)); | ||
60 | +#else | ||
61 | conn->sock = SOCKET_I(conn->file->f_dentry->d_inode); | ||
62 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
63 | conn->sock->sk->sk_user_data = conn; | ||
64 | |||
65 | 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 | ||
68 | @@ -69,7 +69,11 @@ static int fileio_make_request(struct ie | ||
69 | static int fileio_sync(struct iet_volume *lu, struct tio *tio) | ||
70 | { | ||
71 | struct fileio_data *p = lu->private; | ||
72 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
73 | + struct inode *inode = file_inode(p->filp); | ||
74 | +#else | ||
75 | struct inode *inode = p->filp->f_dentry->d_inode; | ||
76 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
77 | struct address_space *mapping = inode->i_mapping; | ||
78 | loff_t ppos, count; | ||
79 | int res; | ||
80 | @@ -213,7 +217,11 @@ static int fileio_attach(struct iet_volu | ||
81 | eprintk("%d\n", err); | ||
82 | goto out; | ||
83 | } | ||
84 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
85 | + inode = file_inode(p->filp); | ||
86 | +#else | ||
87 | inode = p->filp->f_dentry->d_inode; | ||
88 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
89 | |||
90 | if (S_ISREG(inode->i_mode)) | ||
91 | ; | ||
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 | ||
95 | set_cmnd_lunit(req); | ||
96 | |||
97 | switch (req_hdr->scb[0]) { | ||
98 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
99 | + case SERVICE_ACTION_IN_16: | ||
100 | +#else | ||
101 | case SERVICE_ACTION_IN: | ||
102 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
103 | if ((req_hdr->scb[1] & 0x1f) != 0x10) | ||
104 | goto error; | ||
105 | 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; | ||
112 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
113 | + struct user_msghdr read_msg; | ||
114 | +#else | ||
115 | struct msghdr read_msg; | ||
116 | +#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 | } | ||
126 | - | ||
127 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
128 | +static void forward_iov(struct user_msghdr *msg, int len) | ||
129 | +#else | ||
130 | static void forward_iov(struct msghdr *msg, int len) | ||
131 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
132 | { | ||
133 | while (msg->msg_iov->iov_len <= len) { | ||
134 | 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; | ||
139 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
140 | + struct user_msghdr msg; | ||
141 | +#else | ||
142 | struct msghdr msg; | ||
143 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
144 | struct iovec iov[ISCSI_CONN_IOV_MAX]; | ||
145 | int i, len, res; | ||
146 | |||
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; | ||
151 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
152 | + struct user_msghdr msg = {.msg_flags = MSG_NOSIGNAL | MSG_DONTWAIT}; | ||
153 | +#else | ||
154 | struct msghdr msg = {.msg_flags = MSG_NOSIGNAL | MSG_DONTWAIT}; | ||
155 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
156 | struct kvec iov; | ||
157 | |||
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 | ||
161 | @@ -606,7 +606,11 @@ static int disk_execute_cmnd(struct iscs | ||
162 | case REQUEST_SENSE: | ||
163 | send_data_rsp(cmnd, build_request_sense_response); | ||
164 | break; | ||
165 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
166 | + case SERVICE_ACTION_IN_16: | ||
167 | +#else | ||
168 | case SERVICE_ACTION_IN: | ||
169 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
170 | send_data_rsp(cmnd, build_service_action_in_response); | ||
171 | break; | ||
172 | 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 | ||
175 | @@ -398,7 +398,11 @@ int is_volume_reserved(struct iet_volume | ||
176 | case READ_CAPACITY: | ||
177 | /* allowed commands when reserved */ | ||
178 | break; | ||
179 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
180 | + case SERVICE_ACTION_IN_16: | ||
181 | +#else | ||
182 | case SERVICE_ACTION_IN: | ||
183 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
184 | if ((scb[1] & 0x1F) == 0x10) | ||
185 | break; | ||
186 | /* fall through */ | ||
187 | @@ -465,7 +469,11 @@ int is_volume_reserved(struct iet_volume | ||
188 | if (excl_access_ro && !registered) | ||
189 | err = -EBUSY; | ||
190 | break; | ||
191 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) | ||
192 | + case SERVICE_ACTION_IN_16: | ||
193 | +#else | ||
194 | case SERVICE_ACTION_IN: | ||
195 | +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ | ||
196 | if ((scb[1] & 0x1F) == 0x10) | ||
197 | break; | ||
198 | /* fall through */ | ||