# [SOLVED] SATA_NV Hot Swapping: Reattaching Fails

## hoka

Ok so I'm playing with my shiny new file server, and everything is peachy. I decide to try the hot swapping functionality since I purchased a hot swap enclosure from frys (I use the same enclosures on my Areca 1220 workstation and they are alright). So I ext3 the disk (directly), mount it, write some stuff, ~80mb/s writes. Unmount, hit power button to drive.

This is where I get:

```

ata5: exception Emask 0x10 SAct 0x0 SErr 0x1910000 action 0x2 frozen

ata5: soft resetting port

ata5: SATA link down (SStatus 0 SControl 300)

ata5: failed to recover some devices, retrying in 5 secs

ata5: hard resetting port

ata5: SATA link down (SStatus 0 SControl 300)

ata5: failed to recover some devices, retrying in 5 secs

ata5: hard resetting port

ata5: SATA link down (SStatus 0 SControl 300)

ata5.00: disabled

```

All seems peachy at this point. Somewhere in there I guess what happens is it removes the /dev/sda link completely. I now hit the power button back on, the drive springs to life, and I slowly get this in dmesg:

```

ata5: exception Emask 0x10 SAct 0x0 SErr 0x150000 action 0x2 frozen

ata5: port is slow to respond, please be patient

ata5: port failed to respond (30 secs)

ata5: soft resetting port

ata5: port is slow to respond, please be patient

ata5: port failed to respond (30 secs)

ata5: SATA link up 1.5 Gbps (SStatus 113 SControl 300)

ata5: EH complete

ls /dev/sd*

/dev/sda1   /dev/sda6   /dev/sdb15  /dev/sdc10  /dev/sdc7   /dev/sdd2

/dev/sda10  /dev/sda7   /dev/sdb2   /dev/sdc11  /dev/sdc8   /dev/sdd3

/dev/sda11  /dev/sda8   /dev/sdb3   /dev/sdc12  /dev/sdc9   /dev/sdd4

/dev/sda12  /dev/sda9   /dev/sdb4   /dev/sdc13  /dev/sdd    /dev/sdd5

/dev/sda13  /dev/sdb    /dev/sdb5   /dev/sdc14  /dev/sdd1   /dev/sdd6

/dev/sda14  /dev/sdb1   /dev/sdb6   /dev/sdc15  /dev/sdd10  /dev/sdd7

/dev/sda15  /dev/sdb10  /dev/sdb7   /dev/sdc2   /dev/sdd11  /dev/sdd8

/dev/sda2   /dev/sdb11  /dev/sdb8   /dev/sdc3   /dev/sdd12  /dev/sdd9

/dev/sda3   /dev/sdb12  /dev/sdb9   /dev/sdc4   /dev/sdd13

/dev/sda4   /dev/sdb13  /dev/sdc    /dev/sdc5   /dev/sdd14

/dev/sda5   /dev/sdb14  /dev/sdc1   /dev/sdc6   /dev/sdd15

```

None of the sdb/sdc/sdd block devices work. It's as if the whole thing is just attached, but not recognized. Reboot the machine, and everything is there.

System specifications:

Asus A8N-SLI Premium (using sata_nv)

Linux llama 2.6.18-hardened #4 Sat Dec 9 08:44:38 PST 2006 i686 AMD Athlon(tm) 64 Processor 3200+ AuthenticAMD GNU/Linux

Athena Power/iStar USA/otherwise generic SATA Hotswap enclosure

SOLUTION - Apply a patch forcing HARD RESET - see 2.6.19 GIT changelog - NOTE! Although this patch is applied in these kernels, support is cruddy and you should back port the 3 line changes to whatever kernel you are using.Last edited by hoka on Sun Dec 10, 2006 11:01 pm; edited 2 times in total

----------

## NeddySeagoon

hoka,

Hot swap is in the SATA hardware but not all kernel chipset drivers provide software support for hot swapping yet.

----------

## hoka

 *NeddySeagoon wrote:*   

> hoka,
> 
> Hot swap is in the SATA hardware but not all kernel chipset drivers provide software support for hot swapping yet.

 

