James Bottomley | 1 Nov 2011 13:35

Re: Do we need to implement sr START/STOP management

On Tue, 2011-11-01 at 14:35 +0800, JiSheng Zhang wrote:
> 2011/11/1 James Bottomley <James.Bottomley <at> hansenpartnership.com>:
> > On Tue, 2011-11-01 at 13:31 +0800, JiSheng Zhang wrote:
> >> Currently, there's no start/stop management in scsi cdrom driver to
> >> spin up/down the motor do we need to implement it?
> >
> > Say more ... like what you think it buys.  The auto spin down of a CD
> > tends to be the best power control we have and it's not even clear that
> > manufacturers have implemented any other useful power states.
> 
> Does it mean the behavior depends on manufacturers? Some cd will spin
> down automatically?

All CDs spin down when not reading (or burning) since the motor power is
pretty high.  Most also do speed adjustments on the fly as well to try
to match platter speed and read or burn rate.

>  Even so, how about during shutdown just after reading
> something from cdrom?

What's the use case?  For internal CDs, shutdown removes power anyway.

James

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

(Continue reading)

Tomas Henzl | 1 Nov 2011 17:46
Picon
Favicon

[PATCH] qla4xx: a small loop fix

From: Tomas Henzl <thenzl <at> redhat.com>

