AACRAID fails to initialize after an kexec operation

2007-04-23 Thread Vivek Goyal
Hi,

I am trying to kexec into 2.6.21-rc6-mm1 kernel on an x86_64 machine and
aacraid panics in the second kernel. Following is the panic message.

Any idea what's going on? Please let me know if more details are required.

Adaptec aacraid driver (1.1-5[2437]-mh4)
ACPI: PCI Interrupt :01:02.0[A] -> GSI 25 (level, low) -> IRQ 25
Unable to handle kernel NULL pointer dereference at  RIP:
 [<>]
PGD 0
Oops:  [1] SMP
last sysfs file:
CPU 4
Modules linked in:
Pid: 1, comm: swapper Not tainted 2.6.21-rc6-mm1 #2
RIP: 0010:[<>]  [<>]
RSP: 0018:810100c9fc78  EFLAGS: 00010246
RAX: 810100c9fcc4 RBX:  RCX: 
RDX:  RSI: 1001 RDI: 810100e02d30
RBP: 810100e02d30 R08:  R09: 
R10:  R11: 0002 R12: 810100e02800
R13:  R14: 80690ee1 R15: 002d
FS:  () GS:810100cf6440() knlGS:
CS:  0010 DS: 0018 ES: 0018 CR0: 8005003b
CR2:  CR3: 00201000 CR4: 06e0
Process swapper (pid: 1, threadinfo 810100c9e000, task 810100c9d450)
Stack:  8045952f   810100c9fcc4
    
 80690ee1 002d 810100e02d30 0001
Call Trace:
Inexact backtrace:
 [] aac_rx_restart_adapter+0x7e/0x169
 [] _aac_rx_init+0x70/0x2f6
 [] cache_alloc_refill+0xdb/0x1db
 [] aac_probe_one+0x1a9/0x462
 [] pci_device_probe+0xd1/0x138
 [] driver_probe_device+0xf7/0x174
 [] __driver_attach+0x6f/0xae
 [] __driver_attach+0x0/0xae
 [] __driver_attach+0x0/0xae
 [] bus_for_each_dev+0x43/0x6e
 [] bus_add_driver+0x78/0x19a
 [] __pci_register_driver+0x58/0x8d
 [] aac_init+0x35/0x70
 [] kernel_init+0x167/0x2d1
 [] child_rip+0xa/0x12
 [] acpi_ds_init_one_object+0x0/0x7c
 [] kernel_init+0x0/0x2d1
 [] child_rip+0x0/0x12


Code:  Bad RIP value.
RIP  [<>]
 RSP 
CR2: 
Kernel panic - not syncing: Attempted to kill init!

Thanks
Vivek
-
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


Fwd: [PATCH 23/28] Fix BusLogic to stop using check_region

2007-04-23 Thread Andi Kleen

Something for the SCSI tree

-Andi
--- Begin Message ---
I got so sick of seing the check_region warnings from BusLogic.c I actually
fixed it properly.  Never use check region, reserve it before the probe
with request region instead and check the error result; free region if
setup fails.  Should be functionally identical to the original except for
fixing the potential race.

From: Zachary Amsden <[EMAIL PROTECTED]>
Signed-off-by: Zachary Amsden <[EMAIL PROTECTED]>
CC: Lenoard N. Zubkoff <[EMAIL PROTECTED]>
CC: Michael Clay <[EMAIL PROTECTED]>

---
 drivers/scsi/BusLogic.c |   73 ++-
 1 file changed, 48 insertions(+), 25 deletions(-)

===
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -579,17 +579,17 @@ static void __init BusLogic_InitializePr
/*
   Append the list of standard BusLogic MultiMaster ISA I/O Addresses.
 */
-   if (BusLogic_ProbeOptions.LimitedProbeISA ? 
BusLogic_ProbeOptions.Probe330 : check_region(0x330, 
BusLogic_MultiMasterAddressCount) == 0)
+   if (!BusLogic_ProbeOptions.LimitedProbeISA || 
BusLogic_ProbeOptions.Probe330)
BusLogic_AppendProbeAddressISA(0x330);
-   if (BusLogic_ProbeOptions.LimitedProbeISA ? 
BusLogic_ProbeOptions.Probe334 : check_region(0x334, 
BusLogic_MultiMasterAddressCount) == 0)
+   if (!BusLogic_ProbeOptions.LimitedProbeISA || 
BusLogic_ProbeOptions.Probe334)
BusLogic_AppendProbeAddressISA(0x334);
-   if (BusLogic_ProbeOptions.LimitedProbeISA ? 
BusLogic_ProbeOptions.Probe230 : check_region(0x230, 
BusLogic_MultiMasterAddressCount) == 0)
+   if (!BusLogic_ProbeOptions.LimitedProbeISA || 
BusLogic_ProbeOptions.Probe230)
BusLogic_AppendProbeAddressISA(0x230);
-   if (BusLogic_ProbeOptions.LimitedProbeISA ? 
BusLogic_ProbeOptions.Probe234 : check_region(0x234, 
BusLogic_MultiMasterAddressCount) == 0)
+   if (!BusLogic_ProbeOptions.LimitedProbeISA || 
BusLogic_ProbeOptions.Probe234)
BusLogic_AppendProbeAddressISA(0x234);
-   if (BusLogic_ProbeOptions.LimitedProbeISA ? 
BusLogic_ProbeOptions.Probe130 : check_region(0x130, 
BusLogic_MultiMasterAddressCount) == 0)
+   if (!BusLogic_ProbeOptions.LimitedProbeISA || 
BusLogic_ProbeOptions.Probe130)
BusLogic_AppendProbeAddressISA(0x130);
-   if (BusLogic_ProbeOptions.LimitedProbeISA ? 
BusLogic_ProbeOptions.Probe134 : check_region(0x134, 
BusLogic_MultiMasterAddressCount) == 0)
+   if (!BusLogic_ProbeOptions.LimitedProbeISA || 
BusLogic_ProbeOptions.Probe134)
BusLogic_AppendProbeAddressISA(0x134);
 }
 
@@ -795,7 +795,9 @@ static int __init BusLogic_InitializeMul
   host adapters are probed.
 */
