bcache: more detailed error message to bcache_device_link()
authorColy Li <colyli@suse.de>
Fri, 28 Jun 2019 11:59:37 +0000 (19:59 +0800)
committerJens Axboe <axboe@kernel.dk>
Fri, 28 Jun 2019 13:39:15 +0000 (07:39 -0600)
This patch adds more accurate error message for specific
ssyfs_create_link() call, to help debugging failure during
bcache device start tup.

Signed-off-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/bcache/super.c

index 0abee44092bfaa7164f235ba0b5cc66bfb38cae4..d4d8d1300fafad13547578538214f35815045534 100644 (file)
@@ -693,6 +693,7 @@ static void bcache_device_link(struct bcache_device *d, struct cache_set *c,
 {
        unsigned int i;
        struct cache *ca;
+       int ret;
 
        for_each_cache(ca, d->c, i)
                bd_link_disk_holder(ca->bdev, d->disk);
@@ -700,9 +701,13 @@ static void bcache_device_link(struct bcache_device *d, struct cache_set *c,
        snprintf(d->name, BCACHEDEVNAME_SIZE,
                 "%s%u", name, d->id);
 
-       WARN(sysfs_create_link(&d->kobj, &c->kobj, "cache") ||
-            sysfs_create_link(&c->kobj, &d->kobj, d->name),
-            "Couldn't create device <-> cache set symlinks");
+       ret = sysfs_create_link(&d->kobj, &c->kobj, "cache");
+       if (ret < 0)
+               pr_err("Couldn't create device -> cache set symlink");
+
+       ret = sysfs_create_link(&c->kobj, &d->kobj, d->name);
+       if (ret < 0)
+               pr_err("Couldn't create cache set -> device symlink");
 
        clear_bit(BCACHE_DEV_UNLINK_DONE, &d->flags);
 }