public inbox for linux-bcache@vger.kernel.org
 help / color / mirror / Atom feed
From: Gabriel de Perthuis <g2p.code-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Kent Overstreet <kmo-PEzghdH756F8UrSeD/g0lQ@public.gmane.org>,
	linux-bcache-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Gabriel de Perthuis <g2p.code-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCH] bcache: Downgrade "device already registered" to pr_debug
Date: Mon, 26 Aug 2013 18:54:10 +0200	[thread overview]
Message-ID: <1377536050-22925-1-git-send-email-g2p.code@gmail.com> (raw)
In-Reply-To: <kvfvst$j12$2@ger.gmane.org>

People tended to see:

    (info) bcache: register_bcache() error opening /dev/blah: device already registered

as more problematic than it really is.  Change it to:

    (debug) bcache: register_bcache() device /dev/blah is already registered

and don't return -EINVAL in this case.

Signed-off-by: Gabriel de Perthuis <g2p.code-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/md/bcache/super.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index a41c681..b09e973 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1894,21 +1894,24 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,
 
 	if (!(path = kstrndup(buffer, size, GFP_KERNEL)) ||
 	    !(sb = kmalloc(sizeof(struct cache_sb), GFP_KERNEL)))
 		goto err;
 
-	err = "failed to open device";
 	bdev = blkdev_get_by_path(strim(path),
 				  FMODE_READ|FMODE_WRITE|FMODE_EXCL,
 				  sb);
 	if (IS_ERR(bdev)) {
 		if (bdev == ERR_PTR(-EBUSY)) {
 			bdev = lookup_bdev(strim(path));
-			if (!IS_ERR(bdev) && bch_is_open(bdev))
-				err = "device already registered";
-			else
-				err = "device busy";
+			if (!IS_ERR(bdev) && bch_is_open(bdev)) {
+				pr_debug("device %s is already registered",
+					 path);
+				goto out;
+			}
+			err = "device busy";
+		} else {
+			err = "failed to open device";
 		}
 		goto err;
 	}
 
 	err = "failed to set blocksize";
-- 
1.8.4.rc0.5.g48765cc

  reply	other threads:[~2013-08-26 16:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-26  9:14 bcache-tools: minor change for bcache-register Rolf Fokkens
     [not found] ` <521B1C5E.2090007-6w2rdlBuEQTpMFipWq+H6g@public.gmane.org>
2013-08-26 16:17   ` Darrick J. Wong
2013-08-26 16:31     ` Gabriel de Perthuis
2013-08-26 16:54       ` Gabriel de Perthuis [this message]
2013-08-26 21:48       ` Kent Overstreet
2013-08-26 22:16         ` Gabriel de Perthuis
     [not found]           ` <521BD3C0.9070209-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-08-26 22:31             ` [PATCH] bcache: register_quiet should still report errors Gabriel de Perthuis
     [not found]               ` <1377556306-29938-1-git-send-email-g2p.code-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-08-26 22:37                 ` Gabriel de Perthuis
2013-08-26 21:41   ` bcache-tools: minor change for bcache-register Kent Overstreet
2013-08-27  6:58     ` Rolf Fokkens
     [not found]       ` <521C4E2B.8090008-6w2rdlBuEQTpMFipWq+H6g@public.gmane.org>
2013-08-27 10:00         ` Alex Pyrgiotis
2013-08-27 11:45           ` Gabriel de Perthuis
2013-08-27 12:02             ` Rolf Fokkens
     [not found]               ` <521C9560.2020603-6w2rdlBuEQTpMFipWq+H6g@public.gmane.org>
2013-08-27 12:11                 ` Gabriel de Perthuis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1377536050-22925-1-git-send-email-g2p.code@gmail.com \
    --to=g2p.code-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=kmo-PEzghdH756F8UrSeD/g0lQ@public.gmane.org \
    --cc=linux-bcache-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox