mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] loop setup calling bd_set_size too soon
@ 2004-03-29 16:48 Chris Mason
  0 siblings, 0 replies; only message in thread
From: Chris Mason @ 2004-03-29 16:48 UTC (permalink / raw)
  To: akpm, linux-kernel

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);
 





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-03-29 17:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-29 16:48 [PATCH] loop setup calling bd_set_size too soon Chris Mason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®