USB: mass_storage: eject LUNs on thread exit
authorMichal Nazarewicz <m.nazarewicz@samsung.com>
Thu, 28 Jan 2010 12:05:26 +0000 (13:05 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 2 Mar 2010 22:54:49 +0000 (14:54 -0800)
commit7f1ee82695654faf0a93fc0abf3b08eb354ef1f6
tree4bae5a33bf617e72e8e255a0832871fce9547cf4
parent9f445cb29918dc488b7a9a92ef018599cce33df7
USB: mass_storage: eject LUNs on thread exit

Adds a fallback which forces all LUNs ejection (including
non-removable and with prevent_medium_removal flag) when mass storage
function (MSF) worker thread exits and gadget fails to handle the
situation.

Previously, if thread_exits was not specified mass storage function
(MSF) did nothing when exiting thread as it's unclear for *function*
what to do when it's thread terminates so responsibility of handling
this situation was left to the *gadget* using the function.

The g_mass_storage handled the situation by unregistering itself (the
same thing that file storage gadget does).  However, g_multi did
nothing and so MSF did not eject LUNs which prevented file system
unmounting.

Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
Reviewed-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/f_mass_storage.c
drivers/usb/gadget/mass_storage.c