]> git.baikalelectronics.ru Git - kernel.git/commit
nvme: Remove RCU namespace protection
authorKeith Busch <keith.busch@intel.com>
Wed, 13 Jul 2016 17:45:02 +0000 (11:45 -0600)
committerJens Axboe <axboe@fb.com>
Thu, 14 Jul 2016 15:48:08 +0000 (08:48 -0700)
commita0418d143de4a904b2b9e0ae3e3bf84510c103b1
treeb0b789ae8f42f0f987776671f8828c4e36a63280
parent4ec263bcbe384b0f4088606371530dd5f28b24ba
nvme: Remove RCU namespace protection

We can't sleep with RCU read lock held, but we need to do potentially
blocking stuff to namespace queues when iterating the list. This patch
removes the RCU locking and holds a mutex instead.

To prevent deadlocks, this patch removes holding the mutex during
namespace scanning and removal. The unlocked namespace scanning is made
safe by holding a reference to the namespace being scanned.

List iteration that does IO has to be unlocked to allow error recovery.
The caller must ensure the list can not be manipulated during such an
event, so this patch adds a comment explaining this requirement to the
only function that iterates an unlocked list. All callers currently
meet this requirement, so no further changes required.

List iterations that do not do IO can safely use the lock since it couldn't
block recovery from missing forced IO completions.

Reported-by: Ming Lin <mlin at kernel.org>
[fixes f85c2c9 nvme: switch to RCU freeing the namespace]
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/nvme/host/core.c