I'm aware of that, but the sata_nv (the AHCI is *supposed* to work too but doesn't) driver is supposed to be hot swap capable. http://linux-ata.org/driver-status.html#matrix

Here is some more information, udevmonitor --env will pick up the system turning off the hard drive and remove it, but will not recognize that it is brought up:

```

UEVENT[1165713092.185178] remove@/class/scsi_device/4:0:0:0

ACTION=remove

DEVPATH=/class/scsi_device/4:0:0:0

SUBSYSTEM=scsi_device

SEQNUM=1659

PHYSDEVPATH=/devices/pci0000:00/0000:00:07.0/host4/target4:0:0/4:0:0:0

PHYSDEVBUS=scsi

PHYSDEVDRIVER=sd

UEVENT[1165713092.185230] remove@/class/scsi_disk/4:0:0:0

ACTION=remove

DEVPATH=/class/scsi_disk/4:0:0:0

SUBSYSTEM=scsi_disk

SEQNUM=1660

PHYSDEVPATH=/devices/pci0000:00/0000:00:07.0/host4/target4:0:0/4:0:0:0

PHYSDEVBUS=scsi

PHYSDEVDRIVER=sd

UEVENT[1165713092.185250] remove@/block/sda/sda1

ACTION=remove

DEVPATH=/block/sda/sda1

SUBSYSTEM=block

SEQNUM=1661

MINOR=1

MAJOR=8

PHYSDEVPATH=/devices/pci0000:00/0000:00:07.0/host4/target4:0:0/4:0:0:0

PHYSDEVBUS=scsi

PHYSDEVDRIVER=sd

UEVENT[1165713092.185272] remove@/block/sda

ACTION=remove

DEVPATH=/block/sda

SUBSYSTEM=block

SEQNUM=1662

MINOR=0

MAJOR=8

PHYSDEVPATH=/devices/pci0000:00/0000:00:07.0/host4/target4:0:0/4:0:0:0

PHYSDEVBUS=scsi

PHYSDEVDRIVER=sd

UEVENT[1165713092.185293] remove@/devices/pci0000:00/0000:00:07.0/host4/target4:0:0/4:0:0:0

ACTION=remove

DEVPATH=/devices/pci0000:00/0000:00:07.0/host4/target4:0:0/4:0:0:0

SUBSYSTEM=scsi

SEQNUM=1663

PHYSDEVBUS=scsi

UDEV  [1165713092.187167] remove@/class/scsi_device/4:0:0:0

UDEV_LOG=3

ACTION=remove

DEVPATH=/class/scsi_device/4:0:0:0

SUBSYSTEM=scsi_device

SEQNUM=1659

PHYSDEVPATH=/devices/pci0000:00/0000:00:07.0/host4/target4:0:0/4:0:0:0

PHYSDEVBUS=scsi

PHYSDEVDRIVER=sd

UDEVD_EVENT=1

UDEV  [1165713092.188424] remove@/class/scsi_disk/4:0:0:0

UDEV_LOG=3

ACTION=remove

DEVPATH=/class/scsi_disk/4:0:0:0

SUBSYSTEM=scsi_disk

SEQNUM=1660

PHYSDEVPATH=/devices/pci0000:00/0000:00:07.0/host4/target4:0:0/4:0:0:0

PHYSDEVBUS=scsi

PHYSDEVDRIVER=sd

UDEVD_EVENT=1

UDEV  [1165713092.189860] remove@/block/sda/sda1

UDEV_LOG=3

ACTION=remove

DEVPATH=/block/sda/sda1

SUBSYSTEM=block

SEQNUM=1661

MINOR=1

MAJOR=8

PHYSDEVPATH=/devices/pci0000:00/0000:00:07.0/host4/target4:0:0/4:0:0:0

PHYSDEVBUS=scsi

PHYSDEVDRIVER=sd

UDEVD_EVENT=1

ID_VENDOR=ATA

ID_MODEL=ST3320620AS

ID_REVISION=3.AA

ID_SERIAL=SATA_ST3320620AS_5QF2LBMF

ID_SERIAL_SHORT=5QF2LBMF

ID_TYPE=disk

ID_BUS=scsi

ID_PATH=pci-0000:00:07.0-scsi-0:0:0:0

ID_FS_USAGE=filesystem

ID_FS_TYPE=ext3

ID_FS_VERSION=1.0

ID_FS_UUID=c5fa73a3-c22d-4f1d-875f-22fddfa2d6d9

ID_FS_LABEL=

ID_FS_LABEL_SAFE=

DEVLINKS=/dev/disk/by-id/scsi-SATA_ST3320620AS_5QF2LBMF-part1 /dev/disk/by-path/pci-0000:00:07.0-scsi-0:0:0:0-part1 /dev/disk/by-uuid/c5fa73a3-c22d-4f1d-875f-22fddfa2d6d9

DEVNAME=/dev/sda1

UDEV  [1165713092.191210] remove@/devices/pci0000:00/0000:00:07.0/host4/target4:0:0/4:0:0:0

UDEV_LOG=3

ACTION=remove

DEVPATH=/devices/pci0000:00/0000:00:07.0/host4/target4:0:0/4:0:0:0

SUBSYSTEM=scsi

SEQNUM=1663

PHYSDEVBUS=scsi

UDEVD_EVENT=1

UDEV  [1165713092.192601] remove@/block/sda

UDEV_LOG=3

ACTION=remove

DEVPATH=/block/sda

SUBSYSTEM=block

SEQNUM=1662

MINOR=0

MAJOR=8

PHYSDEVPATH=/devices/pci0000:00/0000:00:07.0/host4/target4:0:0/4:0:0:0

PHYSDEVBUS=scsi

PHYSDEVDRIVER=sd

UDEVD_EVENT=1

ID_VENDOR=ATA

ID_MODEL=ST3320620AS

ID_REVISION=3.AA

ID_SERIAL=SATA_ST3320620AS_5QF2LBMF

ID_SERIAL_SHORT=5QF2LBMF

ID_TYPE=disk

ID_BUS=scsi

ID_PATH=pci-0000:00:07.0-scsi-0:0:0:0

ID_FS_USAGE=filesystem

ID_FS_TYPE=ext3

ID_FS_VERSION=1.0

ID_FS_UUID=0b22aecc-c617-44ef-9198-bd3a6af7631e

ID_FS_LABEL=

ID_FS_LABEL_SAFE=

DEVLINKS=/dev/disk/by-id/scsi-SATA_ST3320620AS_5QF2LBMF /dev/disk/by-path/pci-0000:00:07.0-scsi-0:0:0:0 /dev/disk/by-uuid/0b22aecc-c617-44ef-9198-bd3a6af7631e

DEVNAME=/dev/sda

```

----------

## hoka

Update: 

#1) I tried enabling a few more PCI hotplug options on my hardened kernel - no go.

#2) I tried 2.6.19r1, same options as before. This time it half detected the drive at boot. It'd probe for it, say it failed, then said it was up, but still didn't appear. Running udevstart didn't show it. It's like the drive is dead. Detaching and reattaching results in the same problem as before.

 *Quote:*   

> 
> 
> sata_sil 0000:05:0a.0: Applying R_ERR on DMA activate FIS errata fix
> 
> ata1: SATA max UDMA/100 cmd 0xE0806080 ctl 0xE080608A bmdma 0xE0806000 irq 18
> ...

 

----------

## hoka

Update: Adding more verbose logs - ACPI/PCI-E/PCI debug outputting enabled + lspci:

```

ata5: exception Emask 0x10 SAct 0x0 SErr 0x1810000 action 0x2 frozen

ata5: soft resetting port

ata5: SATA link down (SStatus 0 SControl 300)

ata5: failed to recover some devices, retrying in 5 secs

ata5: hard resetting port

ata5: SATA link down (SStatus 0 SControl 300)

ata5: failed to recover some devices, retrying in 5 secs

ata5: hard resetting port

ata5: SATA link down (SStatus 0 SControl 300)

ata5.00: disabled

ata5: EH complete

ata5.00: detaching (SCSI 4:0:0:0)

PM: Removing info for scsi:4:0:0:0

PM: Removing info for No Bus:target4:0:0

ata5: exception Emask 0x10 SAct 0x0 SErr 0x50000 action 0x2 frozen

ata5: port is slow to respond, please be patient

ata5: port failed to respond (30 secs)

ata5: soft resetting port

ata5: port is slow to respond, please be patient

ata5: port failed to respond (30 secs)

ata5: SATA link up 1.5 Gbps (SStatus 113 SControl 300)

ata5: EH complete

```

