[PATCH 2/2] replace sizeof sense_buffer with SCSI_SENSE_BUFFERSIZE

2008-01-12 Thread FUJITA Tomonori
This is the second version of

http://marc.info/?l=linux-scsi&m=119933628210012&w=2

o I dropped fas216 since Boaz's patch in scsi-pending will be merged
before solving the sense_buffer dma issue.

o This is a 'grep and replace' style patch but cleans up dpt_i2o a bit
as by permission of Mark (I use min macro).

o The previous version overlooked some sizeof sense_buffer lines in
aacraid and qla4xxx.

o I overlooked the ncr53c8xx compile warning.

=
From: FUJITA Tomonori <[EMAIL PROTECTED]>
Subject: [PATCH 2/2] replace sizeof sense_buffer with SCSI_SENSE_BUFFERSIZE

This replaces sizeof sense_buffer with SCSI_SENSE_BUFFERSIZE in
several LLDs. It's a preparation for the future changes to remove
sense_buffer array in scsi_cmnd structure.

Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]>
---
 drivers/ata/libata-scsi.c   |4 ++--
 drivers/message/fusion/mptscsih.c   |2 +-
 drivers/message/i2o/i2o_scsi.c  |2 +-
 drivers/scsi/53c700.c   |   11 ++-
 drivers/scsi/BusLogic.c |2 +-
 drivers/scsi/aacraid/aachba.c   |   32 
 drivers/scsi/advansys.c |   14 +++---
 drivers/scsi/aha1542.c  |4 ++--
 drivers/scsi/aha1740.c  |2 +-
 drivers/scsi/aic7xxx/aic79xx_osm.c  |6 +++---
 drivers/scsi/aic7xxx/aic7xxx_osm.c  |6 +++---
 drivers/scsi/aic7xxx_old.c  |   10 +-
 drivers/scsi/arcmsr/arcmsr_hba.c|6 +++---
 drivers/scsi/dc395x.c   |   16 +++-
 drivers/scsi/dpt_i2o.c  |5 ++---
 drivers/scsi/eata.c |4 ++--
 drivers/scsi/hptiop.c   |2 +-
 drivers/scsi/ips.c  |6 ++
 drivers/scsi/ncr53c8xx.c|3 ++-
 drivers/scsi/qla1280.c  |4 ++--
 drivers/scsi/qla2xxx/qla_isr.c  |   12 ++--
 drivers/scsi/qla4xxx/ql4_isr.c  |   11 ---
 drivers/scsi/qlogicpti.c|2 +-
 drivers/scsi/scsi_error.c   |6 +++---
 drivers/scsi/scsi_lib.c |2 +-
 drivers/scsi/sym53c8xx_2/sym_glue.c |5 ++---
 drivers/scsi/tmscsim.c  |6 +++---
 drivers/scsi/u14-34f.c  |4 ++--
 drivers/scsi/ultrastor.c|2 +-
 29 files changed, 92 insertions(+), 99 deletions(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 4bb268b..b633341 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2334,7 +2334,7 @@ static void atapi_request_sense(struct ata_queued_cmd *qc)
DPRINTK("ATAPI request sense\n");
 
/* FIXME: is this needed? */
-   memset(cmd->sense_buffer, 0, sizeof(cmd->sense_buffer));
+   memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
 
ap->ops->tf_read(ap, &qc->tf);
 
@@ -2344,7 +2344,7 @@ static void atapi_request_sense(struct ata_queued_cmd *qc)
 
ata_qc_reinit(qc);
 
-   ata_sg_init_one(qc, cmd->sense_buffer, sizeof(cmd->sense_buffer));
+   ata_sg_init_one(qc, cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE);
qc->dma_dir = DMA_FROM_DEVICE;
 
memset(&qc->cdb, 0, qc->dev->cdb_len);
diff --git a/drivers/message/fusion/mptscsih.c 
b/drivers/message/fusion/mptscsih.c
index 626bb3c..5c614ec 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -111,7 +111,7 @@ int mptscsih_suspend(struct pci_dev *pdev, 
pm_message_t state);
 intmptscsih_resume(struct pci_dev *pdev);
 #endif
 
-#define SNS_LEN(scp)   sizeof((scp)->sense_buffer)
+#define SNS_LEN(scp)   SCSI_SENSE_BUFFERSIZE
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /**
diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c
index aa6fb94..1bcdbbb 100644
--- a/drivers/message/i2o/i2o_scsi.c
+++ b/drivers/message/i2o/i2o_scsi.c
@@ -370,7 +370,7 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m,
 */
if (cmd->result)
memcpy(cmd->sense_buffer, &msg->body[3],
-  min(sizeof(cmd->sense_buffer), (size_t) 40));
+  min(SCSI_SENSE_BUFFERSIZE, 40));
 
/* only output error code if AdapterStatus is not HBA_SUCCESS */
if ((error >> 8) & 0xff)
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index 71ff3fb..f4c4fe9 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -608,7 +608,8 @@ NCR_700_scsi_done(struct NCR_700_Host_Parameters *hostdata,
scsi_print_sense("53c700", SCp);
 
 #endif
-   dma_unmap_single(hostdata->dev, slot->dma_handle, 
sizeof(SCp->sense_buffer), DMA_FROM_DEVICE);
+   dma_unmap_single(hostdata->dev, slot->dma_handle,
+SCSI_SENSE_BUFFERSIZE, 
DMA_FROM_DEVICE);
/* restore the old result if the request sense was
 * succes

[PATCH 1/2] don't zero out sense_buffer in queuecommand

2008-01-12 Thread FUJITA Tomonori
LLDs don't need to zero out scsi_cmnd::sense_buffer in queuecommand
since scsi-ml does. This is a preparation of the future changes to
allocate the sense_buffer only when necessary.

Many LLDs zero out the sense_buffer before touching it on the error
case. This patch lets them alone for now because new APIs for them
would be added later on.

Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]>
---
 drivers/scsi/aic7xxx_old.c  |1 -
 drivers/scsi/eata_pio.c |1 -
 drivers/scsi/ips.c  |3 ---
 drivers/scsi/libsas/sas_scsi_host.c |1 -
 4 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c
index 8f8db5f..2b402fa 100644
--- a/drivers/scsi/aic7xxx_old.c
+++ b/drivers/scsi/aic7xxx_old.c
@@ -10293,7 +10293,6 @@ static int aic7xxx_queue(struct scsi_cmnd *cmd, void 
(*fn)(struct scsi_cmnd *))
   aic7xxx_position(cmd) = scb->hscb->tag;
   cmd->scsi_done = fn;
   cmd->result = DID_OK;
-  memset(cmd->sense_buffer, 0, sizeof(cmd->sense_buffer));
   aic7xxx_error(cmd) = DID_OK;
   aic7xxx_status(cmd) = 0;
   cmd->host_scribble = NULL;
diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c
index 9579507..b5a6092 100644
--- a/drivers/scsi/eata_pio.c
+++ b/drivers/scsi/eata_pio.c
@@ -369,7 +369,6 @@ static int eata_pio_queue(struct scsi_cmnd *cmd,
cp = &hd->ccb[y];
 
memset(cp, 0, sizeof(struct eata_ccb));
-   memset(cmd->sense_buffer, 0, sizeof(cmd->sense_buffer));
 
cp->status = USED;  /* claim free slot */
 
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index e54d30c..b1b2295 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -2736,8 +2736,6 @@ ips_next(ips_ha_t * ha, int intr)
SC->result = DID_OK;
SC->host_scribble = NULL;
 
-   memset(SC->sense_buffer, 0, sizeof (SC->sense_buffer));
-
scb->target_id = SC->device->id;
scb->lun = SC->device->lun;
scb->bus = SC->device->channel;
@@ -3821,7 +3819,6 @@ ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb)
/* attempted, a Check Condition occurred, and Sense   */
/* Data indicating an Invalid CDB OpCode is returned. */
sp = (char *) scb->scsi_cmd->sense_buffer;
-   memset(sp, 0, sizeof (scb->scsi_cmd->sense_buffer));
 
