aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/loop.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/loop.c')
-rw-r--r--drivers/block/loop.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 40b17d3b55a1..ddae80825899 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1431,6 +1431,7 @@ static int lo_open(struct block_device *bdev, fmode_t mode)
1431static int lo_release(struct gendisk *disk, fmode_t mode) 1431static int lo_release(struct gendisk *disk, fmode_t mode)
1432{ 1432{
1433 struct loop_device *lo = disk->private_data; 1433 struct loop_device *lo = disk->private_data;
1434 int err;
1434 1435
1435 mutex_lock(&lo->lo_ctl_mutex); 1436 mutex_lock(&lo->lo_ctl_mutex);
1436 1437
@@ -1442,7 +1443,9 @@ static int lo_release(struct gendisk *disk, fmode_t mode)
1442 * In autoclear mode, stop the loop thread 1443 * In autoclear mode, stop the loop thread
1443 * and remove configuration after last close. 1444 * and remove configuration after last close.
1444 */ 1445 */
1445 loop_clr_fd(lo, NULL); 1446 err = loop_clr_fd(lo, NULL);
1447 if (!err)
1448 goto out_unlocked;
1446 } else { 1449 } else {
1447 /* 1450 /*
1448 * Otherwise keep thread (if running) and config, 1451 * Otherwise keep thread (if running) and config,
@@ -1453,7 +1456,7 @@ static int lo_release(struct gendisk *disk, fmode_t mode)
1453 1456
1454out: 1457out:
1455 mutex_unlock(&lo->lo_ctl_mutex); 1458 mutex_unlock(&lo->lo_ctl_mutex);
1456 1459out_unlocked:
1457 return 0; 1460 return 0;
1458} 1461}
1459 1462