Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 174373 - SCSI/libata disk shutdown issues
Summary: SCSI/libata disk shutdown issues
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Daniel Drake (RETIRED)
URL: http://bugzilla.kernel.org/show_bug.c...
Whiteboard:
Keywords:
: 178559 189636 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-04-13 07:07 UTC by @4u
Modified: 2007-08-20 20:03 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
All patches that make start/stop management work (libata_start_stop_management.patch,90.68 KB, patch)
2007-05-11 05:39 UTC, Ricardo Salveti
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description @4u 2007-04-13 07:07:03 UTC
I searched for this bug on bugzilla.kernel.org and found a patch. Unfortunately Tejun Heo told me that this patch will be applied earliest to linux-2.6.21.1. For that reason I want to request that the patch is added to all current and future gentoo-sources (and other kernel sources) until 2.6.21.1.

Patch: http://bugzilla.kernel.org/attachment.cgi?id=10122&action=view

Reproducible: Always

Steps to Reproduce:
1. Use AHCI on a Thinkpad T60 for example
2. Run shutdown -h now or echo disk > /sys/power/state

Actual Results:  
Harddisk is switched off uncleanly. SMART values disk_shift and power-off_retract_count are increased.

Expected Results:  
Harddisk is switched of using right ATA commands.

I thinks this bug is critical because this is not a intended behavior for harddisks.
Comment 1 @4u 2007-04-17 06:17:53 UTC
Hi, unfortunately noone seems to be willing to react here. I want to point out two important things:

1. Every modern notebook with SATA (and PATA) kernels is affected.
2. Because of the Emergency Head Resets (or however it was called) it it likely that the harddrive breaks far earlier than designed!!! And at least in my opinion a broken harddrive is the worst thing that can happen.

