Commit ffcd7dca authored by Alexander Beregalov's avatar Alexander Beregalov Committed by Jens Axboe

loop: mutex already unlocked in loop_clr_fd()

mount/1865 is trying to release lock (&lo->lo_ctl_mutex) at:
but there are no more locks to release!

mutex is already unlocked in loop_clr_fd(), we should not
try to unlock it in lo_release() again.
Signed-off-by: default avatarAlexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent b029195d
...@@ -1431,6 +1431,7 @@ static int lo_open(struct block_device *bdev, fmode_t mode) ...@@ -1431,6 +1431,7 @@ static int lo_open(struct block_device *bdev, fmode_t mode)
static int lo_release(struct gendisk *disk, fmode_t mode) static int lo_release(struct gendisk *disk, fmode_t mode)
{ {
struct loop_device *lo = disk->private_data; struct loop_device *lo = disk->private_data;
int err;
mutex_lock(&lo->lo_ctl_mutex); mutex_lock(&lo->lo_ctl_mutex);
...@@ -1442,7 +1443,9 @@ static int lo_release(struct gendisk *disk, fmode_t mode) ...@@ -1442,7 +1443,9 @@ static int lo_release(struct gendisk *disk, fmode_t mode)
* In autoclear mode, stop the loop thread * In autoclear mode, stop the loop thread
* and remove configuration after last close. * and remove configuration after last close.
*/ */
loop_clr_fd(lo, NULL); err = loop_clr_fd(lo, NULL);
if (!err)
goto out_unlocked;
} else { } else {
/* /*
* Otherwise keep thread (if running) and config, * Otherwise keep thread (if running) and config,
...@@ -1453,7 +1456,7 @@ static int lo_release(struct gendisk *disk, fmode_t mode) ...@@ -1453,7 +1456,7 @@ static int lo_release(struct gendisk *disk, fmode_t mode)
out: out:
mutex_unlock(&lo->lo_ctl_mutex); mutex_unlock(&lo->lo_ctl_mutex);
out_unlocked:
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment