From 432a212c0dd0f4ca386cf37c5b740ac9dbda4479 Mon Sep 17 00:00:00 2001 From: Mike Anderson Date: Thu, 10 Dec 2009 23:52:20 +0000 Subject: [RHEL5.7 PATCH] dm: add dm_deleting_md function Upstream commit 432a212c0dd0f4ca386cf37c5b740ac9dbda4479 Author: Mike Anderson Date: Thu Dec 10 23:52:20 2009 +0000 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 Signed-off-by: Alasdair G Kergon --- drivers/md/dm.c | 7 ++++++- drivers/md/dm.h | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) Index: linux-rhel5/drivers/md/dm.c =================================================================== --- linux-rhel5.orig/drivers/md/dm.c +++ linux-rhel5/drivers/md/dm.c @@ -239,6 +239,11 @@ static void __exit dm_exit(void) /* * Block device functions */ +int dm_deleting_md(struct mapped_device *md) +{ + return test_bit(DMF_DELETING, &md->flags); +} + static int dm_blk_open(struct inode *inode, struct file *file) { struct mapped_device *md; @@ -250,7 +255,7 @@ static int dm_blk_open(struct inode *ino goto out; if (test_bit(DMF_FREEING, &md->flags) || - test_bit(DMF_DELETING, &md->flags)) { + dm_deleting_md(md)) { md = NULL; goto out; } Index: linux-rhel5/drivers/md/dm.h =================================================================== --- linux-rhel5.orig/drivers/md/dm.h +++ linux-rhel5/drivers/md/dm.h @@ -79,6 +79,11 @@ static inline int array_too_big(unsigned int dm_split_args(int *argc, char ***argvp, char *input); /* + * Is this mapped_device being deleted? + */ +int dm_deleting_md(struct mapped_device *md); + +/* * The device-mapper can be driven through one of two interfaces; * ioctl or filesystem, depending which patch you have applied. */