dm table: log table creation error code
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>
Thu, 21 Oct 2021 21:13:27 +0000 (23:13 +0200)
committerMike Snitzer <snitzer@redhat.com>
Mon, 1 Nov 2021 17:28:52 +0000 (13:28 -0400)
Help debugging table creation errors by adding the error name in the log.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-table.c

index 2111daa..0175224 100644 (file)
@@ -706,7 +706,7 @@ int dm_table_add_target(struct dm_table *t, const char *type,
 
        r = dm_split_args(&argc, &argv, params);
        if (r) {
-               tgt->error = "couldn't split parameters (insufficient memory)";
+               tgt->error = "couldn't split parameters";
                goto bad;
        }
 
@@ -724,7 +724,7 @@ int dm_table_add_target(struct dm_table *t, const char *type,
        return 0;
 
  bad:
-       DMERR("%s: %s: %s", dm_device_name(t->md), type, tgt->error);
+       DMERR("%s: %s: %s (%pe)", dm_device_name(t->md), type, tgt->error, ERR_PTR(r));
        dm_put_target_type(tgt->type);
        return r;
 }