From: Michal Nazarewicz Date: Mon, 18 Jun 2012 12:37:20 +0000 (+0200) Subject: usb: gadget: mass_storage: fail fsg_store_file() early if colud not open file X-Git-Tag: v3.6-rc1~101^2~53^2~28^2~7 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6e16a89578fcc8834be634c85c5c5ddc2d13229;p=pandora-kernel.git usb: gadget: mass_storage: fail fsg_store_file() early if colud not open file Currently, when a new value is stored to the “file” sysfs entry, fsg_store_file() will release existing backing file and only then attempt to open a new one. If that fails, no new backing file is open. This commit changes the fsg_lun_open() so that it closes existing backing file only after the new backing file has been successfully opened. With that change, fsg_store_file() may use it to perform an atomic open operation with guarantee that logical unit will either point to the new backing file or still to the old one. Signed-off-by: Michal Nazarewicz Acked-by: Alan Stern --- Reading git-diff-tree failed