On 06/12/2017 03:03 PM, Bart Van Assche wrote: > On Mon, 2017-06-12 at 13:40 -0500, Mike Christie wrote: >> For the xcopy use, I was still trying to figure out how that worked >> before my patches. target_xcopy_locate_se_dev_e4 would return a device >> under the g_device_mutex but I could not figure out how it was protected >> from removal after that mutex was dropped. > > Hello Mike, > > I don't think that protection did already exist. Had you noticed the > following patch: "[PATCH v6 12/33] target: Introduce target_get_device() > and target_put_device()" > (https://www.spinics.net/lists/target-devel/msg14535.html)? > Thanks. What about target_depend_item/target_undepend_item calls? That it would prevent removals while the device is in use. You would need get/put calls if you used my lookup/iter helpers while removal was already in progress and could race. Do we want to do both for my next posting? For the current uses (tcmu and xcopy), both are not needed I do not think, but do we want to make the interface for generic use? For the latter, I will build off of your patches then. -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html