diff options
Diffstat (limited to 'drivers/block/loop.c')
-rw-r--r-- | drivers/block/loop.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index e87b88731adc..68b0471ad5a6 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -820,13 +820,22 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file, | |||
820 | lo->lo_number); | 820 | lo->lo_number); |
821 | if (IS_ERR(lo->lo_thread)) { | 821 | if (IS_ERR(lo->lo_thread)) { |
822 | error = PTR_ERR(lo->lo_thread); | 822 | error = PTR_ERR(lo->lo_thread); |
823 | lo->lo_thread = NULL; | 823 | goto out_clr; |
824 | goto out_putf; | ||
825 | } | 824 | } |
826 | lo->lo_state = Lo_bound; | 825 | lo->lo_state = Lo_bound; |
827 | wake_up_process(lo->lo_thread); | 826 | wake_up_process(lo->lo_thread); |
828 | return 0; | 827 | return 0; |
829 | 828 | ||
829 | out_clr: | ||
830 | lo->lo_thread = NULL; | ||
831 | lo->lo_device = NULL; | ||
832 | lo->lo_backing_file = NULL; | ||
833 | lo->lo_flags = 0; | ||
834 | set_capacity(disks[lo->lo_number], 0); | ||
835 | invalidate_bdev(bdev, 0); | ||
836 | bd_set_size(bdev, 0); | ||
837 | mapping_set_gfp_mask(mapping, lo->old_gfp_mask); | ||
838 | lo->lo_state = Lo_unbound; | ||
830 | out_putf: | 839 | out_putf: |
831 | fput(file); | 840 | fput(file); |
832 | out: | 841 | out: |