Re: [PATCH v12 0/5] block layer runtime pm

2013-03-28 Thread Aaron Lu
On 03/23/2013 12:23 PM, Jens Axboe wrote:
 On Sat, Mar 23 2013, Aaron Lu wrote:
 In August 2010, Jens and Alan discussed about Runtime PM and the block
 layer. http://marc.info/?t=12825910841r=1w=2
 And then Alan has given a detailed implementation guide:
 http://marc.info/?l=linux-scsim=133727953625963w=2

 To test:
 # ls -l /sys/block/sda
 /sys/devices/pci:00/:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda

 # echo 1  
 /sys/devices/pci:00/:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/power/autosuspend_delay_ms
 # echo auto  
 /sys/devices/pci:00/:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/power/control
 Then you'll see sda is suspended after 10secs idle.

 [ 1767.680192] sd 2:0:0:0: [sda] Synchronizing SCSI cache
 [ 1767.680317] sd 2:0:0:0: [sda] Stopping disk

 And if you do some IO, it will resume immediately.
 [ 1791.052438] sd 2:0:0:0: [sda] Starting disk

 For test, I often set the autosuspend time to 1 second. If you are using
 a GUI, the 10 seconds delay may be too long that the disk can not enter
 runtime suspended state.

 Note that sd's runtime suspend callback will dump some kernel messages
 and the syslog daemon will write kernel message to /var/log/messages,
 making the disk instantly resume after suspended. So for test, the
 syslog daemon should better be temporarily stopped.

 A git repo for it, on top of block/for-next:
 https://github.com/aaronlu/linux.git blockpm

 v12:
 - Split patch 1 into 2 patches, one introduces REQ_PM in block layer
   and one uses that flag in SCSI layer, suggested by Jens Axboe.
 
 Thanks Aaron, I've applied 1, and 3-4. I'll leave 2 and 5 for James to
 pickup. James, if you want me to carry them, just let me know.

Hi James,

May I know your opinion on the two SCSI patches in this series?

Thanks,
Aaron

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


block: Allow merging of tail pages into the last segment

2013-03-28 Thread Jan Vesely

Hi

These patches modify __bio_add_page to accept pages that extent the last bio
segment. some drivers craft their buffers and rely on this behavior (see
message in patch 2 for details)

jan

v3: Use code from __blk_recalc_rq_segments to decide whether the page is
mergeable, 

v2: modify a comment

Jan Vesely (2):
  block: factor out vector mergeable decision to a helper function
  block: modify __bio_add_page check to accept pages that don't start a new

 block/blk-merge.c   | 52 +++-
 fs/bio.c| 29 ++---
 include/linux/bio.h |  3 +++
 3 files changed, 52 insertions(+), 32 deletions(-)

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 1/2] block: factor out vector mergeable decision to a helper function

2013-03-28 Thread Jan Vesely
Export the function so it can be used to predict segment counts
without calling the recalc function. This will be used in the next
patch.

Signed-off-by: Jan Vesely jves...@redhat.com

Cc: Alexander Viro v...@zeniv.linux.org.uk
Cc: James Bottomley james.bottom...@hansenpartnership.com
Cc: Jens Axboe ax...@kernel.dk
---
 block/blk-merge.c   | 52 +++-
 include/linux/bio.h |  3 +++
 2 files changed, 34 insertions(+), 21 deletions(-)

diff --git a/block/blk-merge.c b/block/blk-merge.c
index 936a110..e564f2c 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -9,11 +9,39 @@
 
 #include blk.h
 
+bool bvec_mergeable(struct request_queue *q, struct bio_vec *lastbv,
+   struct bio_vec *newbv, unsigned int seg_size)
+{
+   unsigned long limit = queue_bounce_pfn(q);
+
+   if (!blk_queue_cluster(q))
+   return false;
+
+   /*
+* the trick here is to make sure that a high page is
+* never considered part of another segment, since that
+* might change with the bounce page.
+*/
+   if ((page_to_pfn(lastbv-bv_page)  limit)
+   || (page_to_pfn(newbv-bv_page)  limit))
+   return false;
+
+   if (seg_size + newbv-bv_len  queue_max_segment_size(q))
+   return false;
+
+   if (!BIOVEC_PHYS_MERGEABLE(lastbv, newbv))
+   return false;
+   if (!BIOVEC_SEG_BOUNDARY(q, lastbv, newbv))
+   return false;
+   return true;
+}
+
+
 static unsigned int __blk_recalc_rq_segments(struct request_queue *q,
 struct bio *bio)
 {
struct bio_vec *bv, *bvprv = NULL;
-   int cluster, i, high, highprv = 1;
+   int i;
unsigned int seg_size, nr_phys_segs;
struct bio *fbio, *bbio;
 
@@ -21,33 +49,16 @@ static unsigned int __blk_recalc_rq_segments(struct 
request_queue *q,
return 0;
 
fbio = bio;
-   cluster = blk_queue_cluster(q);
seg_size = 0;
nr_phys_segs = 0;
for_each_bio(bio) {
bio_for_each_segment(bv, bio, i) {
-   /*
-* the trick here is making sure that a high page is
-* never considered part of another segment, since that
-* might change with the bounce page.
-*/
-   high = page_to_pfn(bv-bv_page)  queue_bounce_pfn(q);
-   if (high || highprv)
-   goto new_segment;
-   if (cluster) {
-   if (seg_size + bv-bv_len
-queue_max_segment_size(q))
-   goto new_segment;
-   if (!BIOVEC_PHYS_MERGEABLE(bvprv, bv))
-   goto new_segment;
-   if (!BIOVEC_SEG_BOUNDARY(q, bvprv, bv))
-   goto new_segment;
-
+   if (bvprv  bvec_mergeable(q, bvprv, bv, seg_size)) {
seg_size += bv-bv_len;
bvprv = bv;
continue;
}
-new_segment:
+   /* new segment */
if (nr_phys_segs == 1  seg_size 
fbio-bi_seg_front_size)
fbio-bi_seg_front_size = seg_size;
@@ -55,7 +66,6 @@ new_segment:
nr_phys_segs++;
bvprv = bv;
seg_size = bv-bv_len;
-   highprv = high;
}
bbio = bio;
}
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 820e7aa..bb95809 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -290,6 +290,9 @@ extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned 
long *, struct bio_set
 extern void bvec_free_bs(struct bio_set *, struct bio_vec *, unsigned int);
 extern unsigned int bvec_nr_vecs(unsigned short idx);
 
+extern bool bvec_mergeable(struct request_queue *q, struct bio_vec *lastbv,
+   struct bio_vec *newbv, unsigned int seg_size);
+
 #ifdef CONFIG_BLK_CGROUP
 int bio_associate_current(struct bio *bio);
 void bio_disassociate_task(struct bio *bio);
-- 
1.8.1.4

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 2/2] block: modify __bio_add_page check to accept pages that don't start a new segment

2013-03-28 Thread Jan Vesely
The original behavior was to refuse all pages after the maximum number of
segments has been reached. However, some drivers (like st) craft their buffers
to potentially require exactly max segments and multiple pages in the last
segment. This patch modifies the check to allow pages that can be merged into
the last segment.

Fixes EBUSY failures when using large  tape block size in high
memory fragmentation condition. This regression was introduced by commit
46081b166415acb66d4b3150ecefcd9460bb48a1
st: Increase success probability in driver buffer allocation

Signed-off-by: Jan Vesely jves...@redhat.com

Cc: Alexander Viro v...@zeniv.linux.org.uk
Cc: James Bottomley james.bottom...@hansenpartnership.com
Cc: Jens Axboe ax...@kernel.dk
---
 fs/bio.c | 29 ++---
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/fs/bio.c b/fs/bio.c
index bb5768f..cd5f961 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -500,7 +500,6 @@ static int __bio_add_page(struct request_queue *q, struct 
bio *bio, struct page
  *page, unsigned int len, unsigned int offset,
  unsigned short max_sectors)
 {
-   int retried_segments = 0;
struct bio_vec *bvec;
 
/*
@@ -551,18 +550,12 @@ static int __bio_add_page(struct request_queue *q, struct 
bio *bio, struct page
return 0;
 
/*
-* we might lose a segment or two here, but rather that than
-* make this too complex.
+* The first part of the segment count check,
+* reduce segment count if possible
 */
-
-   while (bio-bi_phys_segments = queue_max_segments(q)) {
-
-   if (retried_segments)
-   return 0;
-
-   retried_segments = 1;
+   if (bio-bi_phys_segments = queue_max_segments(q))
blk_recount_segments(q, bio);
-   }
+
 
/*
 * setup the new entry, we might clear it again later if we
@@ -574,6 +567,20 @@ static int __bio_add_page(struct request_queue *q, struct 
bio *bio, struct page
bvec-bv_offset = offset;
 
/*
+* the other part of the segment count check, allow mergeable pages.
+* BIO_SEG_VALID flag is cleared below
+*/
+   if ((bio-bi_phys_segments  queue_max_segments(q)) ||
+   ((bio-bi_phys_segments == queue_max_segments(q)) 
+!bvec_mergeable(q, __BVEC_END(bio), bvec, bio-bi_seg_back_size))) 
{
+   bvec-bv_page = NULL;
+   bvec-bv_len = 0;
+   bvec-bv_offset = 0;
+   return 0;
+   }
+
+
+   /*
 * if queue has other restrictions (eg varying max sector size
 * depending on offset), it can specify a merge_bvec_fn in the
 * queue to get further control
-- 
1.8.1.4

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/5] qla2xxx: Patches for scsi misc branch.

2013-03-28 Thread Saurav Kashyap
Hi James,

Please apply the following patches to the scsi tree at your earliest
convenience for inclusion in the next mainline merge window.

Thanks,
~Saurav

Giridhar Malavali (1):
  qla2xxx: Enhancements to support ISPFx00.

Joe Carnuccio (2):
  qla2xxx: Add clarifying printk to thermal access fail cases.
  qla2xxx: Obtain loopback iteration count from bsg request.

Saurav Kashyap (1):
  qla2xxx: Update the driver version to 8.05.00.03-k.

Wei Yongjun (1):
  qla2xxx: Remove duplicated include form qla_isr.c

 drivers/scsi/qla2xxx/Makefile  |2 +-
 drivers/scsi/qla2xxx/qla_attr.c|   35 +-
 drivers/scsi/qla2xxx/qla_bsg.c |  154 ++-
 drivers/scsi/qla2xxx/qla_bsg.h |1 +
 drivers/scsi/qla2xxx/qla_dbg.c |   27 +-
 drivers/scsi/qla2xxx/qla_def.h |  236 +++-
 drivers/scsi/qla2xxx/qla_gbl.h |   47 +-
 drivers/scsi/qla2xxx/qla_gs.c  |   16 +-
 drivers/scsi/qla2xxx/qla_init.c|   52 +-
 drivers/scsi/qla2xxx/qla_inline.h  |   41 +-
 drivers/scsi/qla2xxx/qla_iocb.c|   67 +-
 drivers/scsi/qla2xxx/qla_isr.c |   20 +-
 drivers/scsi/qla2xxx/qla_mbx.c |   10 +-
 drivers/scsi/qla2xxx/qla_mr.c  | 3476 
 drivers/scsi/qla2xxx/qla_mr.h  |  510 ++
 drivers/scsi/qla2xxx/qla_os.c  |  212 +++-
 drivers/scsi/qla2xxx/qla_version.h |4 +-
 17 files changed, 4803 insertions(+), 107 deletions(-)
 create mode 100644 drivers/scsi/qla2xxx/qla_mr.c
 create mode 100644 drivers/scsi/qla2xxx/qla_mr.h

-- 
1.7.7

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5] qla2xxx: Remove duplicated include form qla_isr.c

2013-03-28 Thread Saurav Kashyap
From: Wei Yongjun yongjun_...@trendmicro.com.cn

Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn
Signed-off-by: Saurav Kashyap saurav.kash...@qlogic.com
---
 drivers/scsi/qla2xxx/qla_isr.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 3f289c2..12e340e 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -13,8 +13,6 @@
 #include scsi/scsi_bsg_fc.h
 #include scsi/scsi_eh.h
 
-#include qla_target.h
-
 static void qla2x00_mbx_completion(scsi_qla_host_t *, uint16_t);
 static void qla2x00_status_entry(scsi_qla_host_t *, struct rsp_que *, void *);
 static void qla2x00_status_cont_entry(struct rsp_que *, sts_cont_entry_t *);
-- 
1.7.7

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/5] qla2xxx: Obtain loopback iteration count from bsg request.

2013-03-28 Thread Saurav Kashyap
From: Joe Carnuccio joe.carnuc...@qlogic.com

qla2x00_loopback_test() was hard setting the loopback iteration
count to 1 rather than obtaining it from the bsg request.

Signed-off-by: Joe Carnuccio joe.carnuc...@qlogic.com
Signed-off-by: Saurav Kashyap saurav.kash...@qlogic.com
---
 drivers/scsi/qla2xxx/qla_bsg.c |2 ++
 drivers/scsi/qla2xxx/qla_def.h |1 +
 drivers/scsi/qla2xxx/qla_mbx.c |5 ++---
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 8631a7e..a708bad 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -768,6 +768,8 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
elreq.transfer_size = req_data_len;
 
elreq.options = bsg_job-request-rqst_data.h_vendor.vendor_cmd[1];
+   elreq.iteration_count =
+   bsg_job-request-rqst_data.h_vendor.vendor_cmd[2];
 
if (atomic_read(vha-loop_state) == LOOP_READY 
(ha-current_topology == ISP_CFG_F ||
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index e52722d..c32efc7 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -417,6 +417,7 @@ struct msg_echo_lb {
uint16_t rsp_sg_cnt;
uint16_t options;
uint32_t transfer_size;
+   uint32_t iteration_count;
 };
 
 /*
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 3b6a41c..9e5d89d 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -4113,7 +4113,6 @@ qla2x00_loopback_test(scsi_qla_host_t *vha, struct 
msg_echo_lb *mreq,
int rval;
mbx_cmd_t mc;
mbx_cmd_t *mcp = mc;
-   uint32_t iter_cnt = 0x1;
 
ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x10f7,
Entered %s.\n, __func__);
@@ -4139,8 +4138,8 @@ qla2x00_loopback_test(scsi_qla_host_t *vha, struct 
msg_echo_lb *mreq,
mcp-mb[7] = MSW(MSD(mreq-rcv_dma));
 
/* Iteration count */
-   mcp-mb[18] = LSW(iter_cnt);
-   mcp-mb[19] = MSW(iter_cnt);
+   mcp-mb[18] = LSW(mreq-iteration_count);
+   mcp-mb[19] = MSW(mreq-iteration_count);
 
mcp-out_mb = MBX_21|MBX_20|MBX_19|MBX_18|MBX_17|MBX_16|MBX_15|
MBX_14|MBX_13|MBX_12|MBX_11|MBX_10|MBX_7|MBX_6|MBX_1|MBX_0;
-- 
1.7.7

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/5] qla2xxx: Update the driver version to 8.05.00.03-k.

2013-03-28 Thread Saurav Kashyap
Signed-off-by: Giridhar Malavali giridhar.malav...@qlogic.com
Signed-off-by: Saurav Kashyap saurav.kash...@qlogic.com
---
 drivers/scsi/qla2xxx/qla_version.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_version.h 
b/drivers/scsi/qla2xxx/qla_version.h
index ec54036..6c66d22 100644
--- a/drivers/scsi/qla2xxx/qla_version.h
+++ b/drivers/scsi/qla2xxx/qla_version.h
@@ -7,9 +7,9 @@
 /*
  * Driver version
  */
-#define QLA2XXX_VERSION  8.04.00.13-k
+#define QLA2XXX_VERSION  8.05.00.03-k
 
 #define QLA_DRIVER_MAJOR_VER   8
-#define QLA_DRIVER_MINOR_VER   4
+#define QLA_DRIVER_MINOR_VER   5
 #define QLA_DRIVER_PATCH_VER   0
 #define QLA_DRIVER_BETA_VER0
-- 
1.7.7

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/6] scsi: replace obsolete NLMSG_* with type safe nlmsg_*

2013-03-28 Thread Thomas Graf
On 03/28/13 at 12:53am, Hong Zhiguo wrote:
 Signed-off-by: Hong Zhiguo honk...@gmail.com

There are some formatting errors but the Netlink bits themselves
look good.
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/6] scsi: replace obsolete NLMSG_* with type safe nlmsg_*

