Bug 233697 - suspend causes unnecssary device remove/add events for USB
Summary: suspend causes unnecssary device remove/add events for USB
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 12
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Kernel Maintainer List
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-03-23 20:25 UTC by David Zeuthen
Modified: 2013-03-06 03:49 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-12-05 07:16:48 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description David Zeuthen 2007-03-23 20:25:43 UTC
If I suspend my box, then on the resume path I see all my USB devices being
removed and then added back. This is a problem with storage devices connected
via USB. See 

 https://www.redhat.com/archives/fedora-devel-list/2007-March/msg01375.html

and other threads for how this impacts the user experience.

The kernel not send an "remove" event if it's going to send an "add" right
after. Instead it should enumerate the bus on resume and only send the events
that represents how to get from the previous device tree to the current one.

This happens both with STR and STD using pm-utils as a mechanism. Peter, we
don't do anything silly in pm-utils like unload the kernel modules (e.g.
ehci-hcd + friends) for the USB host controllers, do we?

Comment 1 Pete Zaitcev 2007-03-23 20:57:36 UTC
What does happen if a user suspends, unplugs a USB key, modifies its contents,
plugs it back, and resumes? In such a case, there would be no change between
the state of USB bus between the before-suspend state and after-resume state.


Comment 2 David Zeuthen 2007-03-23 21:21:58 UTC
In that case the user would see data corruption - just as if he mounts a piece
of removable media in a USB card reader; yanks out the card and modifies it
elsewhere, and then puts it back in. (In most cases this isn't an issue though
since HAL polls the drive.)

I my opinion we can't really defend ourselves against such users... We can of
course add checks in the file system drivers in the resume hooks to validate the
super block and mount read-only if something change. 

So I would say that the USB core should punt this to higher level drivers. Btw,
do you think the example you raised is likely to occur frequently in the real world?


Comment 3 Peter Jones 2007-03-23 21:34:22 UTC
No, we're not removing any usb modules.  It wouldn't really be a reasonable
thing to do ever, at all.

I agree you shouldn't be getting uevents unless the state appears to have
*changed* while the device was down.  I don't know how feasible that is though,
because I really don't know anything about the bus protocol for enumerating a
usb bus.

One thing to note is that Windows has an interesting strategy on how to handle
the "stupid user" case you mentioned -- which is essentially that they on
removable writable storage, they aggressively write back data and leave the
on-disk state looking like it isn't mounted as much of the time as possible.

Comment 4 Pete Zaitcev 2007-03-23 22:12:12 UTC
David:

I don't think that the example of a card reader is a good analogy, because
card readers report a check confition with key 6 and ASC/ASCQ 0x3A/0 upon
the next access. The polling by HAL only serves to discover this condition,
because there's no asynchronous event of any kind. The polling would still
report it even if you pull and reinsert the card in less then 2 seconds.
If readers did not detect the card removal, it would be just like you
described (as I understood your mental model).

The corruption of a card is prevented by taking a SCSI volume off-line
if 0x3A happens (assuming that there wasn't unwritten dirty data).
Current filesystem cannot add new dirty data into the (replaced) media.
The volume has to be mounted again. So nothing should corrupt anything
even if HAL is not polling.

Personally, I don't want to challenge your scheme. As long as you realize
the drawbacks, it's all good to me. All I need is some kind of position
to present upstream (e.g. Greg Kroah, but also Alan Stern).

To answer the question regarding the likelyhood, I'm afraid that it may
be likely, based on how my family uses computers. Teaching them to use
"Safely remove hardware" mechanism in Windows proves utterly impossible.
They feel entitled to pull USB keys freely. The school of hard knocks
taught them to press Ctrl-S, but that's just about the limit. I think
that auto-suspend on lid close is going to make this situation worse.


Comment 5 Michel Alexandre Salim 2007-03-27 02:53:49 UTC
How about just playing it safe and unmounting every removable storage during the
suspend process? If it fails (perhaps due to open files), force remounting
read-only. On resume, try remounting the devices that were mounted if they're
still connected.

Comment 6 Bug Zapper 2008-05-14 02:41:14 UTC
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 7 Bug Zapper 2009-06-09 22:30:46 UTC
This message is a reminder that Fedora 9 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 9.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '9'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 9's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 9 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 8 Bug Zapper 2009-07-14 17:05:42 UTC
Fedora 9 changed to end-of-life (EOL) status on 2009-07-10. Fedora 9 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 9 Marcin Zajaczkowski 2009-07-14 21:13:08 UTC
I have the same problem with Fedora 11. This is very unpleasant for me, because I have F11 installed on an USB drive and due to that behavior I can't suspend my Fedora.

There could be a way to mark an USB device as a "fixed" one - user is responsible for that it won't be unplugged from a computer in the meantime.

Comment 10 Bug Zapper 2010-04-27 11:42:18 UTC
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 11 Marcin Zajaczkowski 2010-06-02 23:02:57 UTC
The same with Fedora 12.

Comment 12 Bug Zapper 2010-11-04 12:11:52 UTC
This message is a reminder that Fedora 12 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 12.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '12'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 12's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 12 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 13 Bug Zapper 2010-12-05 07:16:48 UTC
Fedora 12 changed to end-of-life (EOL) status on 2010-12-02. Fedora 12 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.