sp[0] = 0x70;   /* Error Code   */
sp[2] = ILLEGAL_REQUEST;/* Sense Key 5 Illegal 
Req. */
diff --git a/drivers/scsi/libsas/sas_scsi_host.c 
b/drivers/scsi/libsas/sas_scsi_host.c
index 828fed1..9c04225 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -148,7 +148,6 @@ static struct sas_task *sas_create_task(struct scsi_cmnd 
*cmd,
if (!task)
return NULL;
 
-   *(u32 *)cmd->sense_buffer = 0;
task->uldd_task = cmd;
ASSIGN_SAS_TASK(cmd, task);
 
-- 
1.5.3.4

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


Re: [Bug 9734] New: I/O error when inserting a second firewire sata disk

2008-01-12 Thread James Bottomley
Firewire list cc'd

On Sat, 2008-01-12 at 07:47 -0800, [EMAIL PROTECTED]
wrote:
> http://bugzilla.kernel.org/show_bug.cgi?id=9734
> 
>Summary: I/O error when inserting a second firewire sata disk
>Product: IO/Storage
>Version: 2.5
>  KernelVersion: 2.6.24 rc7
>   Platform: All
> OS/Version: Linux
>   Tree: Mainline
> Status: NEW
>   Severity: high
>   Priority: P1
>  Component: SCSI
> AssignedTo: linux-scsi@vger.kernel.org
> ReportedBy: [EMAIL PROTECTED]
> 
> 
> Latest working kernel version: 2.6.18-5
> (can't test any other kernel between 2.6.18-5 and 2.6.22-3 because aren't in
> the repo)
> 
> Earliest failing kernel version: 2.6.22-3
> 
> Distribution: debian lenny 32bit AND 64 bit (it happens the same on both)
> 
> Hardware Environment: ibm x3400 quad core 2GB ram type/number 7976-KBG bios
> version 1.56 http://www-03.ibm.com/systems/x/tower/x3400/specs.html
> cpu info: -> http://www.pastebin.org/15078
> lspci firewire: -> http://www.pastebin.org/15081
> lsmod: -> http://www.pastebin.org/15083
> 
> Software Environment: bash
> 
> Problem Description:
> We have a 64bit pci double firewire 800 port to which I attach 2 sata hdd (it
> doesn't matter the brand of the hdd. We tried many)
> Everything works well until we use only one disk. Connecting a second disk 
> when
> we are working on the first one (i.e. writing to the first device)  causes the
> interruption of the first job. once happened also a kernel freeze but we can't
> document and reproduce it right now.
> 
> Steps to reproduce:
> We attach a sata disk to the first port of the pci firewire B controller
> 
> 08:02.0 FireWire (IEEE 1394): Texas Instruments TSB82AA2 IEEE-1394b Link Layer
> Controller (rev 01)
> Jan 12 16:19:13 x3400 kernel: ieee1394: Error parsing configrom for node
> 1-00:1023
> Jan 12 16:19:13 x3400 kernel: ieee1394: Node changed: 1-00:1023 -> 1-01:1023
> Jan 12 16:19:14 x3400 kernel: ieee1394: Node resumed: ID:BUS[1-00:1023] 
> GUID[0030e002e0454697]
> Jan 12 16:19:14 x3400 kernel: scsi9 : SBP-2 IEEE-1394
> Jan 12 16:19:15 x3400 kernel: ieee1394: sbp2: Logged into SBP-2 device
> Jan 12 16:19:15 x3400 kernel: ieee1394: Node 1-00:1023: Max speed [S800] - Max
> payload [4096]
> Jan 12 16:19:15 x3400 kernel:   Vendor: WDC WD16  Model: 00JD-00HBC0   
> Rev:
> 08.0
> Jan 12 16:19:15 x3400 kernel:   Type:   Direct-Access-RBC  
> ANSI
> SCSI revision: 04
> Jan 12 16:19:15 x3400 kernel: SCSI device sdc: 312579695 512-byte hdwr sectors
> (160041 MB)
> Jan 12 16:19:15 x3400 kernel: sdc: Write Protect is off
> Jan 12 16:19:15 x3400 kernel: sdc: Mode Sense: 11 00 00 00
> Jan 12 16:19:15 x3400 kernel: SCSI device sdc: drive cache: write back
> Jan 12 16:19:15 x3400 kernel: SCSI device sdc: 312579695 512-byte hdwr sectors
> (160041 MB)
> Jan 12 16:19:15 x3400 kernel: sdc: Write Protect is off
> Jan 12 16:19:15 x3400 kernel: sdc: Mode Sense: 11 00 00 00
> Jan 12 16:19:15 x3400 kernel: SCSI device sdc: drive cache: write back
> Jan 12 16:19:15 x3400 kernel:  sdc: unknown partition table
> Jan 12 16:19:15 x3400 kernel: sd 9:0:0:0: Attached scsi disk sdc
> 
> now we launch :
> dd if=/dev/zero of=/dev/sdc
> 
> everything ok until now
> 
> now we attach another sata disc to the second port of the pci firewire
> controller:
> 
> Jan 12 16:20:09 x3400 kernel: ieee1394: Error parsing configrom for node
> 1-00:1023
> Jan 12 16:20:09 x3400 kernel: ieee1394: Node changed: 1-00:1023 -> 1-01:1023
> Jan 12 16:20:09 x3400 kernel: ieee1394: Node changed: 1-01:1023 -> 1-02:1023
> Jan 12 16:20:10 x3400 kernel: ieee1394: Reconnected to SBP-2 device
> Jan 12 16:20:10 x3400 kernel: ieee1394: Node 1-01:1023: Max speed [S800] - Max
> payload [4096]
> 
> using 2.6.18-5-686 everything works well
> dd still works
> 
> now we disconnect the disk from the second port 
> 
> Jan 12 16:21:13 x3400 kernel: ieee1394: Node changed: 1-01:1023 -> 1-00:1023
> Jan 12 16:21:13 x3400 kernel: ieee1394: Node changed: 1-02:1023 -> 1-01:1023
> Jan 12 16:21:13 x3400 kernel: ieee1394: Reconnected to SBP-2 device
> Jan 12 16:21:13 x3400 kernel: ieee1394: Node 1-00:1023: Max speed [S800] - Max
> payload [4096]
> 
> everything ok also disconnecting the second device
> 
> ---
> 
> now the same issue using 2.6.24-rc7-686:
> 
> we attach a sata disk to the first port of the pci firewire B controller
> 
> Jan 12 16:49:45 x3400 kernel: firewire_core: phy config: card 1, new 
> root=ffc1,
> gap_count=5
> Jan 12 16:49:46 x3400 kernel: scsi11 : SBP-2 IEEE-1394
> Jan 12 16:49:46 x3400 kernel: firewire_core: created new fw device fw2 (2
> config rom retries, S800)
> Jan 12 16:49:46 x3400 kernel: firewire_sbp2: logged in to fw2.0 LUN  (0
> retries)
> Jan 12 16:49:46 x3400 kernel: scsi 11:0:0:0: Direct-Access-RBC WDC WD16
> 00JD-00HBC0  08.0 PQ: 0 ANSI: 4
> Jan 12 16:49:46 x3400 kernel: sd 11:0:0:0: [sdc] 3

Re: new runtime scsi warnings in 2.6.24-rc6+git

2008-01-12 Thread James Bottomley

On Sat, 2008-01-12 at 20:58 +0100, Rafael J. Wysocki wrote:
> On Friday, 4 of January 2008, Meelis Roos wrote:
> > Todays git gives the following warning during bootup on a Intel 845+PATA 
> > PC (using libata to drive PATA):
> > 
> > Driver 'sd' needs updating - please use bus_type methods
> > Driver 'sr' needs updating - please use bus_type methods
> 
> They are due to commit 751bf4d7865e4ced406be93b04c7436d866d3684, AFAICS, and
> they don't mean anything wrong.

Yes ... SCSI actually is actually using the bus_type methods.  The issue
is that we need to cascade the removes so we're using the driver remove
method for this.  The warning appears if you have both a bus_type remove
and a driver remove (and a host of other duplicate methods), I think
because if the bus_type method is set, the driver method won't be
called.

However, we've taken all this into account and our bus type remove calls
into the driver remove itself ... unfortunately there seems to be no way
to persuade the driver core we know what we're doing.

James


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


Re: new runtime scsi warnings in 2.6.24-rc6+git

2008-01-12 Thread Rafael J. Wysocki
On Friday, 4 of January 2008, Meelis Roos wrote:
> Todays git gives the following warning during bootup on a Intel 845+PATA 
> PC (using libata to drive PATA):
> 
> Driver 'sd' needs updating - please use bus_type methods
> Driver 'sr' needs updating - please use bus_type methods

They are due to commit 751bf4d7865e4ced406be93b04c7436d866d3684, AFAICS, and
they don't mean anything wrong.

Thanks,
Rafael
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Only print SCSI data direction warning once for a command

2008-01-12 Thread James Bottomley
On Wed, 2008-01-02 at 07:03 +0100, Andi Kleen wrote:
> When I use cdparanoia my logs get spammed a lot by
> 
> printk: 464 messages suppressed.
> sg_write: data in/out 30576/30576 bytes for SCSI command 0xbe--guessing data 
> in;
>program cdparanoia not setting count and/or reply_len properly
> printk: 1078 messages suppressed.
> 
> and many more of those. With this patch the message is only printed once
> for a command in a row.

My reaction is that the intent of these warnings is to try to get people
to fix broken applications, so I'm not sure any action is appropriate;
however, it's Doug's driver, so I'll defer to him.

Even if he does say yes, though, your patch looks wrong.  It's still
going to spew the 

printk: 1078 messages suppressed.

to the log because they come from printk_ratelimit().  So all you've
done is halved the volume of flow to the logs and left a dangling printk
suppressed message that keeps spewing, so I don't think the patch even
does what you describe it as doing ...  if you reverse the order of the
operands in the if() it will ...

James


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


[PATCH] libsas: fix sense_buffer overrun

2008-01-12 Thread FUJITA Tomonori

Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]>
---
 drivers/scsi/libsas/sas_scsi_host.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/libsas/sas_scsi_host.c 
b/drivers/scsi/libsas/sas_scsi_host.c
index b784089..828fed1 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -108,7 +108,7 @@ static void sas_scsi_task_done(struct sas_task *task)
break;
case SAM_CHECK_COND:
memcpy(sc->sense_buffer, ts->buf,
-  max(SCSI_SENSE_BUFFERSIZE, ts->buf_valid_size));
+  min(SCSI_SENSE_BUFFERSIZE, ts->buf_valid_size));
stat = SAM_CHECK_COND;
break;
default:
-- 
1.5.3.4

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