if (!BusLogic_ProbeOptions.NoProbeISA)
-   if (PrimaryProbeInfo->IO_Address == 0 && 
(BusLogic_ProbeOptions.LimitedProbeISA ? BusLogic_ProbeOptions.Probe330 : 
check_region(0x330, BusLogic_MultiMasterAddressCount) == 0)) {
+   if (PrimaryProbeInfo->IO_Address == 0 &&
+   (!BusLogic_ProbeOptions.LimitedProbeISA ||
+BusLogic_ProbeOptions.Probe330)) {
PrimaryProbeInfo->HostAdapterType = 
BusLogic_MultiMaster;
PrimaryProbeInfo->HostAdapterBusType = BusLogic_ISA_Bus;
PrimaryProbeInfo->IO_Address = 0x330;
@@ -805,15 +807,25 @@ static int __init BusLogic_InitializeMul
   omitting the Primary I/O Address which has already been handled.
 */
if (!BusLogic_ProbeOptions.NoProbeISA) {
-   if (!StandardAddressSeen[1] && 
(BusLogic_ProbeOptions.LimitedProbeISA ? BusLogic_ProbeOptions.Probe334 : 
check_region(0x334, BusLogic_MultiMasterAddressCount) == 0))
+   if (!StandardAddressSeen[1] &&
+   (!BusLogic_ProbeOptions.LimitedProbeISA ||
+BusLogic_ProbeOptions.Probe334))
BusLogic_AppendProbeAddressISA(0x334);
-   if (!StandardAddressSeen[2] && 
(BusLogic_ProbeOptions.LimitedProbeISA ? BusLogic_ProbeOptions.Probe230 : 
check_region(0x230, BusLogic_MultiMasterAddressCount) == 0))
+   if (!StandardAddressSeen[2] &&
+   (!BusLogic_ProbeOptions.LimitedProbeISA ||
+BusLogic_ProbeOptions.Probe230))
BusLogic_AppendProbeAddressISA(0x230);
-   if (!StandardAddressSeen[3] && 
(BusLogic_ProbeOptions.LimitedProbeISA ? BusLogic_ProbeOptions.Probe234 : 
check_region(0x234, BusLogic_MultiMasterAddressCount) == 0))
+   if (!StandardAddressSeen[3] &&
+   (!BusLogic_ProbeOptions.LimitedProbeISA ||
+BusLogic_ProbeOptions.Probe234))
BusLogic_AppendProbeAddressISA(0x23

RE: AACRAID fails to initialize after an kexec operation

2007-04-23 Thread Salyzyn, Mark
2.6.21-rc6-mm1 contains an earlier kexec patch, that one needs to be
removed and this one put in it's place.

Basically the following fragment represents the update in the later
patch that deals with this specific issue.

diff -ru a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c
@@ -535,6 +539,8 @@
}

/* Failure to reset here is an option ... */
+   dev->a_ops.adapter_sync_cmd = rx_sync_cmd;
+   dev->a_ops.adapter_enable_int = aac_rx_disable_interrupt;
dev->OIMR = status = rx_readb (dev, MUnit.OIMR);
if status & 0xff) != 0xff) || reset_devices) &&
  !aac_rx_restart_adapter(dev, 0))

Sincerely -- Mark Salyzyn

> -Original Message-
> From: Vivek Goyal [mailto:[EMAIL PROTECTED] 
> Sent: Monday, April 23, 2007 3:49 AM
> To: linux-scsi@vger.kernel.org; AACRAID
> Cc: Kexec Mailing List; Salyzyn, Mark
> Subject: AACRAID fails to initialize after an kexec operation
> 
> 
> Hi,
> 
> I am trying to kexec into 2.6.21-rc6-mm1 kernel on an x86_64 
> machine and
> aacraid panics in the second kernel. Following is the panic message.
> 
> Any idea what's going on? Please let me know if more details 
> are required.
> 
> Adaptec aacraid driver (1.1-5[2437]-mh4)
> ACPI: PCI Interrupt :01:02.0[A] -> GSI 25 (level, low) -> IRQ 25
> Unable to handle kernel NULL pointer dereference at 
>  RIP:
>  [<>]
> PGD 0
> Oops:  [1] SMP
> last sysfs file:
> CPU 4
> Modules linked in:
> Pid: 1, comm: swapper Not tainted 2.6.21-rc6-mm1 #2
> RIP: 0010:[<>]  [<>]
> RSP: 0018:810100c9fc78  EFLAGS: 00010246
> RAX: 810100c9fcc4 RBX:  RCX: 
> RDX:  RSI: 1001 RDI: 810100e02d30
> RBP: 810100e02d30 R08:  R09: 
> R10:  R11: 0002 R12: 810100e02800
> R13:  R14: 80690ee1 R15: 002d
> FS:  () GS:810100cf6440() 
> knlGS:
> CS:  0010 DS: 0018 ES: 0018 CR0: 8005003b
> CR2:  CR3: 00201000 CR4: 06e0
> Process swapper (pid: 1, threadinfo 810100c9e000, task 
> 810100c9d450)
> Stack:  8045952f   
> 810100c9fcc4
>     
>  80690ee1 002d 810100e02d30 0001
> Call Trace:
> Inexact backtrace:
>  [] aac_rx_restart_adapter+0x7e/0x169
>  [] _aac_rx_init+0x70/0x2f6
>  [] cache_alloc_refill+0xdb/0x1db
>  [] aac_probe_one+0x1a9/0x462
>  [] pci_device_probe+0xd1/0x138
>  [] driver_probe_device+0xf7/0x174
>  [] __driver_attach+0x6f/0xae
>  [] __driver_attach+0x0/0xae
>  [] __driver_attach+0x0/0xae
>  [] bus_for_each_dev+0x43/0x6e
>  [] bus_add_driver+0x78/0x19a
>  [] __pci_register_driver+0x58/0x8d
>  [] aac_init+0x35/0x70
>  [] kernel_init+0x167/0x2d1
>  [] child_rip+0xa/0x12
>  [] acpi_ds_init_one_object+0x0/0x7c
>  [] kernel_init+0x0/0x2d1
>  [] child_rip+0x0/0x12
> 
> 
> Code:  Bad RIP value.
> RIP  [<>]
>  RSP 
> CR2: 
> Kernel panic - not syncing: Attempted to kill init!
> 
> Thanks
> Vivek
> 


aacraid_kexec_5.patch
Description: aacraid_kexec_5.patch


[PATCH] aacraid: fails to initialize after a kexec operation

2007-04-23 Thread Salyzyn, Mark
Missing portion of the kexec changes to the aacraid driver. The platform
functions were not initialized when the restart function is activated
resulting in a panic when these platform functions are called. Please
note that it is NOT a mistake that the disable interrupt handler is used
as the initial value of the enable interrupt platform function, it will
be set up correctly once the adapter is discovered and initialized.

Please note that aacraid_kexec_5.patch contains this fix, since an
earlier aacraid_kexec patch was applied to the tree and appears to have
propagated, this is meant to supersede the earlier patch and bring it up
to date with aacraid_kexec_5.patch, but expected to break when the
aacraid_kexec_5.patch propagates... James, can you sort out this mess
(either by stopping aacraid_kexec_5.patch, or by letting this enclosed
patch move with some level of priority)?

ObligatoryDisclaimer: Please accept my condolences regarding Outlook's
handling of patches.

This attached patch is against current scsi-misc-2.6. Also expect this
patch can be applied to 2.6.21-rc6-mm1

Signed-off-by: Mark Salyzyn <[EMAIL PROTECTED]>

---

Sincerely -- Mark Salyzyn

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Salyzyn, Mark
> Sent: Monday, April 23, 2007 9:01 AM
> To: [EMAIL PROTECTED]; linux-scsi@vger.kernel.org
> Cc: Kexec Mailing List
> Subject: RE: AACRAID fails to initialize after an kexec operation
> 
> 
> 2.6.21-rc6-mm1 contains an earlier kexec patch, that one needs to be
> removed and this one put in it's place.
> 
> Basically the following fragment represents the update in the later
> patch that deals with this specific issue.
> 
> diff -ru a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c
> @@ -535,6 +539,8 @@
> }
> 
> /* Failure to reset here is an option ... */
> +   dev->a_ops.adapter_sync_cmd = rx_sync_cmd;
> +   dev->a_ops.adapter_enable_int = aac_rx_disable_interrupt;
> dev->OIMR = status = rx_readb (dev, MUnit.OIMR);
> if status & 0xff) != 0xff) || reset_devices) &&
>   !aac_rx_restart_adapter(dev, 0))
> 
> Sincerely -- Mark Salyzyn
> 
> > -Original Message-
> > From: Vivek Goyal [mailto:[EMAIL PROTECTED] 
> > Sent: Monday, April 23, 2007 3:49 AM
> > To: linux-scsi@vger.kernel.org; AACRAID
> > Cc: Kexec Mailing List; Salyzyn, Mark
> > Subject: AACRAID fails to initialize after an kexec operation
> > 
> > 
> > Hi,
> > 
> > I am trying to kexec into 2.6.21-rc6-mm1 kernel on an x86_64 
> > machine and
> > aacraid panics in the second kernel. Following is the panic message.
> > 
> > Any idea what's going on? Please let me know if more details 
> > are required.
> > 
> > Adaptec aacraid driver (1.1-5[2437]-mh4)
> > ACPI: PCI Interrupt :01:02.0[A] -> GSI 25 (level, low) -> IRQ 25
> > Unable to handle kernel NULL pointer dereference at 
> >  RIP:
> >  [<>]
> > PGD 0
> > Oops:  [1] SMP
> > last sysfs file:
> > CPU 4
> > Modules linked in:
> > Pid: 1, comm: swapper Not tainted 2.6.21-rc6-mm1 #2
> > RIP: 0010:[<>]  [<>]
> > RSP: 0018:810100c9fc78  EFLAGS: 00010246
> > RAX: 810100c9fcc4 RBX:  RCX: 
> > RDX:  RSI: 1001 RDI: 810100e02d30
> > RBP: 810100e02d30 R08:  R09: 
> > R10:  R11: 0002 R12: 810100e02800
> > R13:  R14: 80690ee1 R15: 002d
> > FS:  () GS:810100cf6440() 
> > knlGS:
> > CS:  0010 DS: 0018 ES: 0018 CR0: 8005003b
> > CR2:  CR3: 00201000 CR4: 06e0
> > Process swapper (pid: 1, threadinfo 810100c9e000, task 
> > 810100c9d450)
> > Stack:  8045952f   
> > 810100c9fcc4
> >     
> >  80690ee1 002d 810100e02d30 0001
> > Call Trace:
> > Inexact backtrace:
> >  [] aac_rx_restart_adapter+0x7e/0x169
> >  [] _aac_rx_init+0x70/0x2f6
> >  [] cache_alloc_refill+0xdb/0x1db
> >  [] aac_probe_one+0x1a9/0x462
> >  [] pci_device_probe+0xd1/0x138
> >  [] driver_probe_device+0xf7/0x174
> >  [] __driver_attach+0x6f/0xae
> >  [] __driver_attach+0x0/0xae
> >  [] __driver_attach+0x0/0xae
> >  [] bus_for_each_dev+0x43/0x6e
> >  [] bus_add_driver+0x78/0x19a
> >  [] __pci_register_driver+0x58/0x8d
> >  [] aac_init+0x35/0x70
> >  [] kernel_init+0x167/0x2d1
> >  [] child_rip+0xa/0x12
> >  [] acpi_ds_init_one_object+0x0/0x7c
> >  [] kernel_init+0x0/0x2d1
> >  [] child_rip+0x0/0x12
> > 
> > 
> > Code:  Bad RIP value.
> > RIP  [<>]
> >  RSP 
> > CR2: 
> > Kernel panic - not syncing: Attempted to kill init!
> > 
> > Thanks
> > Vivek
> > 
> 


aacraid_kexec_fix.patch
Description: aacraid_kexec_fix.patch


Re: [PATCH] aacraid: fails to initialize after a kexec operation

2007-04-23 Thread Vivek Goyal
On Mon, Apr 23, 2007 at 09:38:43AM -0400, Salyzyn, Mark wrote:
> Missing portion of the kexec changes to the aacraid driver. The platform
> functions were not initialized when the restart function is activated
> resulting in a panic when these platform functions are called. Please
> note that it is NOT a mistake that the disable interrupt handler is used
> as the initial value of the enable interrupt platform function, it will
> be set up correctly once the adapter is discovered and initialized.
> 
> Please note that aacraid_kexec_5.patch contains this fix, since an
> earlier aacraid_kexec patch was applied to the tree and appears to have
> propagated, this is meant to supersede the earlier patch and bring it up
> to date with aacraid_kexec_5.patch, but expected to break when the
> aacraid_kexec_5.patch propagates... James, can you sort out this mess
> (either by stopping aacraid_kexec_5.patch, or by letting this enclosed
> patch move with some level of priority)?
> 
> ObligatoryDisclaimer: Please accept my condolences regarding Outlook's
> handling of patches.
> 
> This attached patch is against current scsi-misc-2.6. Also expect this
> patch can be applied to 2.6.21-rc6-mm1
> 
> Signed-off-by: Mark Salyzyn <[EMAIL PROTECTED]>
> 
> ---
> 

Thanks Mark,

I applied this patch but it still does not work. Now oops is gone but
I get following while aacraid is trying to initialize.

Adaptec aacraid driver (1.1-5[2437]-mh4)
ACPI: PCI Interrupt :01:02.0[A] -> GSI 25 (level, low) -> IRQ 25
aacraid: aac_fib_send: first asynchronous command timed out.
Usually a result of a PCI interrupt routing problem;
update mother board BIOS or consider utilizing one of
the SAFE mode kernel options (acpi, apic etc)
aac_fib_free, XferState != 0, fibptr = 0x81010414, XferState = 0x810ad
ACPI: PCI interrupt for device :01:02.0 disabled
aacraid: probe of :01:02.0 failed with error -110


Thanks
Vivek

-
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] aacraid: fails to initialize after a kexec operation

2007-04-23 Thread Salyzyn, Mark
That is a failure to route the interrupts and is possibly an issue with
the kernel and the hardware, and not the driver directly (since there is
an expectation that request_irq will connect the interrupt to the
interrupt service routine). Judith reported success in the past with
this patch on her hardware, perhaps the motherboard on your system has
some odd BIOS setup of the hardware that is giving acpi or the apic some
headaches? Can you check out success or failure on other motherboards?
Please try the suggestions from the driver (safe flags)?

Sincerely -- Mark Salyzyn

> -Original Message-
> From: Vivek Goyal [mailto:[EMAIL PROTECTED] 
> Sent: Monday, April 23, 2007 12:12 PM
> To: Salyzyn, Mark
> Cc: linux-scsi@vger.kernel.org; James Bottomley; Kexec 
> Mailing List; Judith Lebzelter
> Subject: Re: [PATCH] aacraid: fails to initialize after a 
> kexec operation
> 
> 
> On Mon, Apr 23, 2007 at 09:38:43AM -0400, Salyzyn, Mark wrote:
> > Missing portion of the kexec changes to the aacraid driver. 
> The platform
> > functions were not initialized when the restart function is 
> activated
> > resulting in a panic when these platform functions are 
> called. Please
> > note that it is NOT a mistake that the disable interrupt 
> handler is used
> > as the initial value of the enable interrupt platform 
> function, it will
> > be set up correctly once the adapter is discovered and initialized.
> > 
> > Please note that aacraid_kexec_5.patch contains this fix, since an
> > earlier aacraid_kexec patch was applied to the tree and 
> appears to have
> > propagated, this is meant to supersede the earlier patch 
> and bring it up
> > to date with aacraid_kexec_5.patch, but expected to break when the
> > aacraid_kexec_5.patch propagates... James, can you sort out 
> this mess
> > (either by stopping aacraid_kexec_5.patch, or by letting 
> this enclosed
> > patch move with some level of priority)?
> > 
> > ObligatoryDisclaimer: Please accept my condolences 
> regarding Outlook's
> > handling of patches.
> > 
> > This attached patch is against current scsi-misc-2.6. Also 
> expect this
> > patch can be applied to 2.6.21-rc6-mm1
> > 
> > Signed-off-by: Mark Salyzyn <[EMAIL PROTECTED]>
> > 
> > ---
> > 
> 
> Thanks Mark,
> 
> I applied this patch but it still does not work. Now oops is gone but
> I get following while aacraid is trying to initialize.
> 
> Adaptec aacraid driver (1.1-5[2437]-mh4)
> ACPI: PCI Interrupt :01:02.0[A] -> GSI 25 (level, low) -> IRQ 25
> aacraid: aac_fib_send: first asynchronous command timed out.
> Usually a result of a PCI interrupt routing problem;
> update mother board BIOS or consider utilizing one of
> the SAFE mode kernel options (acpi, apic etc)
> aac_fib_free, XferState != 0, fibptr = 0x81010414, 
> XferState = 0x810ad
> ACPI: PCI interrupt for device :01:02.0 disabled
> aacraid: probe of :01:02.0 failed with error -110
> 
> 
> Thanks
> Vivek
> 
> 
-
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: [RFC][PATCH] fix for async scsi scan sysfs problem (resend)

2007-04-23 Thread Josef Bacik
On Sat, Apr 21, 2007 at 09:59:56AM -0400, Josef Bacik wrote:
> On Sat, Apr 21, 2007 at 12:23:45AM -0700, Andrew Morton wrote:
> > On Thu, 19 Apr 2007 11:06:56 -0400 Josef Bacik <[EMAIL PROTECTED]> wrote:
> > 
> > > On Thu, Apr 19, 2007 at 10:02:36AM -0400, James Bottomley wrote:
> > > > On Thu, 2007-04-19 at 09:25 -0400, Josef Bacik wrote:
> > > > > Looking through everything I came to the conclusion that we don't 
> > > > > really need
> > > > > the scsi_sysfs_add_devices in scsi_finish_async_scan, which gets run 
> > > > > everytime
> > > > > we do a do_scan_async.  In doing the scanning, if we come upon 
> > > > > anything we will
> > > > > already be registering the device with sysfs so the 
> > > > > scsi_sysfs_add_devices step
> > > > > is kind of useless.
> > > > 
> > > > Unfortunately, it isn't.  The registration step while scanning is at the
> > > > end of scsi_add_lun():
> > > > 
> > > > 
> > > > if (!async && scsi_sysfs_add_sdev(sdev) != 0)
> > > > return SCSI_SCAN_NO_RESPONSE;
> > > > 
> > > > return SCSI_SCAN_LUN_PRESENT;
> > > > 
> > > > The !async should mean that the addition *only* occurs for the non async
> > > > scan case ... if you remove the post async scan add, we'll lose devices.
> > > > 

Ok I have a new patch that I've built and tested on both my UP and SMP machine
and it appears to work fine.  I took the async check out of scsi_add_lun, I
don't really see the point in waiting to do the sysfs registration stuff (if
theres a reason I haven't been able to find it in the original submission of
this functionality).  Please let me know if this is incorrect.  Thank you,