2013-03-28 Thread Hong zhi guo
Thanks, Thomas. But I didn't change any formatting. Just do the
substitution in place.

On Thu, Mar 28, 2013 at 10:45 PM, Thomas Graf tg...@suug.ch wrote:
 On 03/28/13 at 12:53am, Hong Zhiguo wrote:
 Signed-off-by: Hong Zhiguo honk...@gmail.com

 There are some formatting errors but the Netlink bits themselves
 look good.



-- 
best regards
Hong Zhiguo
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: error handler scheduling

2013-03-28 Thread Elliott, Robert (Server Storage)
There are several possible reasons for SCSI command timeouts:
a) the command request did not get to the SCSI target port and logical
   unit (e.g., error on the wire)
b) logical unit is still working on the command
c) the command completed, but status didn't get to the SCSI initiator port 
   and application client (e.g., error on the wire)

SCSI doesn't have a good way to detect case (c). For status delivery errors
detected by the logical unit, I once proposed that the logical unit establish
a unit attention condition and record the status delivery problem in a log
page (T10 proposal 04-072) but this proposal didn't draw much interest. The 
QUERY TASK task management function can detect case (b) vs. the other cases.

With SSDs, a lengthy timeout derived from ancient SCSI floppy drives doesn't
make sense. Timeouts should scale automatically based on the device type
(e.g., use microseconds for SSDs and seconds for HDDs). The REPORT
SUPPORTED OPERATION CODES command provides some command timeout values
to facilitate this.

For Base feature set drives I'm encouraging an approach like this for 
handling command timeouts:

1) at discovery time:
1a) send REPORT SUPPORTED OPERATION CODES to determine the nominal
and maximum command timeouts
1b) send REPORT SUPPORTED TASK MANAGEMENT FUNCTION to determine 
the TMF timeouts

2) send the command (e.g., READ, WRITE, FORMAT UNIT, ...)

If status arrives for the command at any time, exit out of this procedure. 
If an I_T nexus loss occurs, then that handling overrides this procedure
as well. Otherwise:

3) if the nominal command timeout is long (e.g., for a command like FORMAT
UNIT with IMMED=0, but not for IO commands like READ and WRITE), then wait
a short time and send QUERY TASK to ensure the command got there:
3a) if the command is not there (probably lost in delivery, but
possibly lost status), go to step (2) to resend the command
3b) if the command is still being processed, keep waiting

4) if the nominal command timeout is reached, send QUERY TASK to determine
what is happening:
4a) if the command is not there (if step (3) was run, then this
probably means lost status), go to step (2) to resend the command
4b) if the command is still being processed, keep waiting

5) if the maximum command timeout is reached, send QUERY TASK to determine
what is happening:
5a) if the command is not there (since step (4) was run, this
 probably means lost status), go to step (2) to resend the command