[Bug 9734] I/O error when inserting a second firewire sata disk

2008-01-12 Thread bugme-daemon
http://bugzilla.kernel.org/show_bug.cgi?id=9734


[EMAIL PROTECTED] changed:

   What|Removed |Added

 CC||[EMAIL PROTECTED]
 AssignedTo|linux-scsi@vger.kernel.org  |[EMAIL PROTECTED]
   ||bugs.osdl.org
  Component|SCSI|IEEE1394
Product|IO/Storage  |Drivers
 Regression|0   |1




-- 
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.
You are the assignee for the bug, or are watching the assignee.
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Bug 9734] New: I/O error when inserting a second firewire sata disk

2008-01-12 Thread bugme-daemon
http://bugzilla.kernel.org/show_bug.cgi?id=9734

   Summary: I/O error when inserting a second firewire sata disk
   Product: IO/Storage
   Version: 2.5
 KernelVersion: 2.6.24 rc7
  Platform: All
OS/Version: Linux
  Tree: Mainline
Status: NEW
  Severity: high
  Priority: P1
 Component: SCSI
AssignedTo: linux-scsi@vger.kernel.org
ReportedBy: [EMAIL PROTECTED]


Latest working kernel version: 2.6.18-5
(can't test any other kernel between 2.6.18-5 and 2.6.22-3 because aren't in
the repo)

