[PATCH 3.19.y-ckt 061/210] bcache: allows use of register in udev to avoid "device_busy" error.

From: Kamal Mostafa
Date: Thu Jan 28 2016 - 21:05:43 EST

3.19.8-ckt14 -stable review patch. If anyone has any objections, please let me know.


From: Gabriel de Perthuis <g2p.code@xxxxxxxxx>

commit d7076f21629f8f329bca4a44dc408d94670f49e2 upstream.

Allows to use register, not register_quiet in udev to avoid "device_busy" error.
The initial patch proposed at https://lkml.org/lkml/2013/8/26/549 by Gabriel de Perthuis
<g2p.code@xxxxxxxxx> does not unlock the mutex and hangs the kernel.

See http://thread.gmane.org/gmane.linux.kernel.bcache.devel/2594 for the discussion.

Cc: Denis Bychkov <manover@xxxxxxxxx>
Cc: Kent Overstreet <kent.overstreet@xxxxxxxxx>
Cc: Eric Wheeler <bcache@xxxxxxxxxxxxxxxxxx>
Cc: Gabriel de Perthuis <g2p.code@xxxxxxxxx>

Signed-off-by: Jens Axboe <axboe@xxxxxx>
Signed-off-by: Kamal Mostafa <kamal@xxxxxxxxxxxxx>
drivers/md/bcache/super.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 53f1512..42522c8 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1972,6 +1972,8 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,
err = "device busy";
+ if (attr == &ksysfs_register_quiet)
+ goto out;
goto err;
@@ -2010,8 +2012,7 @@ out:
- if (attr != &ksysfs_register_quiet)
- pr_info("error opening %s: %s", path, err);
+ pr_info("error opening %s: %s", path, err);
ret = -EINVAL;
goto out;