Re: [PATCH] [g_mass_storage] Fix unmount problem with OS-X

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On May 23, 2012, at 8:25 PM, Alan Stern wrote:

> On Wed, 23 May 2012, Pantelis Antoniou wrote:
> 
>>> I don't believe that.  Are you sure you haven't mixed up unmounting and 
>>> ejecting?
>>> 
>> 
>> I'm using the Finder; I don't fiddle with the command line.
>> 
>> I see an eject icon, I press it, and the disk should umount/eject.
> 
> Is that any different from dragging the disk's icon to the trashcan?
> 

It is the same.

>> On the Mac it's all integrated, there's no separate unmount/eject steps.
>> 
>> Speaking of which, I did try to replicate the behavior of the Mac on Linux.
>> 
>> Using udisks to send a detach command I get to see this on the console:
>> 
>>> May 23 17:55:48 beagleboard [  335.725341]  lun0: unload attempt prevented
>>> May 23 17:55:48 beagleboard [  335.725372]  gadget: sending command-failure status
>>> 
>> 
>> And this is the result on the host:
>> 
>>> root@ubuntu:~# sudo udisks --detach /dev/sdb
>>> Detach failed: Error detaching: helper exited with exit code 1: Detaching device /dev/sdb
>>> USB device: /sys/devices/pci0000:00/0000:00:11.0/0000:02:03.0/usb1/1-1)
>>> SYNCHRONIZE CACHE: OK
>>> STOP UNIT: FAILED: No such file or directory
>>> 
>> 
>> So udisks does send a STOP UNIT command too. Which fails because there was 
>> a previous command that disallowed media unmounting.
> 
> There is no such command.  However there is a command that prevents 
> media _unloading_.  If you unmount all the filesystems on the device 
> first, unloading will be allowed again.  The "eject" command will do 
> both for you.
> 

All the partitions were unmounted before. The command that prevented
media unloading was apparently issued.

>> I does sound like we have a code path (STOP UNIT command) that wasn't been
>> exercised at all on Linux hosts, but on the Mac it is being exercised with
>> unexpected results.
> 
> It _has_ been exercised on Linux hosts.  I tested it when it was 
> originally written.

What is the explanation for the sequence above then? Kernel used on the
device is mainline 3.4.
 
> 
>>> For example, what happens when you plug in a regular USB flash memory
>>> stick to an OS-X system?  Many of them them are not removable.  (More
>>> accurately, none of them are removable and many of them -- but not all!
>>> -- correctly tell the host that they aren't.)  Is it then impossible to
>>> unmount such a flash drive?
>>> 
>> 
>> Most of the USB flash memory sticks I've used on the Mac operate perfectly fine.
>> 
>> You click the eject button and they unmount cleanly. There is a strong case to
>> be made that a Linux based device that presents a mass memory interface should work
>> in the same manner.
> 
> Indeed, the mass-storage gadgets are supposed to present the same 
> interface and behave in the same manner.
> 
> Alan Stern
> 

Regards

-- Pantelis

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux