summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/iscsi_tcp.c
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2013-04-10 11:24:39 -0500
committerJames Bottomley <JBottomley@Parallels.com>2013-04-11 16:55:04 -0700
commit9e45dd73234af9a59613dc2989dcc2df2dab847f (patch)
tree705342323a3cbf8de94725462407ce4ba734360a /drivers/scsi/iscsi_tcp.c
parent1fc2b00fba55f70ab32ecc493efbca9a1a76a4e3 (diff)
downloadop-kernel-dev-9e45dd73234af9a59613dc2989dcc2df2dab847f.zip
op-kernel-dev-9e45dd73234af9a59613dc2989dcc2df2dab847f.tar.gz
[SCSI] iscsi_tcp: support PF_MEMALLOC/__GFP_MEMALLOC
This patch has software iscsi use PF_MEMALLOC/__GFP_MEMALLOC to be able to better support swap over iscsi disks similar to what was added for nbd. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/iscsi_tcp.c')
-rw-r--r--drivers/scsi/iscsi_tcp.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 1b91ca0..9e2588a 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -370,17 +370,24 @@ static inline int iscsi_sw_tcp_xmit_qlen(struct iscsi_conn *conn)
static int iscsi_sw_tcp_pdu_xmit(struct iscsi_task *task)
{
struct iscsi_conn *conn = task->conn;
- int rc;
+ unsigned long pflags = current->flags;
+ int rc = 0;
+
+ current->flags |= PF_MEMALLOC;
while (iscsi_sw_tcp_xmit_qlen(conn)) {
rc = iscsi_sw_tcp_xmit(conn);
- if (rc == 0)
- return -EAGAIN;
+ if (rc == 0) {
+ rc = -EAGAIN;
+ break;
+ }
if (rc < 0)
- return rc;
+ break;
+ rc = 0;
}
- return 0;
+ tsk_restore_flags(current, pflags, PF_MEMALLOC);
+ return rc;
}
/*
@@ -665,6 +672,7 @@ iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session,
sk->sk_reuse = SK_CAN_REUSE;
sk->sk_sndtimeo = 15 * HZ; /* FIXME: make it configurable */
sk->sk_allocation = GFP_ATOMIC;
+ sk_set_memalloc(sk);
iscsi_sw_tcp_conn_set_callbacks(conn);
tcp_sw_conn->sendpage = tcp_sw_conn->sock->ops->sendpage;
OpenPOWER on IntegriCloud