Good morning, I've been testing md under UML. It appears that UML is exposing a minor bug in md.c: it is trying to use information about the device (in particular, blk_sizes[]) before having imported it (which calls lock_dev() and thus makes the information available in the first place). This was exposed because UML resets the blk_sizes[] information to zero on ubd_release(). Working patch attached; it just reorders the function calls. Please apply to 2.4 if appropriate. Sincerely, Lars Marowsky-Brée <lmb@suse.de> -- Principal Squirrel SuSE Labs - Research & Development, SuSE Linux AG "If anything can go wrong, it will." "Chance favors the prepared (mind)." -- Capt. Edward A. Murphy -- Louis Pasteur
--- md.c~ Tue Mar 11 15:21:11 2003 +++ md.c Tue Mar 11 16:54:22 2003 @@ -2456,13 +2456,6 @@ } persistent = !mddev->sb->not_persistent; - size = calc_dev_size(dev, mddev, persistent); - - if (size < mddev->sb->size) { - printk(KERN_WARNING "md%d: disk size %d blocks < array size %d\n", - mdidx(mddev), size, mddev->sb->size); - return -ENOSPC; - } rdev = find_rdev(mddev, dev); if (rdev) @@ -2473,6 +2466,7 @@ printk(KERN_WARNING "md: error, md_import_device() returned %d\n", err); return -EINVAL; } + rdev = find_rdev_all(dev); if (!rdev) { MD_BUG(); @@ -2484,6 +2478,15 @@ err = -EINVAL; goto abort_export; } + + size = calc_dev_size(dev, mddev, persistent); + if (size < mddev->sb->size) { + printk(KERN_WARNING "md%d: disk size %d blocks < array size %d\n", + mdidx(mddev), size, mddev->sb->size); + err = -ENOSPC; + goto abort_export; + } + bind_rdev_to_array(rdev, mddev); /*
Attachment:
pgp00029.pgp
Description: PGP signature