Opened 9 years ago

Closed 2 years ago

#6683 closed bug (invalid)

KDL when unplugging a mounted USB flash stick

Reported by: x-ist Owned by: axeld
Priority: normal Milestone: R1
Component: System/Kernel Version: R1/Development
Keywords: Cc: umccullough, mdisreali@…
Blocked By: Blocking: #11704
Has a Patch: no Platform: All

Description

After having booted Haiku from an USB flash stick "A" and having plugged in another flash stick "B", mounting "B" and unplugging it afterwards leads to KDL.

One has to unmount the drive first to be able to safely remove the stick!

Attachments (2)

StickUnpludgedKdl.jpg (210.1 KB) - added by x-ist 8 years ago.
KDL comming up imediatelly after pluggin out
StickUnpludgedKdl_Continue.jpg (181.2 KB) - added by x-ist 8 years ago.
Next KDL after performing "continue".

Download all attachments as: .zip

Change History (21)

comment:1 in reply to:  description ; Changed 9 years ago by Disreali

Version: R1/alpha2R1/Development

Replying to x-ist:

One has to unmount the drive first to be able to safely remove the stick!

Every OS that I've used has the same requirement. That won't change. You answered your own question.

comment:2 in reply to:  1 Changed 9 years ago by anevilyak

Component: - GeneralSystem/Kernel
Owner: changed from nobody to axeld

Replying to Disreali:

Every OS that I've used has the same requirement. That won't change. You answered your own question.

Sure, but usually the result is data loss on the stick in question, not an OS panic. In this case however, the problem actually lies in the block cache, since it considers any failure to write a block back to disk as critical (which would probably bite you if a hard disk had a bad block as well). That should probably be reworked so the error can be propagated back to the originator of the write request, so decisions about how critical the failure is can be made where needed.

comment:3 in reply to:  1 ; Changed 9 years ago by x-ist

One has to unmount the drive first to be able to safely remove the stick!

Every OS that I've used has the same requirement. That won't change. You answered your own question.

The OSes I used show a message box (at worse), when you pull out the stick. Wrong user behavior must be tolerated at this point.

comment:4 Changed 9 years ago by axeld

The panic is only a debug helper, and should be removed for actual releases (I would remove it once we go beta).

In any case, please keep in mind that you've just corrupted some data on that stick, and the OS can't do anything about it but show you an error alert (or KDL in the case of Haiku ;-)).

comment:5 Changed 9 years ago by x-ist

Thanks for clarification about the KDL!

If it's not the Haiku system stick and its idle, i.e. there was no transaction for minutes I don't see a reason why I shouldn't be allowed to remove the stick.

Anyway, if there were transactions which must not be interrupted, an overlay above the drive icon indicating that the stick is "busy" would be really helpful. This way I would obviously see when its safe to unplug the stick.

comment:6 in reply to:  5 Changed 9 years ago by anevilyak

Replying to x-ist:

Anyway, if there were transactions which must not be interrupted, an overlay above the drive icon indicating that the stick is "busy" would be really helpful. This way I would obviously see when its safe to unplug the stick.

There's less guess work if you just right-click, unmount :) That forces all transactions to the stick to be flushed immediately.

comment:7 Changed 9 years ago by x-ist

sure. this would the other option :)

comment:8 Changed 9 years ago by tangobravo

I think somewhere (perhaps it was some Linux distro) I've seen a prompt asking for the stick to be replaced so that writing can be finished. That's a neat solution if it's possible without too much work. Also it's probably worth forcing somewhat regular flushes for removable media. Windows XP offers some option about how much caching to use that is by default set to the option to flush writes instantly IIRC, even though it probably has a transfer speed penalty.

comment:9 in reply to:  8 Changed 9 years ago by x-ist

Replying to tangobravo:

Also it's probably worth forcing somewhat regular flushes for removable media.

This would be the best way to go in my opinion, i.e. to flush the pending data automatically after a certain period of time, let's say 3 to 5 seconds. Thus entering the "nonbusy" mode.

comment:10 in reply to:  4 Changed 8 years ago by umccullough

Replying to axeld:

In any case, please keep in mind that you've just corrupted some data on that stick, and the OS can't do anything about it but show you an error alert (or KDL in the case of Haiku ;-)).

I don't believe that's an accurate assertion.

I get a KDL when pulling out a readonly-mounted USB stick as well (usually after copying some files off it to the HD).

Anyway, this is one of the absolutely most annoying KDLs currently - there seems to be no way to recover from it and I always end up rebooting.

comment:11 Changed 8 years ago by umccullough

Cc: umccullough added

comment:12 in reply to:  3 Changed 8 years ago by Disreali

Cc: mdisreali@… added

Replying to x-ist:

One has to unmount the drive first to be able to safely remove the stick!

Every OS that I've used has the same requirement. That won't change. You answered your own question.

The OSes I used show a message box (at worse), when you pull out the stick. Wrong user behavior must be tolerated at this point.

Sorry, you are right. Just ask umccullough.

comment:13 Changed 8 years ago by luroh

Duplicate of #4608, fixed in hrev41119?

comment:14 in reply to:  13 Changed 8 years ago by x-ist

Replying to luroh:

Duplicate of #4608, fixed in hrev41119?

This is hrev41884. Mounting in ReadOnly mode and unplugging works now with no KDL. However, in RW mode KDL still appears.

comment:15 Changed 8 years ago by diver

Please attach an image of such KDL.

Changed 8 years ago by x-ist

Attachment: StickUnpludgedKdl.jpg added

KDL comming up imediatelly after pluggin out

Changed 8 years ago by x-ist

Next KDL after performing "continue".

comment:16 Changed 8 years ago by x-ist

Here they are..

comment:17 Changed 4 years ago by luroh

Blocking: 11704 added

comment:18 Changed 4 years ago by luroh

Is this still repeatable after hrev49000?

comment:19 Changed 2 years ago by axeld

Resolution: invalid
Status: newclosed

The panic should still be active, since we haven't reached the beta yet. That's not a bug, though. The other issues mentioned here should already be fixed.

Note: See TracTickets for help on using tickets.