1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

o dm_add_target was returning 0 an error when it shouldn't

o reference count was being checked badly
This commit is contained in:
Joe Thornber 2001-08-23 16:45:43 +00:00
parent 3cf3ab579e
commit 95d3ba14eb
2 changed files with 4 additions and 5 deletions

View File

@ -25,8 +25,6 @@
#include "dm.h" #include "dm.h"
#include <linux/ctype.h>
static struct target *_targets; static struct target *_targets;
static spinlock_t _lock = SPIN_LOCK_UNLOCKED; static spinlock_t _lock = SPIN_LOCK_UNLOCKED;
@ -45,6 +43,7 @@ struct target *dm_get_target(const char *name)
spin_lock(&_lock); spin_lock(&_lock);
t = __get_target(name); t = __get_target(name);
spin_unlock(&_lock); spin_unlock(&_lock);
return t; return t;
} }
@ -153,9 +152,9 @@ int linear_ctr(offset_t low, offset_t high, struct mapped_device *md,
lc->dev = MKDEV((int) major, (int) minor); lc->dev = MKDEV((int) major, (int) minor);
lc->offset = (int) start - (int) low; lc->offset = (int) start - (int) low;
if (!dm_add_device(md, lc->dev)) { if ((r = dm_add_device(md, lc->dev))) {
kfree(lc); kfree(lc);
return 0; return r;
} }
*result = lc; *result = lc;

View File

@ -232,7 +232,7 @@ static int blk_close(struct inode *inode, struct file *file)
wl; wl;
md = _devs[minor]; md = _devs[minor];
if (!md || md->use_count <= 1) { if (!md || md->use_count < 1) {
WARN("reference count in mapped_device incorrect"); WARN("reference count in mapped_device incorrect");
wu; wu;
return -ENXIO; return -ENXIO;