When the qla4xxx_get_fwddb_entry returns QLA_ERROR
the nex_idx is not updated, 
      for (idx = 0; idx < max_ddbs; idx = next_idx) {
                ret = qla4xxx_get_fwddb_entry(ha, idx, NULL, 0, NULL,
                                              &next_idx, &state, &conn_err,
                                                NULL, NULL);
                if (ret == QLA_ERROR)
                        continue;

This means there is a risk that the 'idx < max_ddbs' condition will never
met and the loop will loop forever.
Fix this by explicitly increasing the next_idx in the error condition.

Maybe a break instead of continue is more appropriate, leaving the decision
on the qlogic maintainer.

Signed-off-by: Tomas Henzl <thenzl <at> redhat.com>

diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
index 3075fba..17acb17 100644
--- a/drivers/scsi/qla4xxx/ql4_init.c
+++ b/drivers/scsi/qla4xxx/ql4_init.c
 <at>  <at>  -787,8 +787,10  <at>  <at>  static void qla4xxx_free_ddb_index(struct scsi_qla_host *ha)
 		ret = qla4xxx_get_fwddb_entry(ha, idx, NULL, 0, NULL,
 					      &next_idx, &state, &conn_err,
 						NULL, NULL);
-		if (ret == QLA_ERROR)
+		if (ret == QLA_ERROR) {
(Continue reading)

Moger, Babu | 1 Nov 2011 18:19
Picon

[PATCH 0/4] scsi_dh: Fix for handler attach and code clean up

These series of patches handles following things.
1. Fixes handler attach issue.
2. Introduces match function for all the handlers
3. cleans up the scsi_dh code 

I have noticed the attach issue during our multipath testing. We found that during
the lun discovery there were lots of error messages like below..

Oct 25 08:24:43 kswm-mihosi kernel: sd 0:0:0:7: [sdav]  Result: hostbyte=DID_OK
driverbyte=DRIVER_SENSE
Oct 25 08:24:43 kswm-mihosi kernel: sd 0:0:0:7: [sdav]  Sense Key : Illegal
Request [current]
Oct 25 08:24:43 kswm-mihosi kernel: sd 0:0:0:7: [sdav]  <<vendor>> ASC=0x94
ASCQ=0x1ASC=0x94 ASCQ=0x1
Oct 25 08:24:43 kswm-mihosi kernel: sd 0:0:0:7: [sdav] CDB: Read(10): 28 00 00
00 00 00 00 00 80 00
Oct 25 08:24:43 kswm-mihosi kernel: end_request: I/O error, dev sdav, sector 0

These messages were coming in spite of having scsi_dh_rdac in initrd.  Reason
for these errors are due to device handler not being attached properly. If the
device handler was attached then the I/O's should not go to passive paths.

Investigating further we found that there errors started with the introduction
of these patches below.

http://www.spinics.net/lists/linux-scsi/msg54284.html
or
http://git.kernel.org/?p=linux/kernel/git/jejb/scsi-misc-2.6.git;a=commit;h=6c3633d08acf514e2e89aa95d2346ce9d64d719a

This patch introduces the match function for device handlers. But the match function
(Continue reading)

Moger, Babu | 1 Nov 2011 18:19
Picon

[PATCH 2/4] scsi_dh_hp_sw: Adding the match function for hp_sw device handler

This patch introduces the match fuction for hp_sw device handler.
The match function was introduced by this patch
http://www.spinics.net/lists/linux-scsi/msg54284.html

Signed-off-by: Babu Moger <babu.moger <at> netapp.com>
---

--- linux/drivers/scsi/device_handler/scsi_dh_hp_sw.c.orig	2011-10-31 11:25:07.000000000 -0500
+++ linux/drivers/scsi/device_handler/scsi_dh_hp_sw.c	2011-10-31 12:33:05.000000000 -0500
 <at>  <at>  -319,6 +319,20  <at>  <at>  static const struct scsi_dh_devlist hp_s
 	{NULL, NULL},
 };

+static bool hp_sw_match(struct scsi_device *sdev)
+{
+	int i;
+	for (i = 0; hp_sw_dh_data_list[i].vendor; i++) {
+		if (!strncmp(sdev->vendor, hp_sw_dh_data_list[i].vendor,
+			strlen(hp_sw_dh_data_list[i].vendor)) &&
+		    !strncmp(sdev->model, hp_sw_dh_data_list[i].model,
+			strlen(hp_sw_dh_data_list[i].model))) {
+			return true;
+		}
+	}
+	return false;
+}
+
 static int hp_sw_bus_attach(struct scsi_device *sdev);
 static void hp_sw_bus_detach(struct scsi_device *sdev);

(Continue reading)

Moger, Babu | 1 Nov 2011 18:19
Picon

[PATCH 1/4] scsi_dh_emc: Adding the match function for emc device handler

This patch introduces the match fuction for emc device handler.
The match function was introduced by this patch
http://www.spinics.net/lists/linux-scsi/msg54284.html

Signed-off-by: Babu Moger <babu.moger <at> netapp.com>
---

--- linux/drivers/scsi/device_handler/scsi_dh_emc.c.orig	2011-10-31 11:24:29.000000000 -0500
+++ linux/drivers/scsi/device_handler/scsi_dh_emc.c	2011-10-31 11:27:45.000000000 -0500
 <at>  <at>  -628,6 +628,20  <at>  <at>  static const struct scsi_dh_devlist clar
 	{NULL, NULL},
 };

+static bool clariion_match(struct scsi_device *sdev)
+{
+	int i;
+	for (i = 0; clariion_dev_list[i].vendor; i++) {
+		if (!strncmp(sdev->vendor, clariion_dev_list[i].vendor,
+			strlen(clariion_dev_list[i].vendor)) &&
+		    !strncmp(sdev->model, clariion_dev_list[i].model,
+			strlen(clariion_dev_list[i].model))) {
+			return true;
+		}
+	}
+	return false;
+}
+
 static int clariion_bus_attach(struct scsi_device *sdev);
 static void clariion_bus_detach(struct scsi_device *sdev);

(Continue reading)

Moger, Babu | 1 Nov 2011 18:19
Picon

[PATCH 3/4] scsi_dh_rdac: Adding the match function for rdac device handler

This patch introduces the match function for rdac device handler. Without this,
sometimes handler attach fails during the device_add.  The match function was
introduced by this patch
http://www.spinics.net/lists/linux-scsi/msg54284.html

Signed-off-by: Babu Moger <babu.moger <at> netapp.com>
---

