Commit e5c5b8ed authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Revert "loop: Fold __loop_release into loop_release"

This reverts commit 7d839c10 which is
commit 967d1dc1 upstream.

It does not work properly in the 4.9.y tree and causes more problems
than it fixes, so revert it.
Reported-by: default avatarThomas Lindroth <thomas.lindroth@gmail.com>
Reported-by: default avatarJan Kara <jack@suse.cz>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c6ae51ad
...@@ -1575,15 +1575,12 @@ static int lo_open(struct block_device *bdev, fmode_t mode) ...@@ -1575,15 +1575,12 @@ static int lo_open(struct block_device *bdev, fmode_t mode)
return err; return err;
} }
static void lo_release(struct gendisk *disk, fmode_t mode) static void __lo_release(struct loop_device *lo)
{ {
struct loop_device *lo;
int err; int err;
mutex_lock(&loop_index_mutex);
lo = disk->private_data;
if (atomic_dec_return(&lo->lo_refcnt)) if (atomic_dec_return(&lo->lo_refcnt))
goto unlock_index; return;
mutex_lock(&loop_ctl_mutex); mutex_lock(&loop_ctl_mutex);
if (lo->lo_flags & LO_FLAGS_AUTOCLEAR) { if (lo->lo_flags & LO_FLAGS_AUTOCLEAR) {
...@@ -1593,7 +1590,7 @@ static void lo_release(struct gendisk *disk, fmode_t mode) ...@@ -1593,7 +1590,7 @@ static void lo_release(struct gendisk *disk, fmode_t mode)
*/ */
err = loop_clr_fd(lo); err = loop_clr_fd(lo);
if (!err) if (!err)
goto unlock_index; return;
} else { } else {
/* /*
* Otherwise keep thread (if running) and config, * Otherwise keep thread (if running) and config,
...@@ -1603,7 +1600,12 @@ static void lo_release(struct gendisk *disk, fmode_t mode) ...@@ -1603,7 +1600,12 @@ static void lo_release(struct gendisk *disk, fmode_t mode)
} }
mutex_unlock(&loop_ctl_mutex); mutex_unlock(&loop_ctl_mutex);
unlock_index: }
static void lo_release(struct gendisk *disk, fmode_t mode)
{
mutex_lock(&loop_index_mutex);
__lo_release(disk->private_data);
mutex_unlock(&loop_index_mutex); mutex_unlock(&loop_index_mutex);
} }
......
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