aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-flakey.c
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@redhat.com>2015-07-31 09:20:36 -0400
committerMike Snitzer <snitzer@redhat.com>2015-08-12 11:32:21 -0400
commite80d1c805a3b2f0ad2081369be5dc5deedd5ee59 (patch)
tree9e1044dc46f00ac0e2c34f92c6c10189c89f0ce9 /drivers/md/dm-flakey.c
parentab37844d6169c2dd6f96e665b07b692ba1a4c180 (diff)
dm: do not override error code returned from dm_get_device()
Some of the device mapper targets override the error code returned by dm_get_device() and return either -EINVAL or -ENXIO. There is nothing gained by this override. It is better to propagate the returned error code unchanged to caller. This work was motivated by hitting an issue where the underlying device was busy but -EINVAL was being returned. After this change we get -EBUSY instead and it is easier to figure out the problem. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-flakey.c')
-rw-r--r--drivers/md/dm-flakey.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c
index b257e46876d3..ffb994527bcf 100644
--- a/drivers/md/dm-flakey.c
+++ b/drivers/md/dm-flakey.c
@@ -183,6 +183,7 @@ static int flakey_ctr(struct dm_target *ti, unsigned int argc, char **argv)
183 183
184 devname = dm_shift_arg(&as); 184 devname = dm_shift_arg(&as);
185 185
186 r = -EINVAL;
186 if (sscanf(dm_shift_arg(&as), "%llu%c", &tmpll, &dummy) != 1) { 187 if (sscanf(dm_shift_arg(&as), "%llu%c", &tmpll, &dummy) != 1) {
187 ti->error = "Invalid device sector"; 188 ti->error = "Invalid device sector";
188 goto bad; 189 goto bad;
@@ -211,7 +212,8 @@ static int flakey_ctr(struct dm_target *ti, unsigned int argc, char **argv)
211 if (r) 212 if (r)
212 goto bad; 213 goto bad;
213 214
214 if (dm_get_device(ti, devname, dm_table_get_mode(ti->table), &fc->dev)) { 215 r = dm_get_device(ti, devname, dm_table_get_mode(ti->table), &fc->dev);
216 if (r) {
215 ti->error = "Device lookup failed"; 217 ti->error = "Device lookup failed";
216 goto bad; 218 goto bad;
217 } 219 }
@@ -224,7 +226,7 @@ static int flakey_ctr(struct dm_target *ti, unsigned int argc, char **argv)
224 226
225bad: 227bad:
226 kfree(fc); 228 kfree(fc);
227 return -EINVAL; 229 return r;
228} 230}
229 231
230static void flakey_dtr(struct dm_target *ti) 232static void flakey_dtr(struct dm_target *ti)