Skip to content

Instantly share code, notes, and snippets.

@Saneyan
Last active September 4, 2016 21:38
Show Gist options
  • Save Saneyan/0a4c8e077f05cf54b2f9 to your computer and use it in GitHub Desktop.
Save Saneyan/0a4c8e077f05cf54b2f9 to your computer and use it in GitHub Desktop.
A patch file for iscsitarget for Linux (checked only version 4.0.1)
diff -ur iscsitarget/kernel/conn.c iscsitarget.patched/kernel/conn.c
--- iscsitarget/kernel/conn.c 2015-05-05 18:11:24.000000000 +0000
+++ iscsitarget.patched/kernel/conn.c 2015-05-05 18:01:40.000000000 +0000
@@ -127,7 +127,7 @@
dprintk(D_GENERIC, "%llu\n", (unsigned long long) session->sid);
- conn->sock = SOCKET_I(conn->file->f_dentry->d_inode);
+ conn->sock = SOCKET_I(conn->file->f_path.dentry->d_inode);
conn->sock->sk->sk_user_data = conn;
write_lock_bh(&conn->sock->sk->sk_callback_lock);
diff -ur iscsitarget/kernel/file-io.c iscsitarget.patched/kernel/file-io.c
--- iscsitarget/kernel/file-io.c 2015-05-05 18:11:24.000000000 +0000
+++ iscsitarget.patched/kernel/file-io.c 2015-05-05 18:03:10.000000000 +0000
@@ -69,7 +69,7 @@
static int fileio_sync(struct iet_volume *lu, struct tio *tio)
{
struct fileio_data *p = lu->private;
- struct inode *inode = p->filp->f_dentry->d_inode;
+ struct inode *inode = p->filp->f_path.dentry->d_inode;
struct address_space *mapping = inode->i_mapping;
loff_t ppos, count;
int res;
@@ -213,7 +213,7 @@
eprintk("%d\n", err);
goto out;
}
- inode = p->filp->f_dentry->d_inode;
+ inode = p->filp->f_path.dentry->d_inode;
if (S_ISREG(inode->i_mode))
;
diff -ur iscsitarget/kernel/iscsi.c iscsitarget.patched/kernel/iscsi.c
--- iscsitarget/kernel/iscsi.c 2015-05-05 18:11:24.000000000 +0000
+++ iscsitarget.patched/kernel/iscsi.c 2015-05-05 17:59:39.000000000 +0000
@@ -986,9 +986,6 @@
set_cmnd_lunit(req);
switch (req_hdr->scb[0]) {
- case SERVICE_ACTION_IN:
- if ((req_hdr->scb[1] & 0x1f) != 0x10)
- goto error;
case INQUIRY:
case REPORT_LUNS:
case TEST_UNIT_READY:
diff -ur iscsitarget/kernel/iscsi.h iscsitarget.patched/kernel/iscsi.h
--- iscsitarget/kernel/iscsi.h 2015-05-05 18:11:24.000000000 +0000
+++ iscsitarget.patched/kernel/iscsi.h 2015-05-05 17:52:33.000000000 +0000
@@ -257,7 +257,7 @@
struct timer_list nop_timer;
struct iscsi_cmnd *read_cmnd;
- struct msghdr read_msg;
+ struct user_msghdr read_msg;
struct iovec read_iov[ISCSI_CONN_IOV_MAX];
u32 read_size;
u32 read_overflow;
diff -ur iscsitarget/kernel/nthread.c iscsitarget.patched/kernel/nthread.c
--- iscsitarget/kernel/nthread.c 2015-05-05 18:11:24.000000000 +0000
+++ iscsitarget.patched/kernel/nthread.c 2015-05-05 18:00:53.000000000 +0000
@@ -81,7 +81,7 @@
return (res >= 0) ? avail : res;
}
-static void forward_iov(struct msghdr *msg, int len)
+static void forward_iov(struct user_msghdr *msg, int len)
{
while (msg->msg_iov->iov_len <= len) {
len -= msg->msg_iov->iov_len;
@@ -96,7 +96,7 @@
static int do_recv(struct iscsi_conn *conn, int state)
{
mm_segment_t oldfs;
- struct msghdr msg;
+ struct user_msghdr msg;
struct iovec iov[ISCSI_CONN_IOV_MAX];
int i, len, res;
@@ -461,7 +461,7 @@
static int tx_ddigest(struct iscsi_cmnd *cmnd, int state)
{
int res, rest = cmnd->conn->write_size;
- struct msghdr msg = {.msg_flags = MSG_NOSIGNAL | MSG_DONTWAIT};
+ struct user_msghdr msg = {.msg_flags = MSG_NOSIGNAL | MSG_DONTWAIT};
struct kvec iov;
iov.iov_base = (char *) (&cmnd->ddigest) + (sizeof(u32) - rest);
diff -ur iscsitarget/kernel/target_disk.c iscsitarget.patched/kernel/target_disk.c
--- iscsitarget/kernel/target_disk.c 2015-05-05 18:11:24.000000000 +0000
+++ iscsitarget.patched/kernel/target_disk.c 2015-05-05 18:04:09.000000000 +0000
@@ -606,9 +606,6 @@
case REQUEST_SENSE:
send_data_rsp(cmnd, build_request_sense_response);
break;
- case SERVICE_ACTION_IN:
- send_data_rsp(cmnd, build_service_action_in_response);
- break;
case READ_6:
case READ_10:
case READ_16:
diff -ur iscsitarget/kernel/volume.c iscsitarget.patched/kernel/volume.c
--- iscsitarget/kernel/volume.c 2015-05-05 18:11:24.000000000 +0000
+++ iscsitarget.patched/kernel/volume.c 2015-05-05 18:02:29.000000000 +0000
@@ -398,9 +398,6 @@
case READ_CAPACITY:
/* allowed commands when reserved */
break;
- case SERVICE_ACTION_IN:
- if ((scb[1] & 0x1F) == 0x10)
- break;
/* fall through */
default:
err = -EBUSY;
@@ -465,9 +462,6 @@
if (excl_access_ro && !registered)
err = -EBUSY;
break;
- case SERVICE_ACTION_IN:
- if ((scb[1] & 0x1F) == 0x10)
- break;
/* fall through */
case RELEASE:
case RESERVE:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment