mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +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:
parent
3cf3ab579e
commit
95d3ba14eb
@ -25,8 +25,6 @@
|
||||
|
||||
#include "dm.h"
|
||||
|
||||
#include <linux/ctype.h>
|
||||
|
||||
static struct target *_targets;
|
||||
static spinlock_t _lock = SPIN_LOCK_UNLOCKED;
|
||||
|
||||
@ -45,6 +43,7 @@ struct target *dm_get_target(const char *name)
|
||||
spin_lock(&_lock);
|
||||
t = __get_target(name);
|
||||
spin_unlock(&_lock);
|
||||
|
||||
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->offset = (int) start - (int) low;
|
||||
|
||||
if (!dm_add_device(md, lc->dev)) {
|
||||
if ((r = dm_add_device(md, lc->dev))) {
|
||||
kfree(lc);
|
||||
return 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
*result = lc;
|
||||
|
@ -232,7 +232,7 @@ static int blk_close(struct inode *inode, struct file *file)
|
||||
|
||||
wl;
|
||||
md = _devs[minor];
|
||||
if (!md || md->use_count <= 1) {
|
||||
if (!md || md->use_count < 1) {
|
||||
WARN("reference count in mapped_device incorrect");
|
||||
wu;
|
||||
return -ENXIO;
|
||||
|
Loading…
x
Reference in New Issue
Block a user