diff options
Diffstat (limited to 'drivers/block/loop.c')
-rw-r--r-- | drivers/block/loop.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index b8af22e610df..91ebb007416c 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -973,6 +973,10 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info) | |||
973 | lo->transfer = xfer->transfer; | 973 | lo->transfer = xfer->transfer; |
974 | lo->ioctl = xfer->ioctl; | 974 | lo->ioctl = xfer->ioctl; |
975 | 975 | ||
976 | if ((lo->lo_flags & LO_FLAGS_AUTOCLEAR) != | ||
977 | (info->lo_flags & LO_FLAGS_AUTOCLEAR)) | ||
978 | lo->lo_flags ^= LO_FLAGS_AUTOCLEAR; | ||
979 | |||
976 | lo->lo_encrypt_key_size = info->lo_encrypt_key_size; | 980 | lo->lo_encrypt_key_size = info->lo_encrypt_key_size; |
977 | lo->lo_init[0] = info->lo_init[0]; | 981 | lo->lo_init[0] = info->lo_init[0]; |
978 | lo->lo_init[1] = info->lo_init[1]; | 982 | lo->lo_init[1] = info->lo_init[1]; |
@@ -1331,6 +1335,10 @@ static int lo_release(struct inode *inode, struct file *file) | |||
1331 | 1335 | ||
1332 | mutex_lock(&lo->lo_ctl_mutex); | 1336 | mutex_lock(&lo->lo_ctl_mutex); |
1333 | --lo->lo_refcnt; | 1337 | --lo->lo_refcnt; |
1338 | |||
1339 | if ((lo->lo_flags & LO_FLAGS_AUTOCLEAR) && !lo->lo_refcnt) | ||
1340 | loop_clr_fd(lo, inode->i_bdev); | ||
1341 | |||
1334 | mutex_unlock(&lo->lo_ctl_mutex); | 1342 | mutex_unlock(&lo->lo_ctl_mutex); |
1335 | 1343 | ||
1336 | return 0; | 1344 | return 0; |