mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 19:56:18 +00:00
dm delay: fix ctr error paths
Add missing 'dm_put_device' to dm-delay target constructor. Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: Milan Broz <mbroz@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
This commit is contained in:
parent
a72cf737e0
commit
2e64a0f928
1 changed files with 11 additions and 8 deletions
|
@ -163,34 +163,32 @@ static int delay_ctr(struct dm_target *ti, unsigned int argc, char **argv)
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc == 3) {
|
dc->dev_write = NULL;
|
||||||
dc->dev_write = NULL;
|
if (argc == 3)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
|
||||||
|
|
||||||
if (sscanf(argv[4], "%llu", &tmpll) != 1) {
|
if (sscanf(argv[4], "%llu", &tmpll) != 1) {
|
||||||
ti->error = "Invalid write device sector";
|
ti->error = "Invalid write device sector";
|
||||||
goto bad;
|
goto bad_dev_read;
|
||||||
}
|
}
|
||||||
dc->start_write = tmpll;
|
dc->start_write = tmpll;
|
||||||
|
|
||||||
if (sscanf(argv[5], "%u", &dc->write_delay) != 1) {
|
if (sscanf(argv[5], "%u", &dc->write_delay) != 1) {
|
||||||
ti->error = "Invalid write delay";
|
ti->error = "Invalid write delay";
|
||||||
goto bad;
|
goto bad_dev_read;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dm_get_device(ti, argv[3], dc->start_write, ti->len,
|
if (dm_get_device(ti, argv[3], dc->start_write, ti->len,
|
||||||
dm_table_get_mode(ti->table), &dc->dev_write)) {
|
dm_table_get_mode(ti->table), &dc->dev_write)) {
|
||||||
ti->error = "Write device lookup failed";
|
ti->error = "Write device lookup failed";
|
||||||
dm_put_device(ti, dc->dev_read);
|
goto bad_dev_read;
|
||||||
goto bad;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
dc->delayed_pool = mempool_create_slab_pool(128, delayed_cache);
|
dc->delayed_pool = mempool_create_slab_pool(128, delayed_cache);
|
||||||
if (!dc->delayed_pool) {
|
if (!dc->delayed_pool) {
|
||||||
DMERR("Couldn't create delayed bio pool.");
|
DMERR("Couldn't create delayed bio pool.");
|
||||||
goto bad;
|
goto bad_dev_write;
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_timer(&dc->delay_timer, handle_delayed_timer, (unsigned long)dc);
|
setup_timer(&dc->delay_timer, handle_delayed_timer, (unsigned long)dc);
|
||||||
|
@ -203,6 +201,11 @@ out:
|
||||||
ti->private = dc;
|
ti->private = dc;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
bad_dev_write:
|
||||||
|
if (dc->dev_write)
|
||||||
|
dm_put_device(ti, dc->dev_write);
|
||||||
|
bad_dev_read:
|
||||||
|
dm_put_device(ti, dc->dev_read);
|
||||||
bad:
|
bad:
|
||||||
kfree(dc);
|
kfree(dc);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Loading…
Reference in a new issue