aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorDmitry Monakhov <dmonakhov@openvz.org>2007-10-19 17:38:41 -0400
committerAlasdair G Kergon <agk@redhat.com>2007-10-19 21:01:02 -0400
commit2e64a0f92830791f160274c46aef3678fabcf044 (patch)
tree9ca6464cf43743f8651c7e3303401188fc6cf6f6 /drivers/md
parenta72cf737e09da409e047863e38410930dae5fe05 (diff)
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>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-delay.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c
index 6928c136d3c5..0fd1f7c2e162 100644
--- a/drivers/md/dm-delay.c
+++ b/drivers/md/dm-delay.c
@@ -163,34 +163,32 @@ static int delay_ctr(struct dm_target *ti, unsigned int argc, char **argv)
163 goto bad; 163 goto bad;
164 } 164 }
165 165
166 if (argc == 3) { 166 dc->dev_write = NULL;
167 dc->dev_write = NULL; 167 if (argc == 3)
168 goto out; 168 goto out;
169 }
170 169
171 if (sscanf(argv[4], "%llu", &tmpll) != 1) { 170 if (sscanf(argv[4], "%llu", &tmpll) != 1) {
172 ti->error = "Invalid write device sector"; 171 ti->error = "Invalid write device sector";
173 goto bad; 172 goto bad_dev_read;
174 } 173 }
175 dc->start_write = tmpll; 174 dc->start_write = tmpll;
176 175
177 if (sscanf(argv[5], "%u", &dc->write_delay) != 1) { 176 if (sscanf(argv[5], "%u", &dc->write_delay) != 1) {
178 ti->error = "Invalid write delay"; 177 ti->error = "Invalid write delay";
179 goto bad; 178 goto bad_dev_read;
180 } 179 }
181 180
182 if (dm_get_device(ti, argv[3], dc->start_write, ti->len, 181 if (dm_get_device(ti, argv[3], dc->start_write, ti->len,
183 dm_table_get_mode(ti->table), &dc->dev_write)) { 182 dm_table_get_mode(ti->table), &dc->dev_write)) {
184 ti->error = "Write device lookup failed"; 183 ti->error = "Write device lookup failed";
185 dm_put_device(ti, dc->dev_read); 184 goto bad_dev_read;
186 goto bad;
187 } 185 }
188 186
189out: 187out:
190 dc->delayed_pool = mempool_create_slab_pool(128, delayed_cache); 188 dc->delayed_pool = mempool_create_slab_pool(128, delayed_cache);
191 if (!dc->delayed_pool) { 189 if (!dc->delayed_pool) {
192 DMERR("Couldn't create delayed bio pool."); 190 DMERR("Couldn't create delayed bio pool.");
193 goto bad; 191 goto bad_dev_write;
194 } 192 }
195 193
196 setup_timer(&dc->delay_timer, handle_delayed_timer, (unsigned long)dc); 194 setup_timer(&dc->delay_timer, handle_delayed_timer, (unsigned long)dc);
@@ -203,6 +201,11 @@ out:
203 ti->private = dc; 201 ti->private = dc;
204 return 0; 202 return 0;
205 203
204bad_dev_write:
205 if (dc->dev_write)
206 dm_put_device(ti, dc->dev_write);
207bad_dev_read:
208 dm_put_device(ti, dc->dev_read);
206bad: 209bad:
207 kfree(dc); 210 kfree(dc);
208 return -EINVAL; 211 return -EINVAL;