diff options
author | Alasdair G Kergon <agk@redhat.com> | 2006-06-26 00:27:34 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 09:58:36 -0700 |
commit | 5c6bd75d06db512515a3781aa97e42df2faf0815 (patch) | |
tree | 43d68c6d3174e1ae8a778acd834665c122f8b2a4 /drivers/md/dm.h | |
parent | c2ade42dd35466d90aa6fc7cc717f396e165492f (diff) | |
download | kernel_samsung_espresso10-5c6bd75d06db512515a3781aa97e42df2faf0815.zip kernel_samsung_espresso10-5c6bd75d06db512515a3781aa97e42df2faf0815.tar.gz kernel_samsung_espresso10-5c6bd75d06db512515a3781aa97e42df2faf0815.tar.bz2 |
[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 <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/dm.h')
-rw-r--r-- | drivers/md/dm.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/dm.h b/drivers/md/dm.h index 71ddd1e..9ebb24b 100644 --- a/drivers/md/dm.h +++ b/drivers/md/dm.h @@ -123,5 +123,7 @@ void dm_stripe_exit(void); void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size); union map_info *dm_get_mapinfo(struct bio *bio); +int dm_open_count(struct mapped_device *md); +int dm_lock_for_deletion(struct mapped_device *md); #endif |