]> asedeno.scripts.mit.edu Git - linux.git/commit
nvme: change namespaces_mutext to namespaces_rwsem
authorJianchao Wang <jianchao.w.wang@oracle.com>
Mon, 12 Feb 2018 12:54:46 +0000 (20:54 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 26 Mar 2018 14:53:43 +0000 (08:53 -0600)
commit765cc031cddde40bdc279e8e2697571c7956c54e
tree7d8beb4bcf2cf6fbe8cebdb600b3633158ce61e6
parent6f8e0d787e3727ed70116e3523f4ecb86887c000
nvme: change namespaces_mutext to namespaces_rwsem

namespaces_mutext is used to synchronize the operations on ctrl
namespaces list. Most of the time, it is a read operation.

On the other hand, there are many interfaces in nvme core that
need this lock, such as nvme_wait_freeze, and even more interfaces
will be added. If we use mutex here, circular dependency could be
introduced easily. For example:
context A                  context B
nvme_xxx                   nvme_xxx
hold namespaces_mutext     require namespaces_mutext
sync context B

So it is better to change it from mutex to rwsem.

Reviewed-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/host/core.c
drivers/nvme/host/multipath.c
drivers/nvme/host/nvme.h