--- linux/drivers/scsi/device_handler/scsi_dh_rdac.c.orig	2011-10-31 11:25:44.000000000 -0500
+++ linux/drivers/scsi/device_handler/scsi_dh_rdac.c	2011-10-31 11:31:34.000000000 -0500
 <at>  <at>  -819,6 +819,21  <at>  <at>  static const struct scsi_dh_devlist rdac
 	{NULL, NULL},
 };

+static bool rdac_match(struct scsi_device *sdev)
+{
+	int i;
+
+	for (i = 0; rdac_dev_list[i].vendor; i++) {
+		if (!strncmp(sdev->vendor, rdac_dev_list[i].vendor,
+			strlen(rdac_dev_list[i].vendor)) &&
+		    !strncmp(sdev->model, rdac_dev_list[i].model,
+			strlen(rdac_dev_list[i].model))) {
+			return true;
+		}
+	}
+	return false;
+}
+
 static int rdac_bus_attach(struct scsi_device *sdev);
(Continue reading)

Moger, Babu | 1 Nov 2011 18:20
Picon

[PATCH 4/4] scsi_dh: code cleanup - remove the references to scsi_dev_info

All the handlers have implemented the match function(look at patch 1, 2, 3).
We don't need to use scsi_dev_info any more for matching purposes.

Cleaning up the scsi_dh code.

FYI..
Match function was originally implemented by this 

http://www.spinics.net/lists/linux-scsi/msg54284.html
or
http://git.kernel.org/?p=linux/kernel/git/jejb/scsi-misc-2.6.git;a=commit;h=6c3633d08acf514e2e89aa95d2346ce9d64d719a

Signed-off-by: Babu Moger <babu.moger <at> netapp.com>
---

diff -uprN -X linux/Documentation/dontdiff linux//drivers/scsi/device_handler/scsi_dh.c linux-new/linux//drivers/scsi/device_handler/scsi_dh.c
--- linux//drivers/scsi/device_handler/scsi_dh.c	2011-10-31 13:47:37.000000000 -0500
+++ linux-new/linux//drivers/scsi/device_handler/scsi_dh.c	2011-10-31 13:45:46.000000000 -0500
 <at>  <at>  -27,7 +27,6  <at>  <at> 

 static DEFINE_SPINLOCK(list_lock);
 static LIST_HEAD(scsi_dh_list);
-static int scsi_dh_list_idx = 1;

 static struct scsi_device_handler *get_device_handler(const char *name)
 {
 <at>  <at>  -44,21 +43,6  <at>  <at>  static struct scsi_device_handler *get_d
 	return found;
 }

(Continue reading)

Mike Christie | 1 Nov 2011 19:10
Picon
Favicon

Re: [PATCH] qla4xx: a small loop fix

