block: Fix dev_t minor allocation lifetime
authorKeith Busch <keith.busch@intel.com>
Tue, 26 Aug 2014 15:05:36 +0000 (09:05 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 5 Oct 2014 21:52:19 +0000 (14:52 -0700)
commit5f9b9210b5eb01efe35901f7e78aa0204520563a
treed1ade9164778bcf381b616cd6632b9a0b8533b61
parent0652fc95fb0fa0f35cd4abad26f5eabc0ecf64a3
block: Fix dev_t minor allocation lifetime

commit 2da78092dda13f1efd26edbbf99a567776913750 upstream.

Releases the dev_t minor when all references are closed to prevent
another device from acquiring the same major/minor.

Since the partition's release may be invoked from call_rcu's soft-irq
context, the ext_dev_idr's mutex had to be replaced with a spinlock so
as not so sleep.

Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
block/genhd.c
block/partition-generic.c