]> git.baikalelectronics.ru Git - kernel.git/commit
nvme: Prevent controller state invalid transition
authorGabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
Fri, 29 Jul 2016 19:15:18 +0000 (16:15 -0300)
committerJens Axboe <axboe@fb.com>
Mon, 15 Aug 2016 15:46:46 +0000 (09:46 -0600)
commit69ffe76d8b2cde9e1d4a7c7a1074ebb5f2884409
tree88f3765ae063a57ee5b1180af0839f5c7be36c39
parenta9876d9535a9c467690173ddad00ced906e1e077
nvme: Prevent controller state invalid transition

Acquiring the nvme_ctrl lock before reading ctrl->state in
nvme_change_ctrl_state() should prevent a theoretical invalid state
transition, in the event of two threads racing inside that function.

I haven't been able to observe this happening with the current code, and
the current state machine seems to be simple enough to not be
affected by these invalid transitions, but future modifications could
make it more likely to happen.

Signed-off-by: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
Reviewed-by: Sagi Grimberg <sag@grimberg.me>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/nvme/host/core.c