Commit 840d5d40 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] loop setup calling bd_set_size too soon

From: Chris Mason <mason@suse.com>

I think Andrew and I managed to mismerge the loop setup race fix. 
loop_set_fd is using get_capacity() to read the size of the disk and
sending that to bd_set_size.

But, it is doing this before calling set_capacity, so the size being used
is wrong.  This should clean things up.
parent 56d93842
......@@ -677,7 +677,6 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
lo->transfer = NULL;
lo->ioctl = NULL;
lo->lo_sizelimit = 0;
bd_set_size(bdev,(loff_t)get_capacity(disks[lo->lo_number])<<9);
lo->old_gfp_mask = mapping_gfp_mask(mapping);
mapping_set_gfp_mask(mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS));
......@@ -691,6 +690,7 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
lo->lo_queue->queuedata = lo;
set_capacity(disks[lo->lo_number], size);
bd_set_size(bdev, size << 9);
set_blocksize(bdev, lo_blocksize);
......
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