public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Phillip Susi <psusi@cfl.rr.com>
To: Kyle Moffett <mrmacman_g4@mac.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	Alon Bar-Lev <alon.barlev@gmail.com>,
	Kernel development list <linux-kernel@vger.kernel.org>
Subject: Re: Flames over -- Re: Which is simpler?
Date: Tue, 14 Feb 2006 01:27:28 -0500	[thread overview]
Message-ID: <43F17850.8080600@cfl.rr.com> (raw)
In-Reply-To: <DD0B9449-14AF-47D1-8372-DDC7E896DBC2@mac.com>

Kyle Moffett wrote:
> No, that's _exactly_ what the spec says (well, not verbatim but close 
> enough).  When you disconnect, both the master and slave devices are 
> perfectly free to assume that the connection is completely broken and no 
> state is maintained.  Anything that breaks that assumption is against 
> the spec and likely to break in odd scenarios.
> 

Perfectly free to != required to.  When you know that the connection is 
"broken" due to suspend and there is no way to differentiate between 
that and the device really being disconnected, you have two choices:

1) Assume the user is a masochistic idiot and replaced the device with 
one that looks just like it, or connected the device somewhere else and 
modified it before replacing it, or

2) Assume the user is sane and did no such thing.

Assumption #2 will be correct most of the time and is a valid use case, 
the first is not. If either assumption is wrong, it will lead to data 
loss.  All else being equal, which case do you optimize for?  The common 
and correct case, or the uncommon error case?