Josef

diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 0949145..8af1e16 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -712,7 +712,7 @@ static int scsi_probe_lun(struct scsi_device *sdev, 
unsigned char *inq_result,
  * SCSI_SCAN_LUN_PRESENT: a new scsi_device was allocated and initialized
  **/
 static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
-   int *bflags, int async)
+   int *bflags)
 {
/*
 * XXX do not save the inquiry, since it can change underneath us,
@@ -912,7 +912,7 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned 
char *inq_result,
 * register it and tell the rest of the kernel
 * about it.
 */
-   if (!async && scsi_sysfs_add_sdev(sdev) != 0)
+   if (scsi_sysfs_add_sdev(sdev) != 0)
return SCSI_SCAN_NO_RESPONSE;
 
return SCSI_SCAN_LUN_PRESENT;
@@ -1081,7 +1081,7 @@ static int scsi_probe_and_add_lun(struct scsi_target 
*starget,
goto out_free_result;
}
 
-   res = scsi_add_lun(sdev, result, &bflags, shost->async_scan);
+   res = scsi_add_lun(sdev, result, &bflags);
if (res == SCSI_SCAN_LUN_PRESENT) {
if (bflags & BLIST_KEY) {
sdev->lockable = 0;
@@ -1661,15 +1661,6 @@ int scsi_scan_host_selected(struct Scsi_Host *shost, 
unsigned int channel,
return 0;
 }
 
-static void scsi_sysfs_add_devices(struct Scsi_Host *shost)
-{
-   struct scsi_device *sdev;
-   shost_for_each_device(sdev, shost) {
-   if (scsi_sysfs_add_sdev(sdev) != 0)
-   scsi_destroy_sdev(sdev);
-   }
-}
-
 /**
  * scsi_prep_async_scan - prepare for an async scan
  * @shost: the host which will be scanned
@@ -1741,8 +1732,6 @@ static void scsi_finish_async_scan(struct async_scan_data 
*data)
 
wait_for_completion(&data->prev_finished);
 
-   scsi_sysfs_add_devices(shost);
-
spin_lock(&async_scan_lock);
shost->async_scan = 0;
list_del(&data->list);
-
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: [RFC][PATCH] fix for async scsi scan sysfs problem (resend)

2007-04-23 Thread James Bottomley
On Mon, 2007-04-23 at 14:13 -0400, Josef Bacik wrote:
> Ok I have a new patch that I've built and tested on both my UP and SMP machine
> and it appears to work fine.  I took the async check out of scsi_add_lun, I
> don't really see the point in waiting to do the sysfs registration stuff (if
> theres a reason I haven't been able to find it in the original submission of
> this functionality).  Please let me know if this is incorrect.  Thank you,

Yes, it's incorrect ... if you do this, the devices will come up in a
random order for multiple SCSI cards.  One of the original design goals
was not to require udev, so the final ordering should be the same as for
the sync case.

I think the root cause of the problem is somewhere in the fc transport
rport addition code.

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


[2/3] 2.6.21-rc7: known regressions (v2)

2007-04-23 Thread Adrian Bunk
This email lists some known regressions in Linus' tree compared to 2.6.20.

If you find your name in the Cc header, you are either submitter of one
of the bugs, maintainer of an affectected subsystem or driver, a patch
of you caused a breakage or I'm considering you in any other way
possibly involved with one or more of these issues.

Due to the huge amount of recipients, please trim the Cc when answering.


Subject: ACPI: Crashes + hangs during modprobe processor
   unless "processor.nocst"
References : http://bugzilla.kernel.org/show_bug.cgi?id=8346
Submitter  : Olaf Kirch <[EMAIL PROTECTED]>
Status : unknown


Subject: kernels fail to boot with drives on ATIIXP controller
 (ACPI/IRQ related)
References : https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=229621
 http://lkml.org/lkml/2007/3/4/257
Submitter  : Michal Jaegermann <[EMAIL PROTECTED]>
Status : unknown


Subject: ali_pata: boot from CD fails
References : http://lkml.org/lkml/2007/3/31/160
Submitter  : Stephen Clark <[EMAIL PROTECTED]>
Status : unknown


Subject: boot failure: rtl8139: exception in interrupt routine
References : http://lkml.org/lkml/2007/3/31/160
Submitter  : Stephen Clark <[EMAIL PROTECTED]>
Status : unknown


Subject: qla2xxx driver no longer works
References : http://lkml.org/lkml/2007/4/16/49
 http://lkml.org/lkml/2007/4/20/224
Submitter  : David Miller <[EMAIL PROTECTED]>
 Robert Peterson <[EMAIL PROTECTED]>
Handled-By : David Miller <[EMAIL PROTECTED]>
Patch  : http://lkml.org/lkml/2007/4/16/234
Status : patch was suggested


-
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 1/7] libata: check for AN support

2007-04-23 Thread Kristen Carlson Accardi
Check to see if an ATAPI device supports Asynchronous Notification.
If so, enable it.

Signed-off-by: Kristen Carlson Accardi <[EMAIL PROTECTED]>

Index: 2.6-git/drivers/ata/libata-core.c
===
--- 2.6-git.orig/drivers/ata/libata-core.c
+++ 2.6-git/drivers/ata/libata-core.c
@@ -70,6 +70,7 @@ const unsigned long sata_deb_timing_long
 static unsigned int ata_dev_init_params(struct ata_device *dev,
u16 heads, u16 sectors);
 static unsigned int ata_dev_set_xfermode(struct ata_device *dev);
+static unsigned int ata_dev_set_AN(struct ata_device *dev);
 static void ata_dev_xfermask(struct ata_device *dev);
 
 static unsigned int ata_print_id = 1;
@@ -1744,6 +1745,23 @@ int ata_dev_configure(struct ata_device 
}
dev->cdb_len = (unsigned int) rc;
 
+   /*
+* check to see if this ATAPI device supports
+* Asynchronous Notification
+*/
+   if ((ap->flags & ATA_FLAG_AN) && ata_id_has_AN(id))
+   {
+   /* issue SET feature command to turn this on */
+   rc = ata_dev_set_AN(dev);
+   if (rc) {
+   ata_dev_printk(dev, KERN_ERR,
+   "unable to set AN\n");
+   rc = -EINVAL;
+   goto err_out_nosup;
+   }
+   dev->flags |= ATA_DFLAG_AN;
+   }
+
if (ata_id_cdb_intr(dev->id)) {
dev->flags |= ATA_DFLAG_CDB_INTR;
cdb_intr_string = ", CDB intr";
@@ -3525,6 +3543,42 @@ static unsigned int ata_dev_set_xfermode
 }
 
 /**
+ * ata_dev_set_AN - Issue SET FEATURES - SATA FEATURES
+ *   with sector count set to indicate
+ *   Asynchronous Notification feature
+ * @dev: Device to which command will be sent
+ *
+ * Issue SET FEATURES - SATA FEATURES command to device @dev
+ * on port @ap.
+ *
+ * LOCKING:
+ * PCI/etc. bus probe sem.
+ *
+ * RETURNS:
+ * 0 on success, AC_ERR_* mask otherwise.
+ */
+static unsigned int ata_dev_set_AN(struct ata_device *dev)
+{
+   struct ata_taskfile tf;
+   unsigned int err_mask;
+
+   /* set up set-features taskfile */
+   DPRINTK("set features - SATA features\n");
+
+   ata_tf_init(dev, &tf);
+   tf.command = ATA_CMD_SET_FEATURES;
+   tf.feature = SETFEATURES_SATA_ENABLE;
+   tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
+   tf.protocol = ATA_PROT_NODATA;
+   tf.nsect = SATA_AN;
+
+   err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0);
+
+   DPRINTK("EXIT, err_mask=%x\n", err_mask);
+   return err_mask;
+}
+
+/**
  * ata_dev_init_params - Issue INIT DEV PARAMS command
  * @dev: Device to which command will be sent
  * @heads: Number of heads (taskfile parameter)
Index: 2.6-git/include/linux/ata.h
===
--- 2.6-git.orig/include/linux/ata.h
+++ 2.6-git/include/linux/ata.h
@@ -194,6 +194,12 @@ enum {
SETFEATURES_WC_ON   = 0x02, /* Enable write cache */
SETFEATURES_WC_OFF  = 0x82, /* Disable write cache */
 
+   SETFEATURES_SATA_ENABLE = 0x10, /* Enable use of SATA feature */
+   SETFEATURES_SATA_DISABLE = 0x90, /* Disable use of SATA feature */
+
+   /* SETFEATURE Sector counts for SATA features */
+   SATA_AN = 0x05,  /* Asynchronous Notification */
+
/* ATAPI stuff */
ATAPI_PKT_DMA   = (1 << 0),
ATAPI_DMADIR= (1 << 2), /* ATAPI data dir:
@@ -299,6 +305,8 @@ struct ata_taskfile {
 #define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1)
 #define ata_id_removeable(id)  ((id)[0] & (1 << 7))
 #define ata_id_has_dword_io(id)((id)[50] & (1 << 0))
+#define ata_id_has_AN(id)  \
+   ((id[76] && (~id[76])) & ((id)[78] & (1 << 5)))
 #define ata_id_iordy_disable(id) ((id)[49] & (1 << 10))
 #define ata_id_has_iordy(id) ((id)[49] & (1 << 9))
 #define ata_id_u32(id,n)   \
Index: 2.6-git/include/linux/libata.h
===
--- 2.6-git.orig/include/linux/libata.h
+++ 2.6-git/include/linux/libata.h
@@ -136,6 +136,7 @@ enum {
ATA_DFLAG_CDB_INTR  = (1 << 2), /* device asserts INTRQ when ready 
for CDB */
ATA_DFLAG_NCQ   = (1 << 3), /* device supports NCQ */
ATA_DFLAG_FLUSH_EXT = (1 << 4), /* do FLUSH_EXT instead of FLUSH */
+   ATA_DFLAG_AN= (1 << 5), /* device supports Async 
notification */
ATA_DFLAG_CFG_MASK  = (1 << 8) - 1,
 
ATA_DFLAG_PIO   = (1 << 8), /* device limited to PIO mode */
@@ -174,6 +175,7 @@ enum {
ATA_FLAG_SETXFER_POLLING=

[patch 0/7] Asynchronous Notification for ATAPI devices (v2)

2007-04-23 Thread Kristen Carlson Accardi
This patch series implements Asynchronous Notification (AN) for SATA
ATAPI devices as defined in SATA 2.5 and AHCI 1.1 and higher.  Drives
which support this feature will send a notification when new media is
inserted and removed, preventing the need for user space to poll for
new media.  This support is exposed to user space via a flag that will
be set in /sys/block/sr*/capability_flags.  If the flag is set, user
space can disable polling for the new media, and the genhd driver will
send a KOBJ_CHANGE event with the envp set to MEDIA_CHANGE_EVENT=1.

Note that this patch only implements support for directly attached
drives - AN with drives attached to a port multiplier requires 
additional changes.

Thanks!
Kristen

-- 
-- 
-
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 3/7] scsi: expose AN to user space

2007-04-23 Thread Kristen Carlson Accardi
Get media change notification capability from disk and pass this information
to genhd by setting appropriate flag.

Signed-off-by: Kristen Carlson Accardi <[EMAIL PROTECTED]>

Index: 2.6-git/drivers/scsi/sr.c
===
--- 2.6-git.orig/drivers/scsi/sr.c
+++ 2.6-git/drivers/scsi/sr.c
@@ -601,6 +601,8 @@ static int sr_probe(struct device *dev)
 
dev_set_drvdata(dev, cd);
disk->flags |= GENHD_FL_REMOVABLE;
+   if (sdev->media_change_notify)
+   disk->flags |= GENHD_FL_MEDIA_CHANGE_NOTIFY;
add_disk(disk);
 
sdev_printk(KERN_DEBUG, sdev,
Index: 2.6-git/include/scsi/scsi_device.h
===
--- 2.6-git.orig/include/scsi/scsi_device.h
+++ 2.6-git/include/scsi/scsi_device.h
@@ -124,7 +124,7 @@ struct scsi_device {
unsigned fix_capacity:1;/* READ_CAPACITY is too high by 1 */
unsigned guess_capacity:1;  /* READ_CAPACITY might be too high by 1 
*/
unsigned retry_hwerror:1;   /* Retry HARDWARE_ERROR */
-
+   unsigned media_change_notify:1; /* dev supports async media notify */
unsigned int device_blocked;/* Device returned QUEUE_FULL. */
 
unsigned int max_device_blocked; /* what device_blocked counts down 
from  */
Index: 2.6-git/drivers/scsi/sd.c
===
--- 2.6-git.orig/drivers/scsi/sd.c
+++ 2.6-git/drivers/scsi/sd.c
@@ -1706,6 +1706,9 @@ static int sd_probe(struct device *dev)
if (sdp->removable)
gd->flags |= GENHD_FL_REMOVABLE;
 
+   if (sdp->media_change_notify)
+   gd->flags |= GENHD_FL_MEDIA_CHANGE_NOTIFY;
+
dev_set_drvdata(dev, sdkp);
add_disk(gd);
 

-- 
-
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 4/7] libata: expose AN to user space

2007-04-23 Thread Kristen Carlson Accardi
If Asynchronous Notification of media change events is supported,
pass that information up to the SCSI layer.

Signed-off-by: Kristen Carlson Accardi <[EMAIL PROTECTED]>

Index: 2.6-git/drivers/ata/libata-scsi.c
===
--- 2.6-git.orig/drivers/ata/libata-scsi.c
+++ 2.6-git/drivers/ata/libata-scsi.c
@@ -899,6 +899,9 @@ static void ata_scsi_dev_config(struct s
blk_queue_max_hw_segments(q, q->max_hw_segments - 1);
}
 
+   if (dev->flags & ATA_DFLAG_AN)
+   sdev->media_change_notify = 1;
+
if (dev->flags & ATA_DFLAG_NCQ) {
int depth;
 

-- 
-
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] genhd: send async notification on media change

2007-04-23 Thread Kristen Carlson Accardi
Send an uevent to user space to indicate that a media change event has occurred.

Signed-off-by: Kristen Carlson Accardi <[EMAIL PROTECTED]>

Index: 2.6-git/block/genhd.c
===
--- 2.6-git.orig/block/genhd.c
+++ 2.6-git/block/genhd.c
@@ -643,6 +643,25 @@ struct seq_operations diskstats_op = {
.show   = diskstats_show
 };
 
+static void media_change_notify_thread(struct work_struct *work)
+{
+   struct gendisk *gd = container_of(work, struct gendisk, async_notify);
+   char event[] = "MEDIA_CHANGE=1";
+   char *envp[] = { event, NULL };
+
+   /*
+* set enviroment vars to indicate which event this is for
+* so that user space will know to go check the media status.
+*/
+   kobject_uevent_env(&gd->kobj, KOBJ_CHANGE, envp);
+}
+
+void genhd_media_change_notify(struct gendisk *disk)
+{
+   schedule_work(&disk->async_notify);
+}
+EXPORT_SYMBOL_GPL(genhd_media_change_notify);
+
 struct gendisk *alloc_disk(int minors)
 {
return alloc_disk_node(minors, -1);
@@ -672,6 +691,8 @@ struct gendisk *alloc_disk_node(int mino
kobj_set_kset_s(disk,block_subsys);
kobject_init(&disk->kobj);
rand_initialize_disk(disk);
+   INIT_WORK(&disk->async_notify,
+   media_change_notify_thread);
}
return disk;
 }
Index: 2.6-git/include/linux/genhd.h
===
--- 2.6-git.orig/include/linux/genhd.h
+++ 2.6-git/include/linux/genhd.h
@@ -66,6 +66,7 @@ struct partition {
 #include 
 #include 
 #include 
+#include 
 
 struct partition {
unsigned char boot_ind; /* 0x80 - active */
@@ -139,6 +140,7 @@ struct gendisk {
 #else
struct disk_stats dkstats;
 #endif
+   struct work_struct async_notify;
 };
 
 /* Structure for sysfs attributes on block devices */
@@ -419,7 +421,7 @@ extern struct gendisk *alloc_disk_node(i
 extern struct gendisk *alloc_disk(int minors);
 extern struct kobject *get_disk(struct gendisk *disk);
 extern void put_disk(struct gendisk *disk);
-
+extern void genhd_media_change_notify(struct gendisk *disk);
 extern void blk_register_region(dev_t dev, unsigned long range,
struct module *module,
struct kobject *(*probe)(dev_t, int *, void *),

-- 
-
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 6/7] SCSI: save disk in scsi_device

2007-04-23 Thread Kristen Carlson Accardi
Give anyone who has access to scsi_device access to the genhd struct as well.

Signed-off-by: Kristen Carlson Accardi <[EMAIL PROTECTED]>
Index: 2.6-git/drivers/scsi/sd.c
===
--- 2.6-git.orig/drivers/scsi/sd.c
+++ 2.6-git/drivers/scsi/sd.c
@@ -1711,6 +1711,7 @@ static int sd_probe(struct device *dev)
 
dev_set_drvdata(dev, sdkp);
add_disk(gd);
+   sdp->disk = gd;
 
sdev_printk(KERN_NOTICE, sdp, "Attached scsi %sdisk %s\n",
sdp->removable ? "removable " : "", gd->disk_name);
Index: 2.6-git/drivers/scsi/sr.c
===
--- 2.6-git.orig/drivers/scsi/sr.c
+++ 2.6-git/drivers/scsi/sr.c
@@ -604,6 +604,7 @@ static int sr_probe(struct device *dev)
if (sdev->media_change_notify)
disk->flags |= GENHD_FL_MEDIA_CHANGE_NOTIFY;
add_disk(disk);
+   sdev->disk = disk;
 
sdev_printk(KERN_DEBUG, sdev,
"Attached scsi CD-ROM %s\n", cd->cdi.name);
Index: 2.6-git/include/scsi/scsi_device.h
===
--- 2.6-git.orig/include/scsi/scsi_device.h
+++ 2.6-git/include/scsi/scsi_device.h
@@ -138,7 +138,7 @@ struct scsi_device {
 
struct device   sdev_gendev;
struct class_device sdev_classdev;
-
+   struct gendisk  *disk;
struct execute_work ew; /* used to get process context on put */
 
enum scsi_device_state sdev_state;

-- 
-
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 7/7] libata: send event when AN received

2007-04-23 Thread Kristen Carlson Accardi
When we get an SDB FIS with the 'N' bit set, we should send
an event to user space to indicate that there has been a
media change.  This will be done via the block device. 

Signed-off-by: Kristen Carlson Accardi <[EMAIL PROTECTED]>
Index: 2.6-git/drivers/ata/ahci.c
===
--- 2.6-git.orig/drivers/ata/ahci.c
+++ 2.6-git/drivers/ata/ahci.c
@@ -1147,6 +1147,25 @@ static void ahci_host_intr(struct ata_po
return;
}
 
+   if (status & PORT_IRQ_SDB_FIS) {
+   /*
+* if this is an ATAPI device with AN turned on,
+* then we should interrogate the device to
+* determine the cause of the interrupt
+*
+* for AN - this we should check the SDB FIS
+* and find the I and N bits set
+*/
+   const u32 *f = pp->rx_fis + RX_FIS_SDB;
+
+   /* check the 'N' bit in word 0 of the FIS */
+   if (f[0] & (1 << 15)) {
+   int port_addr =  ((f[0] & 0x0f00) >> 8);
+   struct ata_device *adev = &ap->device[port_addr];
+   if (adev->flags & ATA_DFLAG_AN)
+   ata_scsi_media_change_notify(adev);
+   }
+   }
if (ap->sactive)
qc_active = readl(port_mmio + PORT_SCR_ACT);
else
Index: 2.6-git/include/linux/libata.h
===
--- 2.6-git.orig/include/linux/libata.h
+++ 2.6-git/include/linux/libata.h
@@ -737,6 +737,7 @@ extern void ata_host_init(struct ata_hos
 extern int ata_scsi_detect(struct scsi_host_template *sht);
 extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
 extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct 
scsi_cmnd *));
+extern void ata_scsi_media_change_notify(struct ata_device *atadev);
 extern void ata_sas_port_destroy(struct ata_port *);
 extern struct ata_port *ata_sas_port_alloc(struct ata_host *,
   struct ata_port_info *, struct 
Scsi_Host *);
Index: 2.6-git/drivers/ata/libata-scsi.c
===
--- 2.6-git.orig/drivers/ata/libata-scsi.c
+++ 2.6-git/drivers/ata/libata-scsi.c
@@ -3057,6 +3057,22 @@ static void ata_scsi_remove_dev(struct a
 }
 
 /**
+ * ata_scsi_media_change_notify - send media change event
+ * @atadev: Pointer to the disk device with media change event
+ *
+ * Tell the block layer to send a media change notification
+ * event.
+ *
+ * LOCKING:
+ * interrupt context, may not sleep.
+ */
+void ata_scsi_media_change_notify(struct ata_device *atadev)
+{
+   genhd_media_change_notify(atadev->sdev->disk);
+}
+EXPORT_SYMBOL_GPL(ata_scsi_media_change_notify);
+
+/**
  * ata_scsi_hotplug - SCSI part of hotplug
  * @work: Pointer to ATA port to perform SCSI hotplug on
  *

-- 
-
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 2/7] genhd: expose AN to user space

2007-04-23 Thread Kristen Carlson Accardi
Allow user space to determine if a disk supports Asynchronous Notification
of media changes.  This is done by adding a new sysfs file "capability_flags",
which is documented in (insert file name).  This sysfs file will export all
disk capabilities flags to user space.  We also define a new flag to define
the media change notification capability.

Signed-off-by: Kristen Carlson Accardi <[EMAIL PROTECTED]>

Index: 2.6-git/block/genhd.c
===
--- 2.6-git.orig/block/genhd.c
+++ 2.6-git/block/genhd.c
@@ -370,7 +370,10 @@ static ssize_t disk_size_read(struct gen
 {
return sprintf(page, "%llu\n", (unsigned long long)get_capacity(disk));
 }
-
+static ssize_t disk_capability_read(struct gendisk *disk, char *page)
+{
+   return sprintf(page, "%x\n", disk->flags);
+}
 static ssize_t disk_stats_read(struct gendisk * disk, char *page)
 {
preempt_disable();
@@ -413,6 +416,10 @@ static struct disk_attribute disk_attr_s
.attr = {.name = "size", .mode = S_IRUGO },
.show   = disk_size_read
 };
+static struct disk_attribute disk_attr_capability = {
+   .attr = {.name = "capability_flags", .mode = S_IRUGO },
+   .show   = disk_capability_read
+};
 static struct disk_attribute disk_attr_stat = {
.attr = {.name = "stat", .mode = S_IRUGO },
.show   = disk_stats_read
@@ -453,6 +460,7 @@ static struct attribute * default_attrs[
&disk_attr_removable.attr,
&disk_attr_size.attr,
&disk_attr_stat.attr,
+   &disk_attr_capability.attr,
 #ifdef CONFIG_FAIL_MAKE_REQUEST
&disk_attr_fail.attr,
 #endif
Index: 2.6-git/include/linux/genhd.h
===
--- 2.6-git.orig/include/linux/genhd.h
+++ 2.6-git/include/linux/genhd.h
@@ -94,6 +94,7 @@ struct hd_struct {
 
 #define GENHD_FL_REMOVABLE 1
 #define GENHD_FL_DRIVERFS  2
+#define GENHD_FL_MEDIA_CHANGE_NOTIFY   4
 #define GENHD_FL_CD8
 #define GENHD_FL_UP16
 #define GENHD_FL_SUPPRESS_PARTITION_INFO   32
Index: 2.6-git/Documentation/block/capability_flags.txt
===
--- /dev/null
+++ 2.6-git/Documentation/block/capability_flags.txt
@@ -0,0 +1,15 @@
+Generic Block Device Capability Flags
+===
+This file documents the sysfs file block//capability_flags
+
+capability_flags is a hex word indicating which capabilities a specific
+disk supports.  For more information on bits not listed here, see
+include/linux/genhd.h
+
+Capability Value
+---
+GENHD_FL_MEDIA_CHANGE_NOTIFY   4
+   When this bit is set, the disk supports Asynchronous Notification
+   of media change events.  These events will be broadcast to user
+   space via kernel uevent.
+

-- 
-
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