James Bottomley wrote:
This still doesn't solve the fundamental corruption problem: sdev->event_work has to contain the work entry until the workqueue has finished executing it (which is some unspecified time in the future). As soon as you drop the sdev->list_lock, the system thinks sdev->event_work is available for reuse. If we fire another event before the work queue finished processing the prior event, the queue will be corrupted.
I think you're misunderstanding the workqueue code? You can call schedule_work(&sdev->event_work) from anywhere, any time you like, as many times as you like.
Also, I think Kristin's initial use of execute_in_user_context() was a good call .. if we already have a user context, there's no need to bother the workqueue ... some of these events will likely trigger from thread backed kernel daemons.
Quite agreed that sdev_evt_notify() might be called from kernel daemons, but in general this is a fire-and-forget API that is -likely- to be called from interrupt or completion context of many drivers, just like scsi_done or other completion APIs. It is a fundamentally parallel interface.
If thread-backed kernel daemons want to use this, it is trivial for them to schedule work, then sync.
Jeff - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html