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:54:12 +0000 (14:54 -0700)
commit3710e26e8c32de6f68ec8810191b3b6c3217dad8
treeb5743f362d5d39fcb9dfcf83f702566a742c38e0
parent545608863572bfc5836d15635e336410d9c952f8
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