On 11/01/2011 11:46 AM, Tomas Henzl wrote:
> From: Tomas Henzl <thenzl <at> redhat.com>
> 
> When the qla4xxx_get_fwddb_entry returns QLA_ERROR
> the nex_idx is not updated, 
>       for (idx = 0; idx < max_ddbs; idx = next_idx) {
>                 ret = qla4xxx_get_fwddb_entry(ha, idx, NULL, 0, NULL,
>                                               &next_idx, &state, &conn_err,
>                                                 NULL, NULL);
>                 if (ret == QLA_ERROR)
>                         continue;
>  
> This means there is a risk that the 'idx < max_ddbs' condition will never
> met and the loop will loop forever.
> Fix this by explicitly increasing the next_idx in the error condition.
> 
> Maybe a break instead of continue is more appropriate, leaving the decision
> on the qlogic maintainer.
> 
> Signed-off-by: Tomas Henzl <thenzl <at> redhat.com>
> 
> diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
> index 3075fba..17acb17 100644
> --- a/drivers/scsi/qla4xxx/ql4_init.c
> +++ b/drivers/scsi/qla4xxx/ql4_init.c
>  <at>  <at>  -787,8 +787,10  <at>  <at>  static void qla4xxx_free_ddb_index(struct scsi_qla_host *ha)
>  		ret = qla4xxx_get_fwddb_entry(ha, idx, NULL, 0, NULL,
>  					      &next_idx, &state, &conn_err,
>  						NULL, NULL);
> -		if (ret == QLA_ERROR)
(Continue reading)

Tomas Henzl | 1 Nov 2011 21:22
Picon
Favicon

Re: [PATCH] qla4xx: a small loop fix

On 11/01/2011 07:10 PM, Mike Christie wrote:
> On 11/01/2011 11:46 AM, Tomas Henzl wrote:
>> From: Tomas Henzl <thenzl <at> redhat.com>
>>
>> When the qla4xxx_get_fwddb_entry returns QLA_ERROR
>> the nex_idx is not updated, 
>>       for (idx = 0; idx < max_ddbs; idx = next_idx) {
>>                 ret = qla4xxx_get_fwddb_entry(ha, idx, NULL, 0, NULL,
>>                                               &next_idx, &state, &conn_err,
>>                                                 NULL, NULL);
>>                 if (ret == QLA_ERROR)
>>                         continue;
>>  
>> This means there is a risk that the 'idx < max_ddbs' condition will never
>> met and the loop will loop forever.
>> Fix this by explicitly increasing the next_idx in the error condition.
>>
>> Maybe a break instead of continue is more appropriate, leaving the decision
>> on the qlogic maintainer.
>>
>> Signed-off-by: Tomas Henzl <thenzl <at> redhat.com>
>>
>> diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
>> index 3075fba..17acb17 100644
>> --- a/drivers/scsi/qla4xxx/ql4_init.c
>> +++ b/drivers/scsi/qla4xxx/ql4_init.c
>>  <at>  <at>  -787,8 +787,10  <at>  <at>  static void qla4xxx_free_ddb_index(struct scsi_qla_host *ha)
>>  		ret = qla4xxx_get_fwddb_entry(ha, idx, NULL, 0, NULL,
>>  					      &next_idx, &state, &conn_err,
>>  						NULL, NULL);
(Continue reading)

Mike Christie | 1 Nov 2011 21:31
Picon
Favicon

Re: [PATCH] qla4xx: a small loop fix

On 11/01/2011 03:22 PM, Tomas Henzl wrote:
> On 11/01/2011 07:10 PM, Mike Christie wrote:
>> On 11/01/2011 11:46 AM, Tomas Henzl wrote:
>>> From: Tomas Henzl <thenzl <at> redhat.com>
>>>
>>> When the qla4xxx_get_fwddb_entry returns QLA_ERROR
>>> the nex_idx is not updated, 
>>>       for (idx = 0; idx < max_ddbs; idx = next_idx) {
>>>                 ret = qla4xxx_get_fwddb_entry(ha, idx, NULL, 0, NULL,
>>>                                               &next_idx, &state, &conn_err,
>>>                                                 NULL, NULL);
>>>                 if (ret == QLA_ERROR)
>>>                         continue;
>>>  
>>> This means there is a risk that the 'idx < max_ddbs' condition will never
>>> met and the loop will loop forever.
>>> Fix this by explicitly increasing the next_idx in the error condition.
>>>
>>> Maybe a break instead of continue is more appropriate, leaving the decision
>>> on the qlogic maintainer.
>>>
>>> Signed-off-by: Tomas Henzl <thenzl <at> redhat.com>
>>>
>>> diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
>>> index 3075fba..17acb17 100644
>>> --- a/drivers/scsi/qla4xxx/ql4_init.c
>>> +++ b/drivers/scsi/qla4xxx/ql4_init.c
>>>  <at>  <at>  -787,8 +787,10  <at>  <at>  static void qla4xxx_free_ddb_index(struct scsi_qla_host *ha)
>>>  		ret = qla4xxx_get_fwddb_entry(ha, idx, NULL, 0, NULL,
>>>  					      &next_idx, &state, &conn_err,
(Continue reading)


Gmane