Skip to content

Commit

Permalink
bcache: more detailed error message to bcache_device_link()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Coly Li authored and Jens Axboe committed Jun 28, 2019
1 parent 383ff21 commit 4b6efb4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/md/bcache/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,16 +693,21 @@ 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);

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);
}
Expand Down

0 comments on commit 4b6efb4

Please sign in to comment.