5b) if the command is still being processed, proceed to step (6)
to abort the command

6) send ABORT TASK to abort the command

7) If ABORT TASK succeeds, either:
7a) escalate to a stronger TMF or hard reset if this command
   keeps having repeated problems; or
7b) go to step (2) to resend the command

8) If the ABORT TASK timeout is reached, either:
8a) escalate to a stronger TMF or hard reset, then go to step (2) 
to resend the command; or
8b) declare the logical unit is unavailable

Doug: for ***, In addition to WSNZ bit now letting the drive not support
the value of zero, T10 proposal 13-052 changes WRITE SAME so the NUMBER 
OF LOGICAL BLOCKS set to zero (if supported) must honor the MAXIMUM WRITE
SAME LENGTH field, so the drive can provide a reasonable timeout value
for the command (not worry that the entire capacity might be specified).

---
Rob ElliottHP Server Storage



 -Original Message-
 From: linux-scsi-ow...@vger.kernel.org [mailto:linux-scsi-
 ow...@vger.kernel.org] On Behalf Of Douglas Gilbert
 Sent: Wednesday, 27 March, 2013 9:39 AM
 To: james.sm...@emulex.com
 Cc: linux-scsi@vger.kernel.org
 Subject: Re: error handler scheduling
 
 On 13-03-26 10:11 PM, James Smart wrote:
  In looking through the error handler, if a command times out and is added to
 the
  eh_cmd_q for the shost, the error handler is only awakened once shost-
 host_busy
  (total number of i/os posted to the shost) is equal to shost-host_failed
  (number of i/o that have been failed and put on the eh_cmd_q).  Which
 means, any
  other i/o that was outstanding must either complete or have their timeout
 fire.
  Additionally, as all further i/o is held off at the block layer as the 
  shost is
  in recovery, new i/o cannot be submitted until the error handler runs and
  resolves the errored i/os.
 
  Is this true ?
 
  I take it is also true that the midlayer thus expects every i/o to have an 
  i/o
  timeout.  True ?
 
  The crux of this point is that when the recovery thread runs to aborts the
 timed
  out i/os, is at the mercy of the last command to complete or timeout.
  Additionally, as all further i/o is held off at the block layer as the 
  shost is
  in recovery, new i/o cannot be submitted until the error handler runs and
  resolves the errored i/os. So all I/O on the host is stopped until that 
  last i/o
  completes/times out.   The timeouts may be eons 

Re: [PATCH 5/6] scsi: replace obsolete NLMSG_* with type safe nlmsg_*

2013-03-28 Thread Mike Christie
On 03/27/2013 11:53 AM, Hong Zhiguo wrote:
 Signed-off-by: Hong Zhiguo honk...@gmail.com
 ---
  drivers/scsi/scsi_netlink.c |4 +--
  drivers/scsi/scsi_transport_fc.c|   21 +
  drivers/scsi/scsi_transport_iscsi.c |   56 
 +--
  3 files changed, 38 insertions(+), 43 deletions(-)
 

iscsi parts are ok. I also ran some quick tests on them.

Reviewed-by: Mike Christie micha...@cs.wisc.edu

--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/6] scsi: replace obsolete NLMSG_* with type safe nlmsg_*

2013-03-28 Thread David Miller
From: Thomas Graf tg...@suug.ch
Date: Thu, 28 Mar 2013 14:45:02 +

 On 03/28/13 at 12:53am, Hong Zhiguo wrote:
 Signed-off-by: Hong Zhiguo honk...@gmail.com
 
 There are some formatting errors but the Netlink bits themselves
 look good.
 

I'll fix these up too when I commit.
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch] scsi_dh_hp_sw.c: return DEV_OFFLINED when blk_get_request fails

2013-03-28 Thread Jeff Moyer
Hi,

If blk_get_requet fails here, it means that the queue is dead.  It seems
better to return a DEV_OFFLINED error code than the misleading
TEMP_UNAVAIL.  Comments?

Signed-off-by: Jeff Moyer jmo...@redhat.com

diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c 
b/drivers/scsi/device_handler/scsi_dh_hp_sw.c
index 084062b..eec24d3 100644
--- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c
+++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c
@@ -118,7 +118,7 @@ static int hp_sw_tur(struct scsi_device *sdev, struct 
hp_sw_dh_data *h)
 retry:
req = blk_get_request(sdev-request_queue, WRITE, GFP_NOIO);
if (!req)
-   return SCSI_DH_RES_TEMP_UNAVAIL;
+   return SCSI_DH_DEV_OFFLINED;
 
req-cmd_type = REQ_TYPE_BLOCK_PC;
req-cmd_flags |= REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT |
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch] scsi_dh_hp_sw.c: return DEV_OFFLINED when blk_get_request fails

2013-03-28 Thread Mike Christie
On 03/28/2013 02:32 PM, Jeff Moyer wrote:
 Hi,
 
 If blk_get_requet fails here, it means that the queue is dead.  It seems
 better to return a DEV_OFFLINED error code than the misleading
 TEMP_UNAVAIL.  Comments?
 
 Signed-off-by: Jeff Moyer jmo...@redhat.com
 
 diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c 
 b/drivers/scsi/device_handler/scsi_dh_hp_sw.c
 index 084062b..eec24d3 100644
 --- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c
 +++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c
 @@ -118,7 +118,7 @@ static int hp_sw_tur(struct scsi_device *sdev, struct 
 hp_sw_dh_data *h)
  retry:
   req = blk_get_request(sdev-request_queue, WRITE, GFP_NOIO);
   if (!req)
 - return SCSI_DH_RES_TEMP_UNAVAIL;
 + return SCSI_DH_DEV_OFFLINED;

