lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1377536050-22925-1-git-send-email-g2p.code@gmail.com>
Date:	Mon, 26 Aug 2013 18:54:10 +0200
From:	Gabriel de Perthuis <g2p.code@...il.com>
To:	Kent Overstreet <kmo@...erainc.com>, linux-bcache@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc:	Gabriel de Perthuis <g2p.code@...il.com>
Subject: [PATCH] bcache: Downgrade "device already registered" to pr_debug

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@...il.com>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