summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-thin.c
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2012-07-27 15:07:59 +0100
committerAlasdair G Kergon <agk@redhat.com>2012-07-27 15:07:59 +0100
commitf09996c993e256fce4b920588959866998d51250 (patch)
tree462169f8d08cdac6960db32bf6307068630f634e /drivers/md/dm-thin.c
parent1a66a08ae82b16eb40705ad112ff28873981af92 (diff)
downloadop-kernel-dev-f09996c993e256fce4b920588959866998d51250.zip
op-kernel-dev-f09996c993e256fce4b920588959866998d51250.tar.gz
dm thin: provide specific errors for two table load failure cases
Provide specific error message strings for two pool_ctr() failure cases that currently give just "Unknown error". Reference: test_two_pools_pointing_to_the_same_metadata_fails and test_different_pool_cant_replace_pool in thinp-test-suite. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-thin.c')
-rw-r--r--drivers/md/dm-thin.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 0bb9e64..e89f8e7 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -1828,15 +1828,19 @@ static struct pool *__pool_find(struct mapped_device *pool_md,
struct pool *pool = __pool_table_lookup_metadata_dev(metadata_dev);
if (pool) {
- if (pool->pool_md != pool_md)
+ if (pool->pool_md != pool_md) {
+ *error = "metadata device already in use by a pool";
return ERR_PTR(-EBUSY);
+ }
__pool_inc(pool);
} else {
pool = __pool_table_lookup(pool_md);
if (pool) {
- if (pool->md_dev != metadata_dev)
+ if (pool->md_dev != metadata_dev) {
+ *error = "different pool cannot replace a pool";
return ERR_PTR(-EINVAL);
+ }
__pool_inc(pool);
} else {
OpenPOWER on IntegriCloud