mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
Revert "loop: Fold __loop_release into loop_release"
This reverts commitf1e81ba8a3which is commit967d1dc144upstream. It does not work properly in the 4.14.y tree and causes more problems than it fixes, so revert it. Reported-by: Thomas Lindroth <thomas.lindroth@gmail.com> Reported-by: Jan Kara <jack@suse.cz> Cc: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
@@ -1634,15 +1634,12 @@ out:
|
||||
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;
|
||||
|
||||
mutex_lock(&loop_index_mutex);
|
||||
lo = disk->private_data;
|
||||
if (atomic_dec_return(&lo->lo_refcnt))
|
||||
goto unlock_index;
|
||||
return;
|
||||
|
||||
mutex_lock(&loop_ctl_mutex);
|
||||
if (lo->lo_flags & LO_FLAGS_AUTOCLEAR) {
|
||||
@@ -1652,7 +1649,7 @@ static void lo_release(struct gendisk *disk, fmode_t mode)
|
||||
*/
|
||||
err = loop_clr_fd(lo);
|
||||
if (!err)
|
||||
goto unlock_index;
|
||||
return;
|
||||
} else if (lo->lo_state == Lo_bound) {
|
||||
/*
|
||||
* Otherwise keep thread (if running) and config,
|
||||
@@ -1663,7 +1660,12 @@ static void lo_release(struct gendisk *disk, fmode_t mode)
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user