On Fri, 25 Jan 2019 15:22:56 -0500 Eric Farman <farman@xxxxxxxxxxxxx> wrote: > If we come into mdev_write with state=BUSY and we get the lock, > copy_from_user, and do our jump table we go to fsm_io_busy to set > ret_code and return -EAGAIN. Why then don't we set the jump table for > state=NOT_OPER||STANDBY to do something that will return -EACCES instead > of how we currently do a direct return of -EACCES before all the > lock/copy stuff (and the jump table that would take us to fsm_io_error > and an error message before returning -EIO)? If you phrase it like that, I'm wondering why we're not already doing it that way :) We just need to make sure to revert to the previous state on error instead of IDLE.