* [PATCH 0/2] iscsi changes for scsi misc
@ 2013-04-10 16:24 michaelc
2013-04-10 16:24 ` [PATCH 1/2] libiscsi: avoid unnecessary multiple NULL assignments michaelc
2013-04-10 16:24 ` [PATCH 2/2] iscsi_tcp: support PF_MEMALLOC/__GFP_MEMALLOC michaelc
0 siblings, 2 replies; 4+ messages in thread
From: michaelc @ 2013-04-10 16:24 UTC (permalink / raw)
To: linux-scsi
The following 2 patches are for the misc branch in the scsi tree.
They cleanup duplicated code from a previous patch and add
better support for swap over software iscsi by using the
PF_MEMALLOC/__GFP_MEMALLOC flags like what was recently added for
nbd.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] libiscsi: avoid unnecessary multiple NULL assignments
2013-04-10 16:24 [PATCH 0/2] iscsi changes for scsi misc michaelc
@ 2013-04-10 16:24 ` michaelc
2013-04-10 16:28 ` Mike Christie
2013-04-10 16:24 ` [PATCH 2/2] iscsi_tcp: support PF_MEMALLOC/__GFP_MEMALLOC michaelc
1 sibling, 1 reply; 4+ messages in thread
From: michaelc @ 2013-04-10 16:24 UTC (permalink / raw)
To: linux-scsi; +Cc: Masatake YAMATO, Mike Christie
From: Masatake YAMATO <yamato@redhat.com>
In iscsi_free_task, NULL is assigned to task->sc twice: before and
after kfifo_in invocatoin. Allocating and freeing iscsi_task are guarded
with session->lock, so multiple NULL assignments cause no trouble. But
people reading the source code may be confused.
The second NULL assignment comes from commit:
3e5c28ad0391389959ccae81c938c7533efb3490
It seems that the line after kfifo_in invocation was introduced
accidentally.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
---
drivers/scsi/libiscsi.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index d5e5c44..5de9469 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -507,7 +507,6 @@ static void iscsi_free_task(struct iscsi_task *task)
kfifo_in(&session->cmdpool.queue, (void*)&task, sizeof(void*));
if (sc) {
- task->sc = NULL;
/* SCSI eh reuses commands to verify us */
sc->SCp.ptr = NULL;
/*
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] iscsi_tcp: support PF_MEMALLOC/__GFP_MEMALLOC
2013-04-10 16:24 [PATCH 0/2] iscsi changes for scsi misc michaelc
2013-04-10 16:24 ` [PATCH 1/2] libiscsi: avoid unnecessary multiple NULL assignments michaelc
@ 2013-04-10 16:24 ` michaelc
1 sibling, 0 replies; 4+ messages in thread
From: michaelc @ 2013-04-10 16:24 UTC (permalink / raw)
To: linux-scsi; +Cc: Mike Christie
From: Mike Christie <michaelc@cs.wisc.edu>
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>
---
drivers/scsi/iscsi_tcp.c | 18 +++++++++++++-----
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;
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] libiscsi: avoid unnecessary multiple NULL assignments
2013-04-10 16:24 ` [PATCH 1/2] libiscsi: avoid unnecessary multiple NULL assignments michaelc
@ 2013-04-10 16:28 ` Mike Christie
0 siblings, 0 replies; 4+ messages in thread
From: Mike Christie @ 2013-04-10 16:28 UTC (permalink / raw)
To: michaelc; +Cc: linux-scsi, Masatake YAMATO
On 04/10/2013 11:24 AM, michaelc@cs.wisc.edu wrote:
> From: Masatake YAMATO <yamato@redhat.com>
>
> In iscsi_free_task, NULL is assigned to task->sc twice: before and
> after kfifo_in invocatoin. Allocating and freeing iscsi_task are guarded
> with session->lock, so multiple NULL assignments cause no trouble. But
> people reading the source code may be confused.
>
> The second NULL assignment comes from commit:
>
> 3e5c28ad0391389959ccae81c938c7533efb3490
>
> It seems that the line after kfifo_in invocation was introduced
> accidentally.
>
> Signed-off-by: Masatake YAMATO <yamato@redhat.com>
> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
> Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Sorry about the incorrect signed of chain James. When I sent/made the
patches I added both a reviewed-by and signed-off to this one by accident.
Masatake made the patch. I am just resending to the list.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-04-10 16:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-10 16:24 [PATCH 0/2] iscsi changes for scsi misc michaelc
2013-04-10 16:24 ` [PATCH 1/2] libiscsi: avoid unnecessary multiple NULL assignments michaelc
2013-04-10 16:28 ` Mike Christie
2013-04-10 16:24 ` [PATCH 2/2] iscsi_tcp: support PF_MEMALLOC/__GFP_MEMALLOC michaelc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).