Skip to content

Commit

Permalink
loop: mutex already unlocked in loop_clr_fd()
Browse files Browse the repository at this point in the history
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: Alexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
  • Loading branch information
Alexander Beregalov authored and Jens Axboe committed Apr 7, 2009
1 parent b029195 commit ffcd7dc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/block/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
struct loop_device *lo = disk->private_data;
int err;

mutex_lock(&lo->lo_ctl_mutex);

Expand All @@ -1442,7 +1443,9 @@ static int lo_release(struct gendisk *disk, fmode_t mode)
* In autoclear mode, stop the loop thread
* and remove configuration after last close.
*/
loop_clr_fd(lo, NULL);
err = loop_clr_fd(lo, NULL);
if (!err)
goto out_unlocked;
} else {
/*
* Otherwise keep thread (if running) and config,
Expand All @@ -1453,7 +1456,7 @@ static int lo_release(struct gendisk *disk, fmode_t mode)

out:
mutex_unlock(&lo->lo_ctl_mutex);

out_unlocked:
return 0;
}

Expand Down

0 comments on commit ffcd7dc

Please sign in to comment.