diff options
author | Mike Anderson <andmike@linux.vnet.ibm.com> | 2009-12-10 18:52:20 -0500 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2009-12-10 18:52:20 -0500 |
commit | 432a212c0dd0f4ca386cf37c5b740ac9dbda4479 (patch) | |
tree | 0eb05111e9290856c9e7543e5d12e1e3ee0c8ef3 /drivers/md/dm.c | |
parent | 6df400ab64c68fc4072a13019fc20fd7e3d51303 (diff) |
dm: add dm_deleting_md function
Add dm_deleting_md to check whether or not a given mapped
device is currently being deleted.
Signed-off-by: Mike Anderson <andmike@linux.vnet.ibm.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r-- | drivers/md/dm.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 233a2e9156a3..16f759fe04fe 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -329,6 +329,11 @@ static void __exit dm_exit(void) | |||
329 | /* | 329 | /* |
330 | * Block device functions | 330 | * Block device functions |
331 | */ | 331 | */ |
332 | int dm_deleting_md(struct mapped_device *md) | ||
333 | { | ||
334 | return test_bit(DMF_DELETING, &md->flags); | ||
335 | } | ||
336 | |||
332 | static int dm_blk_open(struct block_device *bdev, fmode_t mode) | 337 | static int dm_blk_open(struct block_device *bdev, fmode_t mode) |
333 | { | 338 | { |
334 | struct mapped_device *md; | 339 | struct mapped_device *md; |
@@ -340,7 +345,7 @@ static int dm_blk_open(struct block_device *bdev, fmode_t mode) | |||
340 | goto out; | 345 | goto out; |
341 | 346 | ||
342 | if (test_bit(DMF_FREEING, &md->flags) || | 347 | if (test_bit(DMF_FREEING, &md->flags) || |
343 | test_bit(DMF_DELETING, &md->flags)) { | 348 | dm_deleting_md(md)) { |
344 | md = NULL; | 349 | md = NULL; |
345 | goto out; | 350 | goto out; |
346 | } | 351 | } |
@@ -2659,7 +2664,7 @@ struct mapped_device *dm_get_from_kobject(struct kobject *kobj) | |||
2659 | return NULL; | 2664 | return NULL; |
2660 | 2665 | ||
2661 | if (test_bit(DMF_FREEING, &md->flags) || | 2666 | if (test_bit(DMF_FREEING, &md->flags) || |
2662 | test_bit(DMF_DELETING, &md->flags)) | 2667 | dm_deleting_md(md)) |
2663 | return NULL; | 2668 | return NULL; |
2664 | 2669 | ||
2665 | dm_get(md); | 2670 | dm_get(md); |