Re: How to add/drop SCSI drives from within the driver?

2005-01-26 Thread Brian King
Newer kernels also have kobject_uevent, which lets any application use 
netlink to look for hotplug events.

-Brian
Mukker, Atul wrote:
Thanks for the suggestion. After more exploration, looks like different
distribution have different implementations for /sbin/hotplug. This may
aggravate the issue for applications. For now, we will stick with a wait and
watch after bus scan :-(
Will probe the [EMAIL PROTECTED] list for more
pointers
Thanks
===
Atul Mukker
Architect, Drivers and BIOS
LSI Logic Corporation

-Original Message-
From: Patrick Mansfield [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 25, 2005 11:52 AM
To: Mukker, Atul
Cc: 'James Bottomley'; Linux Kernel; SCSI Mailing List
Subject: Re: How to add/drop SCSI drives from within the driver?

Atul -
On Tue, Jan 25, 2005 at 11:27:36AM -0500, Mukker, Atul wrote:
After writing the - - - to the scan attribute, the management 
applications assume the udev has created the relevant 
entries in the 

/dev directly and try to use the devices _immediately_ and 
fail to see 

the devices
Is there a hotplug event which would tell the management 
applications 

that the device nodes have actually been created now and 
ready to be used?
Read the udev man page section, the part right before 
FILES. Try putting a script under /etc/dev.d/default/*.dev. 
Then you can get more specific with an /etc/dev.d/scsi/*.dev 
script or something else.

I just tried something simple but did not get it working.
Try [EMAIL PROTECTED] list for help.
-- Patrick Mansfield
-
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

--
Brian King
eServer Storage I/O
IBM Linux Technology Center
-
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: How to add/drop SCSI drives from within the driver?

2005-01-26 Thread Greg KH
 Thanks for the suggestion. After more exploration, looks like different
 distribution have different implementations for /sbin/hotplug. This may
 aggravate the issue for applications. For now, we will stick with a wait and
 watch after bus scan :-(

What do you mean?  Just use the /etc/dev.d notification stuff that all
distros that use udev have.

And what do you mean different implementations for /sbin/hotplug?
What distros do not use the standard linux-hotplug type scripts, or if
not the scripts, the same functionality?

thanks,

greg k-h
-
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


Should multipath detect changed path UIDs?

2005-01-26 Thread goggin, edward
Simply pulling two FC cables from a host and re-cabling incorrectly
(think a switch of two HBA cables) or a surprise reconfiguration of a
storage system target could lead to a situation where the potential for
data corruption is ripe.  While it may not be reasonably possible to
prevent data corruption in this scenario (think I/O already queued to
target devices underneath the multipath target driver), the prudent
course of action may be to try to prevent data corruption whenever
the potential is discovered using reasonable means.

Besides such pilot error as described above, the pre-requisites for
the cable switch scenario include at least (1) having the cable disconnect
and subsequent re-connect events occur while no user or path checker
initiated I/O occurs to paths using the switched cables and (2) the
target-side connectivity for the two cables is asymmetrical.

Possible solutions could involve (1) detecting fiber channel disconnect
hotplug events and acting upon them or (2) modifying multipath checker
functions to verify a path's UID remains consistent in addition to verifying
path connectivity.

EMC's multipathing product PowerPath uses the latter approach for
testing paths to SCSI logical units on both Symmetrix and CLARiion
storage systems.  Although using a single I/O for path testing may not
be possible for many storage systems, the PowerPath checker function
for both Symmetrix and CLARiion storage determines the UID for the
SCSI logical unit from reply (or sense) information returned by a single
test I/O and fails a path if the UID is not consistent.
-
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


how to prevent device hotplugging from incrementing scsi bus number?

2005-01-26 Thread Dan Hollis
*** please cc: replies in email as i'm not subscribed to the list. ***

I'm using usb and 1394 to hotplug various devices (dvd-rw, drives, etc).
kernel 2.6.9.

To unplug, I use the procedure:
unmount device (if it's mounted)
sync
echo scsi remove-single-device busnumber 0 0 0  /proc/scsi/scsi

then i cat /proc/scsi/scsi to make sure its gone, then i unplug the 
device.

problem is, every time i replug the same device back in, it increments the 
scsi bus number. eventually it ends up going over bus number 16, so that 
eg dvdrecord/etc can no longer talk to the drive.

is there a way to tell the scsi drivers to reuse unused scsi bus numbers, 
rather than always incrementing?

i've tried unloading all the scsi and firewire/usb drivers and reloading 
them and it doesn't seem to help.

-Dan

-
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: How to add/drop SCSI drives from within the driver?

2005-01-26 Thread Mukker, Atul
 
 And what do you mean different implementations for /sbin/hotplug?
 What distros do not use the standard linux-hotplug type 
 scripts, or if not the scripts, the same functionality?

You are right, even though distributions (I checked Red Hat and SuSE) have
different /sbin/hotplug scripts (e.g., SuSE 9.2 will not execute files from
/etc/hotplug.d whereas Red Hat does) udev will be invoked in all cases,
which will take care of creating device nodes.

But our concern is that how would the applications get the cue that udev has
actually created the nodes for the new devices? 

Make sure an agent is called after the, e.g., scsi agents are executed from
/etc/hotplug directory (which happen to be scsi.agent, scsi_device.agent,
scsi_host.agent in one and only scsi.agent in other distribution), by
writing an rc like script?

Or more likely, by placing our agent in /etc/dev.d directory. Unfortunately,
there seems be not a consensus here as well. On system has default and
net directories and other has block, input, net, tty?


Thanks


Atul Mukker
Architect, RAID Drivers and BIOS
LSI Logic Corporation
-
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


3ware driver update for 2.6.11-rc2-mm2

2005-01-26 Thread adam radford
James,

Here is a patch to update a few bugs in the 3ware driver for
5/6/7/8000 controllers.

-Adam

diff -Naur linux-2.6.11-rc2-mm1/drivers/scsi/3w-.c linux-2.6.11-rc2-mm2/driv
ers/scsi/3w-.c
--- linux-2.6.11-rc2-mm1/drivers/scsi/3w-.c 2004-12-24 13:35:28.0 -0
800
+++ linux-2.6.11-rc2-mm2/drivers/scsi/3w-.c 2005-01-26 16:46:02.0 -0
800
@@ -6,7 +6,7 @@
 Arnaldo Carvalho de Melo [EMAIL PROTECTED]
  Brad Strand [EMAIL PROTECTED]
 
-   Copyright (C) 1999-2004 3ware Inc.
+   Copyright (C) 1999-2005 3ware Inc.
 
Kernel compatiblity By: Andre Hedrick [EMAIL PROTECTED]
Non-Copyright (C) 2000  Andre Hedrick [EMAIL PROTECTED]
@@ -185,6 +185,13 @@
  Fix data_buffer_length usage in tw_chrdev_ioctl().
  Update contact information.
1.26.02.000 - Convert driver to pci_driver format.
+   1.26.02.001 - Increase max ioctl buffer size to 512 sectors.
+ Make tw_scsi_queue() return 0 for 'Unknown scsi opcode'.
+ Fix tw_interrupt() to ignore interrupts from other devices
+ during reset.
+ Fix tw_scsi_queue() to BUSY io's during a reset.
+ Fix tw_remove() to free irq handler/unregister_chrdev()
+ before shutting down card.
 */
 
 #include linux/module.h
@@ -207,7 +214,7 @@
 #include 3w-.h
 
 /* Globals */
-#define TW_DRIVER_VERSION 1.26.02.000
+#define TW_DRIVER_VERSION 1.26.02.001
 static TW_Device_Extension *tw_device_extension_list[TW_MAX_SLOT];
 static int tw_device_extension_count = 0;
 static int twe_major = -1;
@@ -910,7 +917,7 @@
goto out;
 
/* Check size */
-   if (data_buffer_length  TW_MAX_SECTORS * 512) {
+   if (data_buffer_length  TW_MAX_IOCTL_SECTORS * 512) {
retval = -EINVAL;
goto out;
}
@@ -1366,6 +1373,7 @@
TW_DISABLE_INTERRUPTS(tw_dev);
TW_MASK_COMMAND_INTERRUPT(tw_dev);
spin_lock_irqsave(tw_dev-host-host_lock, flags);
+   tw_dev-online = 0;
 
/* Abort all requests that are in progress */
for (i=0;iTW_Q_LENGTH;i++) {
@@ -1401,6 +1409,7 @@
return 1;
}
TW_ENABLE_AND_CLEAR_INTERRUPTS(tw_dev);
+   tw_dev-online = 1;
 
/* Wake up any ioctl that was pending before the reset */
if ((tw_dev-chrdev_request_id == TW_IOCTL_CHRDEV_FREE) || (ioctl_reset)
) {
@@ -2007,6 +2016,12 @@
int retval = 1;
TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt-device-host
-hostdata;
 
+   /* If we are off-line doing a reset, report as busy */
+   if (!tw_dev-online) {
+   retval = SCSI_MLQUEUE_HOST_BUSY;
+   goto out;
+   }
+
/* Save done function into Scsi_Cmnd struct */
SCpnt-scsi_done = done;
 
@@ -2060,7 +2075,7 @@
tw_state_request_finish(tw_dev, request_id);
SCpnt-result = (DID_BAD_TARGET  16);
done(SCpnt);
-   goto out;
+   retval = 0;
}
if (retval) {
tw_dev-state[request_id] = TW_S_COMPLETED;
@@ -2093,6 +2108,10 @@
 
handled = 1;
 
+   /* If card is offline, bail */
+   if (!tw_dev-online)
+   goto tw_interrupt_bail;
+
/* Read the registers */
status_reg_value = inl(TW_STATUS_REG_ADDR(tw_dev));
 
@@ -2407,6 +2426,7 @@
 
/* Re-enable interrupts on the card */
TW_ENABLE_AND_CLEAR_INTERRUPTS(tw_dev);
+   tw_dev-online = 1;
 
/* Finally, scan the host */
scsi_scan_host(host);
@@ -2438,23 +2458,24 @@
 
scsi_remove_host(tw_dev-host);
 
-   __tw_shutdown(tw_dev);
+   /* Unregister character device */
+   if (twe_major = 0) {
+   unregister_chrdev(twe_major, twe);
+   twe_major = -1;
+   }
 
/* Free up the IRQ */
free_irq(tw_dev-tw_pci_dev-irq, tw_dev);
 
+   /* Shutdown the card */
+   __tw_shutdown(tw_dev);
+
/* Free up the mem region */
pci_release_regions(pdev);
 
/* Free up device extension resources */
tw_free_device_extension(tw_dev);
 
-   /* Unregister character device */
-   if (twe_major = 0) {
-   unregister_chrdev(twe_major, twe);
-   twe_major = -1;
-   }
-
scsi_host_put(tw_dev-host);
pci_disable_device(pdev);
tw_device_extension_count--;
diff -Naur linux-2.6.11-rc2-mm1/drivers/scsi/3w-.h linux-2.6.11-rc2-mm2/driv
ers/scsi/3w-.h
--- linux-2.6.11-rc2-mm1/drivers/scsi/3w-.h 2005-01-26 16:41:52.0 -0
800
+++ linux-2.6.11-rc2-mm2/drivers/scsi/3w-.h 2005-01-26 16:46:04.0 -0
800
@@ -6,7 +6,7 @@
 Arnaldo Carvalho de Melo [EMAIL PROTECTED]
  Brad Strand 

Re: dc395x: can't write to tape

2005-01-26 Thread Andrew Schulman
   I could try to improve the highmem situation / sg-handling. Or do you
   plan to do it, Jamie?
 
  It's on my list of things to do, but I doubt I'll have any time to do
  anything about in the next few months. So if you have the time and
  desire please go ahead! I'll can test any changes you make (with a
  CD-R/W, tape-drive and HDD), although it may take me a week or two to
  get around to it.

 Ok, less than 2 weeks and here comes the first attempt. It removes
 page_to_virt and maps sg lists dynamically. Please, review, test. Slightly
 tested here - without highmem.

Guennadi and Jamie, thanks for your help on this.  However, I'm afraid I have 
to bail out at this point.  My tape drive was the only reason I was keeping 
my old DC395UW controller going, and it has now gone bad.  So I've had to 
yank both the card and tape drive and install a different backup solution.  
So, I can't test any patches.

Good luck, and my highest regards to both of you for your continuing work on 
this project.  You are making one corner of Linux and open source software 
work.

Andrew.
-
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] add missing class_device_del to transport classes

2005-01-26 Thread Mike Christie
James,
It appears there is a missing class_device_del.
The comments for transport_remove_device indicate
that transport_remove_classdev should call it
(which the attached patch does), but the comment in
attribute_container_remove_device:
 If you want a
 * two phase release: remove from visibility and then delete the
 * device, then you should use this routine with a fn that calls
 * class_device_del() and then use
 * attribute_container_device_trigger() to do the final put on the
 * classdev.
Indicate that maybe transport_destroy_classdev and
transport_remove_device are incorrect. However,
attribute_container_remove_device will do a
list_del(ic-node); so that later calls to
attribute_container_device_trigger would not be able
to do the final put on that classdev. I assumed the
comments in attribute_container_remove_device
are incorrect, so the attached patch made against
scsi-rc-fixes-2.6 adds a call to class_device_del
to transport_remove_classdev.
I did not fix the comments in attribute_container_remove_device
becuase I was not 100% certain what is the correct behavior or
usage.
Mike
--- scsi-rc-fixes-2.6.orig/drivers/base/transport_class.c	2005-01-25 13:30:27.0 -0800
+++ scsi-rc-fixes-2.6.newtest/drivers/base/transport_class.c	2005-01-26 15:22:52.0 -0800
@@ -216,10 +216,16 @@ static int transport_remove_classdev(str
  struct class_device *classdev)
 {
 	struct transport_class *tclass = class_to_transport_class(cont-class);
+	struct class_device_attribute **attrs = cont-attrs;
+	int i;
 
 	if (tclass-remove)
 		tclass-remove(dev);
 
+	for (i = 0; attrs[i]; i++)
+		class_device_remove_file(classdev, attrs[i]);
+	class_device_del(classdev);
+
 	return 0;
 }
 


Fwd: 2.6.10 sata and ide tape drive bug

2005-01-26 Thread slash
I sent this a few days ago and thought somone might be able to shed some light ?
have a i posted to the wrong list?

thanx

--Chris

- Forwarded message from [EMAIL PROTECTED] -
Date: Fri, 21 Jan 2005 00:48:22 +1030
From: [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
 Subject: 2.6.10 sata and ide tape drive bug
  To: linux-scsi@vger.kernel.org

Hi,

I have two machines setup one running a sata HDD and another with a pata HDD
both running 2.6.10
On both of these machines i have a segate STT2A tape drive

both machines are configured identical except the sata has the scsi low level
sata intel driver enabled.

To make the tape drive work i enable the scsi emultaion and the scsi tape drive
support in both kernels 2.4 and 2.6

When i issue tar -cf /dev/st0 /
the sata box kernel panics whlie the pata box uses the tape drive fine.

I was previously using the same options with a 2.4.28 kernel using the scsi
emultaion and the lowlevel sata intel driver and when i issue tar -cf /dev/st0
/ the tape drive worked flawlessly.

I for one cant understand how the config works fine in 2.4 and not in 2.6. I
would assume the libata has a bug as the pata system works fine.

when i run the mt tool to find the status of the tape all kernels / systems show
everything as fine.

I hope posting to this list is the right thing to do.

I have attached both config files if that helps,

the kernel panic - not syncing:fatal exception in interrupt is the message i get
given.

the call trace is rather long with alot of c0 address's
the list under call trace shows ata_output, atapi_output,idescsi_output,
idescso_pc_intr and so onwith hex values after each item... there is alot
to type here if its useful how can i get it to save so i dont have to type
everything?

thanx guys

--Chris



This message was sent using Zonemail.
http://www.thezoneinternet.com.au

- End forwarded message -




This message was sent using Zonemail. 
http://www.thezoneinternet.com.au
#
# Automatically generated by make menuconfig: don't edit
#
CONFIG_X86=y
# CONFIG_SBUS is not set
CONFIG_UID16=y

#
# Code maturity level options
#
CONFIG_EXPERIMENTAL=y

#
# Loadable module support
#
CONFIG_MODULES=y
CONFIG_MODVERSIONS=y
CONFIG_KMOD=y

#
# Processor type and features
#
CONFIG_LOLAT=y
CONFIG_LOLAT_SYSCTL=y
# CONFIG_M386 is not set
# CONFIG_M486 is not set
# CONFIG_M586 is not set
# CONFIG_M586TSC is not set
# CONFIG_M586MMX is not set
# CONFIG_M586MMX31 is not set
# CONFIG_M686 is not set
# CONFIG_MPPRO31 is not set
# CONFIG_M68631 is not set
# CONFIG_MPENTIUMIII is not set
# CONFIG_MPENTIUMIII31 is not set
# CONFIG_MPENTIUM4 is not set
CONFIG_MPENTIUM431=y
# CONFIG_MK6 is not set
# CONFIG_MK6231 is not set
# CONFIG_MK7 is not set
# CONFIG_MK731 is not set
# CONFIG_MXP31 is not set
# CONFIG_MMP31 is not set
# CONFIG_MK8 is not set
# CONFIG_MELAN is not set
# CONFIG_MCRUSOE is not set
# CONFIG_MWINCHIPC6 is not set
# CONFIG_MWINCHIP2 is not set
# CONFIG_MWINCHIP3D is not set
# CONFIG_MCYRIXIII is not set
# CONFIG_MVIAC3_2 is not set
CONFIG_X86_WP_WORKS_OK=y
CONFIG_X86_INVLPG=y
CONFIG_X86_CMPXCHG=y
CONFIG_X86_XADD=y
CONFIG_X86_BSWAP=y
CONFIG_X86_POPAD_OK=y
# CONFIG_RWSEM_GENERIC_SPINLOCK is not set
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_X86_L1_CACHE_SHIFT=7
CONFIG_X86_HAS_TSC=y
CONFIG_X86_GOOD_APIC=y
CONFIG_X86_PGE=y
CONFIG_X86_USE_PPRO_CHECKSUM=y
CONFIG_X86_MCE=y
# CONFIG_TOSHIBA is not set
# CONFIG_I8K is not set
# CONFIG_MICROCODE is not set
# CONFIG_X86_MSR is not set
# CONFIG_X86_CPUID is not set
# CONFIG_EDD is not set
# CONFIG_NOHIGHMEM is not set
CONFIG_HIGHMEM4G=y
# CONFIG_HIGHMEM64G is not set
CONFIG_HIGHMEM=y
CONFIG_1GB=y
# CONFIG_2GB is not set
# CONFIG_3GB is not set
# CONFIG_05GB is not set
CONFIG_HIGHIO=y
# CONFIG_MATH_EMULATION is not set
# CONFIG_MTRR is not set
CONFIG_SMP=y
CONFIG_PREEMPT=y
CONFIG_NR_CPUS=2
# CONFIG_X86_NUMA is not set
# CONFIG_X86_TSC_DISABLE is not set
CONFIG_X86_TSC=y
CONFIG_HAVE_DEC_LOCK=y

#
# General setup
#
CONFIG_NET=y
CONFIG_X86_IO_APIC=y
CONFIG_X86_LOCAL_APIC=y
CONFIG_PCI=y
# CONFIG_PCI_GOBIOS is not set
# CONFIG_PCI_GODIRECT is not set
CONFIG_PCI_GOANY=y
CONFIG_PCI_BIOS=y
CONFIG_PCI_DIRECT=y
# CONFIG_ISA is not set
# CONFIG_PCI_NAMES is not set
# CONFIG_EISA is not set
# CONFIG_MCA is not set
CONFIG_HOTPLUG=y

#
# PCMCIA/CardBus support
#
# CONFIG_PCMCIA is not set

#
# PCI Hotplug Support
#
# CONFIG_HOTPLUG_PCI is not set
# CONFIG_HOTPLUG_PCI_COMPAQ is not set
# CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM is not set
# CONFIG_HOTPLUG_PCI_IBM is not set
# CONFIG_HOTPLUG_PCI_SHPC is not set
# CONFIG_HOTPLUG_PCI_SHPC_POLL_EVENT_MODE is not set
# CONFIG_HOTPLUG_PCI_SHPC_PHPRM_LEGACY is not set
# CONFIG_HOTPLUG_PCI_PCIE is not set
# CONFIG_HOTPLUG_PCI_PCIE_POLL_EVENT_MODE is not set
CONFIG_SYSVIPC=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_SYSCTL=y
CONFIG_KCORE_ELF=y
# CONFIG_KCORE_AOUT