Hope someone integrates at soon ... (Is there a public holiday?)
Comment 2 Christian Heim (RETIRED) gentoo-dev 2007-04-26 07:31:48 UTC
(In reply to comment #1)
> Hi, unfortunately noone seems to be willing to react here. I want to point out
> two important things:
> 
> 1. Every modern notebook with SATA (and PATA) kernels is affected.
> 2. Because of the Emergency Head Resets (or however it was called) it it likely
> that the harddrive breaks far earlier than designed!!! And at least in my
> opinion a broken harddrive is the worst thing that can happen.
> 
> Hope someone integrates at soon ... (Is there a public holiday?)

1. You might know, Gentoo is a voluntary project; means we *dedicate* _our_ free time to this project.
2. Our free time might be short (or we might not be able to dedicate much of our time), I know at least dsd hasn't much at the moment.
3. I'm going to look into this before we release the genpatch set for 2.6.21
Comment 3 @4u 2007-04-26 07:43:29 UTC
(In reply to comment #2)
> 1. You might know, Gentoo is a voluntary project; means we *dedicate* _our_
> free time to this project.

I know and really appreciate that.

> 2. Our free time might be short (or we might not be able to dedicate much of
> our time), I know at least dsd hasn't much at the moment.

Thats absolutely fine with me. Only a small respond would be great so that I and other users know that it has been recognized at least.

> 3. I'm going to look into this before we release the genpatch set for 2.6.21

Thanks :)
Comment 4 Daniel Drake (RETIRED) gentoo-dev 2007-04-26 23:54:39 UTC
We'll certainly be sure to have this fixed properly long before 2.6.21 goes stable. It doesn't affect all configurations, only some. We also need to fix the userspace part.
Comment 5 Daniel Drake (RETIRED) gentoo-dev 2007-05-03 02:07:43 UTC
This isn't a 2.6.21 regression, I mismarked it earlier.

There's a lot of stuff to digest here, I need to revisit it later.

Relevant LKML threads:

   Loud "pop" coming from hard drive on reboot
   Weird hard disk noise on shutdown (bug #7674)

Upstream bugs:

http://bugzilla.kernel.org/show_bug.cgi?id=7674
http://bugzilla.kernel.org/show_bug.cgi?id=7838

More links:
http://git.kernel.org/?p=linux/kernel/git/jejb/scsi-misc-2.6.git;a=commit;h=c3c94c5a2fb43a654e777f509d5032b0db8ed09f
http://article.gmane.org/gmane.linux.scsi/30489
http://article.gmane.org/gmane.linux.ide/17392
http://thread.gmane.org/gmane.linux.scsi/30487/focus=17392
Comment 6 Ricardo Salveti 2007-05-08 08:53:27 UTC
Here's what I did now for now (a workaround):

I tested patching kernel 2.6.20 and 2.6.21 (also the ones installed with gentoo-sources) with the implementation of START/STOP management. To do this just patch your kernel with the following patches:
1 - http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff_plain;h=684b7fe976554d12e6266d7280c87a0f3feff02e
2 - http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff_plain;h=62d42a62770dd66da2d3df693e70f4e5fae1716a
3 - http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff_plain;h=e73aec8247032ee730b5f38edf48922c4f72522e;hp=a4d04a4cd9881e89fdc62107b6b57053438f2b30
4 - http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=3721050afc6cb6ddf6de0f782e2054ebcc225e9b;hp=ad8c31bb69d60c0c6bc6431bccdf67e5a96c0d31
5 - http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=c3c94c5a2fb43a654e777f509d5032b0db8ed09f;hp=3721050afc6cb6ddf6de0f782e2054ebcc225e9b

Then sdev->mange_start_stop will be present in your kernel. With this you can (works as a workaround, the final patches are not applied yet) just give "# echo 1 > /sys/class/scsi_disk/0\:0\:0\:0/manage_start_stop" to see you hard disk switch off normally.

The final solution depends on these patches:
1 - http://article.gmane.org/gmane.linux.scsi/30489
2 - http://article.gmane.org/gmane.linux.ide/17392

Both patches are not upstream yet, and will need some modifications on 'shutdown(8)' to work with every cases.

I'll try to backport both patches so we can use them as soon they're upstream (patch 3 change lots of things and patch doesn't work ok with 2.6.20 and 2.6.21).
Comment 7 Daniel Drake (RETIRED) gentoo-dev 2007-05-10 22:48:17 UTC
The situation is now simpler: all that needs doing is shutdown modified as described in the URL below, plus the 2 patches in that patchset.

http://thread.gmane.org/gmane.linux.ide/18485

I'll look into making the shutdown changes when those patches go into Linus' tree.
Comment 8 Ricardo Salveti 2007-05-11 05:39:28 UTC
Created attachment 118829 [details, diff]
All patches that make start/stop management work

Almost all patches are applied successfully at 2.6.21, the only patch that has problem is  http://thread.gmane.org/gmane.linux.ide/18485 , because it tries to apply the patch at file drivers/ata/pata_cmd640.c and this file doesn't exist in 2.6.21 yet. Removing this part of the patch let everything ok.

If it helps, I put one patch that has every patch needed to make this work as attachment.

This patch is composed of patches 1, 3, 4 and 5 from comment #6 and also patches http://article.gmane.org/gmane.linux.ide/18486 and http://article.gmane.org/gmane.linux.ide/18487 .

Now it just need the shutdown modification.
Comment 10 Jakub Moc (RETIRED) gentoo-dev 2007-05-14 20:39:33 UTC
*** Bug 178559 has been marked as a duplicate of this bug. ***
Comment 11 Daniel Drake (RETIRED) gentoo-dev 2007-05-15 03:43:44 UTC
Looks like our shutdown utilities don't halt scsi disks anyway.
http://marc.info/?l=linux-ide&m=117920048530447&w=2
Comment 12 Francesco Pretto 2007-05-15 16:12:12 UTC
(In reply to comment #11)
> Looks like our shutdown utilities don't halt scsi disks anyway.
> http://marc.info/?l=linux-ide&m=117920048530447&w=2
> 

Yeah. For everybody else interested, seems  after all that no userland modifications will be needed:
http://thread.gmane.org/gmane.linux.ide/18846
Comment 13 Ricardo Salveti 2007-05-17 23:21:07 UTC
I guess that now we have the final solution, no userland modification needed:

http://thread.gmane.org/gmane.linux.ide/18934
Comment 14 Daniel Drake (RETIRED) gentoo-dev 2007-05-18 23:12:37 UTC
OK. All patches are ready but I'm going to give this some more time being tested in the 2.6.22 tree before backporting it.
Comment 15 Daniel Drake (RETIRED) gentoo-dev 2007-05-25 02:41:29 UTC
Fixed in gentoo-sources-2.6.21-r2 (genpatches-2.6.21-3)
Comment 16 Jakub Moc (RETIRED) gentoo-dev 2007-08-20 20:03:28 UTC
*** Bug 189636 has been marked as a duplicate of this bug. ***