```

00:00.0 Memory controller: nVidia Corporation CK804 Memory Controller (rev a3)

00:01.0 ISA bridge: nVidia Corporation CK804 ISA Bridge (rev a3)

00:01.1 SMBus: nVidia Corporation CK804 SMBus (rev a2)

00:02.0 USB Controller: nVidia Corporation CK804 USB Controller (rev a2)

00:02.1 USB Controller: nVidia Corporation CK804 USB Controller (rev a3)

00:06.0 IDE interface: nVidia Corporation CK804 IDE (rev f2)

00:07.0 IDE interface: nVidia Corporation CK804 Serial ATA Controller (rev f3)

00:08.0 IDE interface: nVidia Corporation CK804 Serial ATA Controller (rev f3)

00:09.0 PCI bridge: nVidia Corporation CK804 PCI Bridge (rev a2)

00:0a.0 Bridge: nVidia Corporation CK804 Ethernet Controller (rev a3)

00:0b.0 PCI bridge: nVidia Corporation CK804 PCIE Bridge (rev a3)

00:0c.0 PCI bridge: nVidia Corporation CK804 PCIE Bridge (rev a3)

00:0d.0 PCI bridge: nVidia Corporation CK804 PCIE Bridge (rev a3)

00:0e.0 PCI bridge: nVidia Corporation CK804 PCIE Bridge (rev a3)

00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration

00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map

00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller

00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control

05:07.0 VGA compatible controller: nVidia Corporation NV34 [GeForce FX 5200] (rev a1)

05:0a.0 RAID bus controller: Silicon Image, Inc. SiI 3114 [SATALink/SATARaid] Serial ATA Controller (rev 02)

05:0c.0 Ethernet controller: Marvell Technology Group Ltd. 88E8001 Gigabit Ethernet Controller (rev 13)

```

Quasi solved: Switching SATA controllers to sil3114 works, here is the expected output:

```

ata1: exception Emask 0x10 SAct 0x0 SErr 0x10000 action 0x2 frozen

ata1: hard resetting port

ata1: SATA link down (SStatus 0 SControl 310)

ata1: failed to recover some devices, retrying in 5 secs

ata1: hard resetting port

ata1: SATA link down (SStatus 0 SControl 310)

ata1: failed to recover some devices, retrying in 5 secs

ata1: hard resetting port

ata1: SATA link down (SStatus 0 SControl 310)

ata1.00: disabled

ata1: EH complete

ata1.00: detaching (SCSI 0:0:0:0)

PM: Removing info for scsi:0:0:0:0

PM: Removing info for No Bus:target0:0:0

ata1: exception Emask 0x10 SAct 0x0 SErr 0x50000 action 0x2 frozen

ata1: hard resetting port

ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 310)

ata1.00: ATA-7, max UDMA/133, 625142448 sectors: LBA48 NCQ (depth 0/32)

ata1.00: configured for UDMA/100

ata1: EH complete

PM: Adding info for No Bus:target0:0:0

  Vendor: ATA       Model: ST3320620AS       Rev: 3.AA

  Type:   Direct-Access                      ANSI SCSI revision: 05

PM: Adding info for scsi:0:0:0:0

SCSI device sda: 625142448 512-byte hdwr sectors (320073 MB)

sda: Write Protect is off

sda: Mode Sense: 00 3a 00 00

SCSI device sda: drive cache: write back

SCSI device sda: 625142448 512-byte hdwr sectors (320073 MB)

sda: Write Protect is off

sda: Mode Sense: 00 3a 00 00

SCSI device sda: drive cache: write back

 sda: sda1

sd 0:0:0:0: Attached scsi disk sda

```

Still looking for help with sata_nv hotswapping!

----------