Earliest failing kernel version: 2.6.22-3

Distribution: debian lenny 32bit AND 64 bit (it happens the same on both)

Hardware Environment: ibm x3400 quad core 2GB ram type/number 7976-KBG bios
version 1.56 http://www-03.ibm.com/systems/x/tower/x3400/specs.html
cpu info: -> http://www.pastebin.org/15078
lspci firewire: -> http://www.pastebin.org/15081
lsmod: -> http://www.pastebin.org/15083

Software Environment: bash

Problem Description:
We have a 64bit pci double firewire 800 port to which I attach 2 sata hdd (it
doesn't matter the brand of the hdd. We tried many)
Everything works well until we use only one disk. Connecting a second disk when
we are working on the first one (i.e. writing to the first device)  causes the
interruption of the first job. once happened also a kernel freeze but we can't
document and reproduce it right now.

Steps to reproduce:
We attach a sata disk to the first port of the pci firewire B controller

08:02.0 FireWire (IEEE 1394): Texas Instruments TSB82AA2 IEEE-1394b Link Layer
Controller (rev 01)
Jan 12 16:19:13 x3400 kernel: ieee1394: Error parsing configrom for node
1-00:1023
Jan 12 16:19:13 x3400 kernel: ieee1394: Node changed: 1-00:1023 -> 1-01:1023
Jan 12 16:19:14 x3400 kernel: ieee1394: Node resumed: ID:BUS[1-00:1023] 
GUID[0030e002e0454697]
Jan 12 16:19:14 x3400 kernel: scsi9 : SBP-2 IEEE-1394
Jan 12 16:19:15 x3400 kernel: ieee1394: sbp2: Logged into SBP-2 device
Jan 12 16:19:15 x3400 kernel: ieee1394: Node 1-00:1023: Max speed [S800] - Max
payload [4096]
Jan 12 16:19:15 x3400 kernel:   Vendor: WDC WD16  Model: 00JD-00HBC0   Rev:
08.0
Jan 12 16:19:15 x3400 kernel:   Type:   Direct-Access-RBC  ANSI
SCSI revision: 04
Jan 12 16:19:15 x3400 kernel: SCSI device sdc: 312579695 512-byte hdwr sectors
(160041 MB)
Jan 12 16:19:15 x3400 kernel: sdc: Write Protect is off
Jan 12 16:19:15 x3400 kernel: sdc: Mode Sense: 11 00 00 00
Jan 12 16:19:15 x3400 kernel: SCSI device sdc: drive cache: write back
Jan 12 16:19:15 x3400 kernel: SCSI device sdc: 312579695 512-byte hdwr sectors
(160041 MB)
Jan 12 16:19:15 x3400 kernel: sdc: Write Protect is off
Jan 12 16:19:15 x3400 kernel: sdc: Mode Sense: 11 00 00 00
Jan 12 16:19:15 x3400 kernel: SCSI device sdc: drive cache: write back
Jan 12 16:19:15 x3400 kernel:  sdc: unknown partition table
Jan 12 16:19:15 x3400 kernel: sd 9:0:0:0: Attached scsi disk sdc

now we launch :
dd if=/dev/zero of=/dev/sdc

everything ok until now

now we attach another sata disc to the second port of the pci firewire
controller:

Jan 12 16:20:09 x3400 kernel: ieee1394: Error parsing configrom for node
1-00:1023
Jan 12 16:20:09 x3400 kernel: ieee1394: Node changed: 1-00:1023 -> 1-01:1023
Jan 12 16:20:09 x3400 kernel: ieee1394: Node changed: 1-01:1023 -> 1-02:1023
Jan 12 16:20:10 x3400 kernel: ieee1394: Reconnected to SBP-2 device
Jan 12 16:20:10 x3400 kernel: ieee1394: Node 1-01:1023: Max speed [S800] - Max
payload [4096]

using 2.6.18-5-686 everything works well
dd still works

now we disconnect the disk from the second port 

Jan 12 16:21:13 x3400 kernel: ieee1394: Node changed: 1-01:1023 -> 1-00:1023
Jan 12 16:21:13 x3400 kernel: ieee1394: Node changed: 1-02:1023 -> 1-01:1023
Jan 12 16:21:13 x3400 kernel: ieee1394: Reconnected to SBP-2 device
Jan 12 16:21:13 x3400 kernel: ieee1394: Node 1-00:1023: Max speed [S800] - Max
payload [4096]

everything ok also disconnecting the second device

---

now the same issue using 2.6.24-rc7-686:

we attach a sata disk to the first port of the pci firewire B controller

Jan 12 16:49:45 x3400 kernel: firewire_core: phy config: card 1, new root=ffc1,
gap_count=5
Jan 12 16:49:46 x3400 kernel: scsi11 : SBP-2 IEEE-1394
Jan 12 16:49:46 x3400 kernel: firewire_core: created new fw device fw2 (2
config rom retries, S800)
Jan 12 16:49:46 x3400 kernel: firewire_sbp2: logged in to fw2.0 LUN  (0
retries)
Jan 12 16:49:46 x3400 kernel: scsi 11:0:0:0: Direct-Access-RBC WDC WD16
00JD-00HBC0  08.0 PQ: 0 ANSI: 4
Jan 12 16:49:46 x3400 kernel: sd 11:0:0:0: [sdc] 312579695 512-byte hardware
sectors (160041 MB)
Jan 12 16:49:46 x3400 kernel: sd 11:0:0:0: [sdc] Write Protect is off
Jan 12 16:49:46 x3400 kernel: sd 11:0:0:0: [sdc] Mode Sense: 11 00 00 00
Jan 12 16:49:46 x3400 kernel: sd 11:0:0:0: [sdc] Write cache: enabled, read
cache: enabled, doesn't support DPO or FUA
Jan 12 16:49:46 x

Re: [PATCH] scsi_transport_spi: convert to attribute groups

2008-01-12 Thread James Bottomley

On Fri, 2008-01-11 at 21:11 -0800, Greg KH wrote:
> On Sat, Jan 05, 2008 at 10:18:27AM -0600, James Bottomley wrote:
> > This conversion makes full use of the is_visible() callback on attribute
> > groups.  Now, each device appears only with its capability flags in the
> > transport class directory.  Previously each device appeared with the
> > capability of the host, so this is a functionality improvement.
> > Converting to attribute groups allows us to sweep away most of the home
> > grown #defines that were effectively doing the same thing.
> > 
> > James
> > 
> > ---
> > 
> > This depends on:
> > 
> > [PATCH] sysfs: add filter function to groups
> > [PATCH] fix the sysfs_add_file_to_group interfaces
> > [PATCH] attribute_container: update to use the group interface
> > [PATCH] add missing transport configure points for target and host
> > 
> > Greg and Kay, there's a nasty point in the code where I'd like to use
> > the -EEXIST return of sysfs_add_file_to_group() to indicate the file is
> > already there, however, this also dumps a stack trace and would frighten
> > users ... can we get rid of the printk and the WARN_ON(1)?
> 
> I really don't want to, as it has caught a lot of problems in the past.
> 
> What do you want to do that needs this error to happen "properly"?

The reason I'm interested is because the existence of the file is
storing information for me in the sysfs tree.  (Or rather allowing me to
forget information).  Perhaps just an API to check for the existence of
the file for an attribute would be enough?

something like sysfs_check_file_in_group(struct kobject *kobj,
const struct attribute *attr, const char *group)

?

James

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


[PATCH 5/7] scsi : use class iteration api

2008-01-12 Thread Dave Young
Convert to use the class iteration api.

Signed-off-by: Dave Young <[EMAIL PROTECTED]> 

---
 drivers/scsi/hosts.c |   26 +++---
 1 file changed, 15 insertions(+), 11 deletions(-)

diff -upr linux/drivers/scsi/hosts.c linux.new/drivers/scsi/hosts.c
--- linux/drivers/scsi/hosts.c  2008-01-12 15:54:16.0 +0800
+++ linux.new/drivers/scsi/hosts.c  2008-01-12 15:54:16.0 +0800
@@ -429,6 +429,17 @@ void scsi_unregister(struct Scsi_Host *s
 }
 EXPORT_SYMBOL(scsi_unregister);
 
+static int __scsi_host_match(struct class_device *cdev, void *data)
+{
+   struct Scsi_Host *p;
+   unsigned short *hostnum = (unsigned short *)data;
+
+   p = class_to_shost(cdev);
+   if (p->host_no == *hostnum)
+   return 1;
+   return 0;
+}
+
 /**
  * scsi_host_lookup - get a reference to a Scsi_Host by host no
  *
@@ -439,19 +450,12 @@ EXPORT_SYMBOL(scsi_unregister);
  **/
 struct Scsi_Host *scsi_host_lookup(unsigned short hostnum)
 {
-   struct class *class = &shost_class;
struct class_device *cdev;
-   struct Scsi_Host *shost = ERR_PTR(-ENXIO), *p;
+   struct Scsi_Host *shost = ERR_PTR(-ENXIO);
 
-   down(&class->sem);
-   list_for_each_entry(cdev, &class->children, node) {
-   p = class_to_shost(cdev);
-   if (p->host_no == hostnum) {
-   shost = scsi_host_get(p);
-   break;
-   }
-   }
-   up(&class->sem);
+   cdev = class_find_child(&shost_class, &hostnum, __scsi_host_match);
+   if (cdev)
+   shost = scsi_host_get(class_to_shost(cdev));
 
return shost;
 }
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html