Commit b42e24aa authored by Jan Kara's avatar Jan Kara Committed by Greg Kroah-Hartman

loop: Get rid of 'nested' acquisition of loop_ctl_mutex

commit c28445fa upstream.

The nested acquisition of loop_ctl_mutex (->lo_ctl_mutex back then) has
been introduced by commit f028f3b2 "loop: fix circular locking in
loop_clr_fd()" to fix lockdep complains about bd_mutex being acquired
after lo_ctl_mutex during partition rereading. Now that these are
properly fixed, let's stop fooling lockdep.
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5c684c25
...@@ -682,7 +682,7 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, ...@@ -682,7 +682,7 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
int error; int error;
bool partscan; bool partscan;
error = mutex_lock_killable_nested(&loop_ctl_mutex, 1); error = mutex_lock_killable(&loop_ctl_mutex);
if (error) if (error)
return error; return error;
error = -ENXIO; error = -ENXIO;
...@@ -920,7 +920,7 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, ...@@ -920,7 +920,7 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
if (!file) if (!file)
goto out; goto out;
error = mutex_lock_killable_nested(&loop_ctl_mutex, 1); error = mutex_lock_killable(&loop_ctl_mutex);
if (error) if (error)
goto out_putf; goto out_putf;
...@@ -1136,7 +1136,7 @@ static int loop_clr_fd(struct loop_device *lo) ...@@ -1136,7 +1136,7 @@ static int loop_clr_fd(struct loop_device *lo)
{ {
int err; int err;
err = mutex_lock_killable_nested(&loop_ctl_mutex, 1); err = mutex_lock_killable(&loop_ctl_mutex);
if (err) if (err)
return err; return err;
if (lo->lo_state != Lo_bound) { if (lo->lo_state != Lo_bound) {
...@@ -1173,7 +1173,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info) ...@@ -1173,7 +1173,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
struct block_device *bdev; struct block_device *bdev;
bool partscan = false; bool partscan = false;
err = mutex_lock_killable_nested(&loop_ctl_mutex, 1); err = mutex_lock_killable(&loop_ctl_mutex);
if (err) if (err)
return err; return err;
if (lo->lo_encrypt_key_size && if (lo->lo_encrypt_key_size &&
...@@ -1278,7 +1278,7 @@ loop_get_status(struct loop_device *lo, struct loop_info64 *info) ...@@ -1278,7 +1278,7 @@ loop_get_status(struct loop_device *lo, struct loop_info64 *info)
struct kstat stat; struct kstat stat;
int ret; int ret;
ret = mutex_lock_killable_nested(&loop_ctl_mutex, 1); ret = mutex_lock_killable(&loop_ctl_mutex);
if (ret) if (ret)
return ret; return ret;
if (lo->lo_state != Lo_bound) { if (lo->lo_state != Lo_bound) {
...@@ -1467,7 +1467,7 @@ static int lo_simple_ioctl(struct loop_device *lo, unsigned int cmd, ...@@ -1467,7 +1467,7 @@ static int lo_simple_ioctl(struct loop_device *lo, unsigned int cmd,
{ {
int err; int err;
err = mutex_lock_killable_nested(&loop_ctl_mutex, 1); err = mutex_lock_killable(&loop_ctl_mutex);
if (err) if (err)
return err; return err;
switch (cmd) { switch (cmd) {
......
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