From: Gabriel de Perthuis Date: Mon, 30 Nov 2015 02:40:23 +0000 (-0800) Subject: bcache: allows use of register in udev to avoid "device_busy" error. X-Git-Tag: v4.1.12-92~150^2~315 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=01a3218cde197e2f8659c86ab989973b87da0c89;p=users%2Fjedix%2Flinux-maple.git bcache: allows use of register in udev to avoid "device_busy" error. Orabug: 23330612 [ Upstream commit d7076f21629f8f329bca4a44dc408d94670f49e2 ] 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 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 Cc: Kent Overstreet Cc: Eric Wheeler Cc: Gabriel de Perthuis Cc: stable@vger.kernel.org Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin (cherry picked from commit d5402134c27d66e83295ae2961772b89bc6a50bc) Signed-off-by: Dan Duval --- diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 53f15126182a..42522c8f13c6 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, else err = "device busy"; mutex_unlock(&bch_register_lock); + if (attr == &ksysfs_register_quiet) + goto out; } goto err; } @@ -2010,8 +2012,7 @@ out: err_close: blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL); err: - 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; }