From: Alasdair G Kergon Date: Mon, 26 Jun 2006 07:27:34 +0000 (-0700) Subject: [PATCH] dm: prevent removal if open X-Git-Tag: v2.6.18-rc1~650 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c6bd75d06db512515a3781aa97e42df2faf0815;p=pandora-kernel.git [PATCH] dm: prevent removal if open If you misuse the device-mapper interface (or there's a bug in your userspace tools) it's possible to end up with 'unlinked' mapped devices that cannot be removed until you reboot (along with uninterruptible processes). This patch prevents you from removing a device that is still open. It introduces dm_lock_for_deletion() which is called when a device is about to be removed to ensure that nothing has it open and nothing further can open it. It uses a private open_count for this which also lets us remove one of the problematic bdget_disk() calls elsewhere. Signed-off-by: Alasdair G Kergon Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Reading git-diff-tree failed