From e0faa3d7f79f7e1abb43de168e88c76061518ea4 Mon Sep 17 00:00:00 2001
From: Coly Li <colyli@suse.de>
Date: Fri, 28 Jun 2019 19:59:39 +0800
Subject: [PATCH] bcache: improve error message in bch_cached_dev_run()
Git-commit: e0faa3d7f79f7e1abb43de168e88c76061518ea4
References: bsc#1140652
Patch-mainline: v5.3-rc1
This patch adds more error message in bch_cached_dev_run() to indicate
the exact reason why an error value is returned. Please notice when
printing out the "is running already" message, pr_info() is used here,
because in this case also -EBUSY is returned, the bcache device can
continue to attach to the cache devince and run, so it won't be an
error level message in kernel message.
Signed-off-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
drivers/md/bcache/super.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -929,8 +929,11 @@ int bch_cached_dev_run(struct cached_dev
NULL,
};
- if (dc->io_disable)
+ if (dc->io_disable) {
+ pr_err("I/O disabled on cached dev %s",
+ dc->backing_dev_name);
return -EIO;
+ }
memcpy(buf, dc->sb.label, SB_LABEL_SIZE);
buf[SB_LABEL_SIZE] = '\0';
@@ -939,6 +942,8 @@ int bch_cached_dev_run(struct cached_dev
if (atomic_xchg(&dc->running, 1)) {
kfree(env[1]);
kfree(env[2]);
+ pr_info("cached dev %s is running already",
+ dc->backing_dev_name);
return -EBUSY;
}
@@ -966,7 +971,7 @@ int bch_cached_dev_run(struct cached_dev
if (sysfs_create_link(&d->kobj, &disk_to_dev(d->disk)->kobj, "dev") ||
sysfs_create_link(&disk_to_dev(d->disk)->kobj,
&d->kobj, "bcache")) {
- pr_debug("error creating sysfs link");
+ pr_err("Couldn't create bcache dev <-> disk sysfs symlinks");
return -ENOMEM;
}