[PATCH] loop setup calling bd_set_size too soon

From: Chris Mason
Date: Mon Mar 29 2004 - 12:18:43 EST


Hello,

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:

Index: linux.t/drivers/block/loop.c
===================================================================
--- linux.t.orig/drivers/block/loop.c 2004-03-29 10:47:07.809522824 -0500
+++ linux.t/drivers/block/loop.c 2004-03-29 10:53:24.376275976 -0500
@@ -687,7 +687,6 @@ static int loop_set_fd(struct loop_devic
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));

@@ -702,6 +701,7 @@ static int loop_set_fd(struct loop_devic
lo->lo_queue->unplug_fn = loop_unplug;

set_capacity(disks[lo->lo_number], size);
+ bd_set_size(bdev, size << 9);

set_blocksize(bdev, lo_blocksize);





-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/