diff options
author | Vivek Goyal <vgoyal@redhat.com> | 2015-07-31 09:20:36 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2015-08-12 11:32:21 -0400 |
commit | e80d1c805a3b2f0ad2081369be5dc5deedd5ee59 (patch) | |
tree | 9e1044dc46f00ac0e2c34f92c6c10189c89f0ce9 /drivers/md/dm-log-writes.c | |
parent | ab37844d6169c2dd6f96e665b07b692ba1a4c180 (diff) | |
download | op-kernel-dev-e80d1c805a3b2f0ad2081369be5dc5deedd5ee59.zip op-kernel-dev-e80d1c805a3b2f0ad2081369be5dc5deedd5ee59.tar.gz |
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-log-writes.c')
-rw-r--r-- | drivers/md/dm-log-writes.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/md/dm-log-writes.c b/drivers/md/dm-log-writes.c index ad1b049..51d29b6 100644 --- a/drivers/md/dm-log-writes.c +++ b/drivers/md/dm-log-writes.c @@ -420,6 +420,7 @@ static int log_writes_ctr(struct dm_target *ti, unsigned int argc, char **argv) struct log_writes_c *lc; struct dm_arg_set as; const char *devname, *logdevname; + int ret; as.argc = argc; as.argv = argv; @@ -443,18 +444,22 @@ static int log_writes_ctr(struct dm_target *ti, unsigned int argc, char **argv) atomic_set(&lc->pending_blocks, 0); devname = dm_shift_arg(&as); - if (dm_get_device(ti, devname, dm_table_get_mode(ti->table), &lc->dev)) { + ret = dm_get_device(ti, devname, dm_table_get_mode(ti->table), &lc->dev); + if (ret) { ti->error = "Device lookup failed"; goto bad; } logdevname = dm_shift_arg(&as); - if (dm_get_device(ti, logdevname, dm_table_get_mode(ti->table), &lc->logdev)) { + ret = dm_get_device(ti, logdevname, dm_table_get_mode(ti->table), + &lc->logdev); + if (ret) { ti->error = "Log device lookup failed"; dm_put_device(ti, lc->dev); goto bad; } + ret = -EINVAL; lc->log_kthread = kthread_run(log_writes_kthread, lc, "log-write"); if (!lc->log_kthread) { ti->error = "Couldn't alloc kthread"; @@ -479,7 +484,7 @@ static int log_writes_ctr(struct dm_target *ti, unsigned int argc, char **argv) bad: kfree(lc); - return -EINVAL; + return ret; } static int log_mark(struct log_writes_c *lc, char *data) |