> 
> Which causes worse data-loss, writing out cached pages and filesystem 
> metadata to a filesystem that has changed in the mean-time (possibly 
> allocating those for metadata, etc) or forcibly unmounting it as though 
> the user pulled the cable?  Most filesystems are designed to handle the 
> latter (it's the same as a hard-shutdown), whereas _none_ are designed 
> to handle the former.
> 

So you condemn the common correct use case to always suffer data loss to 
give _slightly_ better protection to the uncommon and incorrect use 
case?  I think most users prefer a system that works right when you use 
it right to one that doesn't break quite as badly when you do something 
stupid.

Also why is this argument more valid for USB than SCSI?  I am just as 
free to unplug a scsi disk and replace it with a different one while 
hibernated, yet I don't suffer data loss when I don't do such 
foolishness.  By your argument, because the kernel can not know for sure 
that I didn't do that, it must disconnect and break all the drives on 
the bus.

> A good set of suspend scripts should handle the hardware-suspend with no 
> extra work because hardware supporting hardware-suspend basically 
> inevitably supports USB low-power-mode, and handle software-suspend by 
> either forcibly syncing and unmounting USB filesystems or by failing the 
> suspend and asking the user to.  You also could patch the kernel to fail 
> a powerdown software suspend if some USB device is mounted or otherwise 
> unremovably in-use.
> 

That would prevent data loss, so it would be better than the current 
method of silently loosing data because you assume the user is out to 
get you.  There are other downsides to it though.  What if someone wants 
to boot from a usb drive and suspend to disk?

> 
> Except that would make Linux broken with respect to the USB spec.  It is 

Please point out where in the USB spec it states that the OS _MUST_ 
assume that the device is no longer the same after a bus shutdown and 
restart, even though it otherwise appears to be.

> fallacious to assume that a USB device that the kernel has told to 
> disconnect will still have the same state when the kernel tries to 
> reconnect, even _if_ you could reliably identify it (which you can't 
> because there is no serial number of any sort on a lot of devices.
> 

It is worse to assume that it HAS changed, when that is guaranteed to 
lead to data loss even though it most likely has not changed.  This is 
no different than assuming that the user knows what they are doing when 
they fdisk a drive.  You don't refuse to fdisk a drive just because you 
can't be 100% certain that they aren't doing something stupid that _may_ 
result in data loss, so you assume they know what they are doing and do 
as they say.



  parent reply	other threads:[~2006-02-14  6:27 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-12 16:57 Flames over -- Re: Which is simpler? Alan Stern
2006-02-13  0:51 ` Phillip Susi
2006-02-13  2:19   ` Alan Stern
2006-02-13  3:52     ` Phillip Susi
2006-02-13  5:43       ` Kyle Moffett
2006-02-13 16:40         ` Phillip Susi
2006-02-13 16:31       ` Alan Stern
2006-02-13 17:14         ` Phillip Susi
2006-02-13 20:04           ` Alan Stern
2006-02-13 20:38             ` Phillip Susi
2006-02-13 21:24               ` Alan Stern
2006-02-13 22:27                 ` Rafael J. Wysocki
2006-02-14 19:26                   ` Alan Stern
2006-02-14 20:41                     ` Rafael J. Wysocki
2006-02-14 21:08                       ` Lee Revell
2006-02-15 15:56                       ` Alan Stern
2006-02-13 22:51                 ` J. Bruce Fields
2006-02-13 23:47                 ` Phillip Susi
2006-02-14  0:50                   ` Kyle Moffett
2006-02-14  2:09                     ` Phillip Susi
2006-02-14  4:09                       ` Kyle Moffett
2006-02-14  4:28                         ` Alan Stern
2006-02-14  5:11                           ` Kyle Moffett
2006-02-14 15:33                             ` Alan Stern
2006-02-14  6:27                         ` Phillip Susi [this message]
2006-02-14 16:23                           ` Kyle Moffett
2006-02-14 18:39                             ` Phillip Susi
2006-02-14 19:55                               ` Kyle Moffett
2006-02-14 21:13                                 ` Phillip Susi
2006-02-14 23:32                                   ` Kyle Moffett
2006-02-15  3:08                                     ` Phillip Susi
2006-02-14 19:14                             ` Olivier Galibert
2006-02-14 19:37                               ` Phillip Susi
2006-02-17 21:04                   ` Pavel Machek
2006-02-18 16:34                     ` Phillip Susi
2006-02-18 17:29                       ` Pavel Machek
2006-02-19  5:52                         ` Phillip Susi
2006-02-19  9:02                           ` Pavel Machek
2006-02-19 16:35                             ` Phillip Susi
2006-02-19 16:41                               ` Alan Stern
2006-02-19 19:17                                 ` Phillip Susi
2006-02-19 19:43                                   ` Pavel Machek
2006-02-20  0:56                                     ` Olivier Galibert
2006-02-20  1:01                                       ` Pavel Machek
2006-02-20  1:26                                         ` Olivier Galibert
2006-02-20  4:04                                           ` Alan Stern
2006-02-19 20:16                                   ` Bernd Eckenfels
2006-02-18 21:04                     ` Alan Stern
2006-02-19  0:02                       ` Andrew Morton
2006-02-19  6:02                         ` Phillip Susi
2006-02-19  6:32                           ` Andrew Morton
2006-02-19 16:39                             ` Phillip Susi
2006-02-19 16:54                               ` Alan Stern
2006-02-19 20:02                                 ` Andrew Morton
2006-02-19 20:44                                   ` Oliver Neukum
2006-02-19 21:02                                     ` Andrew Morton
2006-02-20  6:55                                       ` Oliver Neukum
2006-02-20  7:29                                         ` Andrew Morton
2006-02-20  7:57                                           ` Andrew Morton
2006-02-14 14:15     ` hackmiester / Hunter Fuller
2006-02-15 23:51     ` Pavel Machek
2006-02-13  2:25   ` Kyle Moffett
  -- strict thread matches above, loose matches on Subject: below --
2006-02-13 19:16 David Brownell
2006-02-13 20:08 ` Phillip Susi
2006-02-14  3:10   ` David Brownell
2006-02-14  6:05     ` Phillip Susi
2006-02-14 17:04       ` David Brownell
2006-02-15 23:43   ` Pavel Machek
2006-02-18 20:51     ` David Brownell
2006-02-19  6:06       ` Phillip Susi
2006-02-20  5:50         ` David Brownell
2006-02-20 16:07           ` Phillip Susi
2006-02-20 16:51             ` Olivier Galibert
2006-02-20 18:20               ` Phillip Susi
2006-02-20 18:44                 ` Olivier Galibert
2006-02-20 21:45                   ` Phillip Susi
2006-02-21 16:19             ` David Brownell
2006-02-21 18:30               ` Phillip Susi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43F17850.8080600@cfl.rr.com \
    --to=psusi@cfl.rr.com \
    --cc=alon.barlev@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mrmacman_g4@mac.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox