  	conn->sock->sk->sk_user_data = conn;
  
  	write_lock_bh(&conn->sock->sk->sk_callback_lock);
---- iscsitarget-1.4.20.3+svn502_org/kernel/file-io.c	2015-08-24 16:13:26.481924679 +0530
-+++ iscsitarget-1.4.20.3+svn502/kernel/file-io.c	2015-08-24 17:30:54.390131100 +0530
+diff -Naurp iscsitarget-1.4.20.3+svn502_org/kernel/file-io.c iscsitarget-1.4.20.3+svn502/kernel/file-io.c
+--- iscsitarget-1.4.20.3+svn502_org/kernel/file-io.c	2014-05-06 13:59:55.000000000 -0700
++++ iscsitarget-1.4.20.3+svn502/kernel/file-io.c	2017-01-18 23:54:38.505717079 -0800
 @@ -69,7 +69,11 @@ static int fileio_make_request(struct ie
  static int fileio_sync(struct iet_volume *lu, struct tio *tio)
  {

Fix build errors with linux kernel v3.19 and above

Below errors came up while building iscsitarget for 
qemux86-64 (and others) because,
1. 'struct user_msghdr' is being used for userland-side msghdr instead
of 'struct msghdr', which is used for kernel-side msghdr in linux v3.19
and above.

error snippet:
-- snip --
| /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':
| /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'
|   conn->read_msg.msg_iov = conn->read_iov;
-- CUT --

Reference:
https://github.com/torvalds/linux/commit/666547ff591cebdedc4679bf6b1b3f3383a8dea3

2. 'SERVICE_ACTION_IN' has been renamed to SERVICE_ACTION_IN_16 in linux v3.19
and above.

error snippet:
-- snip --
| /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':
| /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)
|   case SERVICE_ACTION_IN:
-- CUT --

Reference:
https://github.com/torvalds/linux/commit/eb846d9f147455e4e5e1863bfb5e31974bb69b7c

3. In linux v3.19 and above, f_dentry member has been removed from 
'struct file' structure.

error snippet:
-- snip --
| /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':
| /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'
|   conn->sock = SOCKET_I(conn->file->f_dentry->d_inode);
-- CUT --

new helper function file_inode(file) should be used instead.

References:
1. https://github.com/torvalds/linux/commit/78d28e651f97866d608d9b41f8ad291e65d47dd5
2. https://github.com/torvalds/linux/commit/496ad9aa8ef448058e36ca7a787c61f2e63f0f54

Upstream-Status: Pending

Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa@mvista.com>

--- iscsitarget-1.4.20.3+svn502_org/kernel/conn.c	2015-08-24 16:13:26.481924679 +0530
+++ iscsitarget-1.4.20.3+svn502/kernel/conn.c	2015-08-24 17:27:06.897653698 +0530
@@ -127,7 +127,11 @@ static void iet_socket_bind(struct iscsi
 
 	dprintk(D_GENERIC, "%llu\n", (unsigned long long) session->sid);
 

 		if ((req_hdr->scb[1] & 0x1f) != 0x10)
 			goto error;
 	case INQUIRY:
diff -Naurp iscsitarget-1.4.20.3+svn502_org/kernel/nthread.c iscsitarget-1.4.20.3+svn502/kernel/nthread.c
--- iscsitarget-1.4.20.3+svn502_org/kernel/nthread.c	2014-05-06 13:59:55.000000000 -0700
+++ iscsitarget-1.4.20.3+svn502/kernel/nthread.c	2017-01-18 23:45:03.291033881 -0800
@@ -42,9 +42,14 @@ static inline void iscsi_conn_init_read(
 	len = (len + 3) & -4; // XXX ???
 	conn->read_iov[0].iov_base = data;
 	conn->read_iov[0].iov_len = len;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
 	conn->read_msg.msg_iov = conn->read_iov;
 	conn->read_msg.msg_iovlen = 1;
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) */
 	conn->read_size = (len + 3) & -4;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
+	iov_iter_init(&conn->read_msg.msg_iter, READ, conn->read_iov, 1, conn->read_size);
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */
 }
 
 static void iscsi_conn_read_ahs(struct iscsi_conn *conn, struct iscsi_cmnd *cmnd)
@@ -83,14 +88,31 @@ static int is_data_available(struct iscs
 
 static void forward_iov(struct msghdr *msg, int len)
 {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
+	struct iovec *iov;
+
+	while (msg->msg_iter.iov->iov_len <= len) {
+		len -= msg->msg_iter.iov->iov_len;
+		msg->msg_iter.iov++;
+		msg->msg_iter.nr_segs--;
+	}
+#else
 	while (msg->msg_iov->iov_len <= len) {
 		len -= msg->msg_iov->iov_len;
 		msg->msg_iov++;
 		msg->msg_iovlen--;
 	}
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
+	/* XXX: discards const ... */
+	iov = msg->msg_iter.iov;
+	iov->iov_base = (char *) msg->msg_iter.iov->iov_base + len;
+	iov->iov_len -= len;
+#else
 	msg->msg_iov->iov_base = (char *) msg->msg_iov->iov_base + len;
 	msg->msg_iov->iov_len -= len;
+#endif	/* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */
 }
 
 static int do_recv(struct iscsi_conn *conn, int state)
@@ -98,6 +120,9 @@ static int do_recv(struct iscsi_conn *co
 	mm_segment_t oldfs;
 	struct msghdr msg;
 	struct iovec iov[ISCSI_CONN_IOV_MAX];
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
+	size_t iovlen = ISCSI_CONN_IOV_MAX;
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */
 	int i, len, res;
 
 	if (!test_bit(CONN_ACTIVE, &conn->state)) {
@@ -110,12 +135,23 @@ static int do_recv(struct iscsi_conn *co
 		goto out;
 	}
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
+	if (conn->read_msg.msg_iter.nr_segs < iovlen)
+		iovlen = conn->read_msg.msg_iter.nr_segs;
+
+	for (i = 0, len = 0; i < iovlen; i++) {
+		iov[i] = conn->read_msg.msg_iter.iov[i];
+		len += iov[i].iov_len;
+	}
+	iov_iter_init(&msg.msg_iter, READ, iov, iovlen, len);
+#else
 	msg.msg_iov = iov;
 	msg.msg_iovlen = min_t(size_t, conn->read_msg.msg_iovlen, ISCSI_CONN_IOV_MAX);
 	for (i = 0, len = 0; i < msg.msg_iovlen; i++) {
 		iov[i] = conn->read_msg.msg_iov[i];
 		len += iov[i].iov_len;
 	}
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */
 
 	oldfs = get_fs();
 	set_fs(get_ds());
diff -Naurp iscsitarget-1.4.20.3+svn502_org/kernel/target_disk.c iscsitarget-1.4.20.3+svn502/kernel/target_disk.c
--- iscsitarget-1.4.20.3+svn502_org/kernel/target_disk.c	2014-05-06 13:59:55.000000000 -0700
+++ iscsitarget-1.4.20.3+svn502/kernel/target_disk.c	2017-01-18 23:45:51.451010417 -0800
@@ -606,7 +606,11 @@ static int disk_execute_cmnd(struct iscs
 	case REQUEST_SENSE:
 		send_data_rsp(cmnd, build_request_sense_response);