Can we always assume that if using GFP_NOIO then resource allocation
failures will never be returned to us? If so, then the patch is fine. If
not then do we want to base this patch on top of block: handle pointer
error from blk_get_request and check the return value. If -ENOMEM then
return SCSI_DH_RES_TEMP_UNAVAIL, and if -ENODEV then return
SCSI_DH_DEV_OFFLINED.

You probably then want to also fix up scsi_dh_alua and scsi_dh_emc the
same way. It looks like they have the same issue.

scsi_dh_emc looks like it has extra errors in that the failure checks
for send_inquiry_cmd do not handle get_req failures properly. It looks
like it ignore them if the senselen is not set.


  
   req-cmd_type = REQ_TYPE_BLOCK_PC;
   req-cmd_flags |= REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT |
 --
 To unsubscribe from this list: send the line unsubscribe linux-scsi in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch] scsi_dh_hp_sw.c: return DEV_OFFLINED when blk_get_request fails

2013-03-28 Thread Joe Lawrence
On Thu, 28 Mar 2013 15:32:12 -0400
Jeff Moyer jmo...@redhat.com wrote:

 Hi,
 
 If blk_get_requet fails here, it means that the queue is dead.  It
 seems better to return a DEV_OFFLINED error code than the misleading
 TEMP_UNAVAIL.  Comments?
 
 Signed-off-by: Jeff Moyer jmo...@redhat.com
 
 diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c
 b/drivers/scsi/device_handler/scsi_dh_hp_sw.c index 084062b..eec24d3
 100644 --- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c
 +++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c
 @@ -118,7 +118,7 @@ static int hp_sw_tur(struct scsi_device *sdev,
 struct hp_sw_dh_data *h) retry:
   req = blk_get_request(sdev-request_queue, WRITE, GFP_NOIO);
   if (!req)
 - return SCSI_DH_RES_TEMP_UNAVAIL;
 + return SCSI_DH_DEV_OFFLINED;
  
   req-cmd_type = REQ_TYPE_BLOCK_PC;
   req-cmd_flags |= REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT |

Hi Jeff,

How about hp_sw_start_stop?  It calls blk_get_request with GFP_ATOMIC,
so it might see !req for dead queue or no memory.

-- Joe
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] scsi_dh_alua: Add module parameter to allow failover to non preferred path without STPG

2013-03-28 Thread Stewart, Sean
Currently ALUA device handler sends STPG command during failover and failback.
Failover can be optimized by implicit failover (by not to sending STPG command),
when 1 is passed as hwhandler parameter in multipath.conf. ex 2 alua 1. We may
need to pass the parameter through module param for alua device handler to 
optimize
failover if incase retain_attached_hwhandler set in multipath.conf and hwhandler
is set with non-tpgs device handler ex: '1 rdac'.

Signed-off-by: Vijay Chauhan vijay.chau...@netapp.com
Signed-off-by: Sean Stewart sean.stew...@netapp.com

---
--- a/drivers/scsi/device_handler/scsi_dh_alua.c.orig   2013-03-27 
12:18:35.0 +0530
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c2013-03-27 
13:23:16.0 +0530
@@ -710,6 +710,10 @@ static int alua_set_params(struct scsi_d
return result;
 }
 
+static uint optimize_stpg;
+module_param(optimize_stpg, uint, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(optimize_stpg, Send STPG command for Failover on 
non-preferred path(0=Yes,1=No). Default is 0.);
+
 /*
  * alua_activate - activate a path
  * @sdev: device on the path to be activated
@@ -731,6 +735,9 @@ static int alua_activate(struct scsi_dev
if (err != SCSI_DH_OK)
goto out;
 
+   if (optimize_stpg)
+   h-flags |= ALUA_OPTIMIZE_STPG;
+
if (h-tpgs  TPGS_MODE_EXPLICIT) {
switch (h-state) {
case TPGS_STATE_NONOPTIMIZED:
--
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html