[klibc] create_dev and raid
maks at sternwelten.at
Mon May 8 00:23:57 PDT 2006
On Mon, May 08, 2006 at 02:12:28AM -0500, Aaron Griffin wrote:
> Yet another one of those "it would make sense it" posts.
> Currently, create_dev in do_mounts.c simply unlinks the device and
> recreates it.
> This doesn't seem right. If /dev/hda3 has already been created, by
> some early-userspace app (udev), there's no need to unlink or even
> parse the name again. Now, when talking about simple block devices,
> this doesn't make much of a difference (except when you take into
> account the FS-mount looping). However, if you take a look at
> do_mounts_md, if the raid array has already been assembled (say, for
> instance, because the array was encrypted, or part of an lvm group),
> kinit will again try to assemble it, spit out a mess of error
> messages, and carry on.
> The addition of a simple check in the md loop would fix this issue
> [see below]. The reason being that, even if /dev/md0 is not identical
> to the way kinit would have created it, it has been assembled by
> early-userland apps and is probably supposed to be overridden.
> --- do_mounts_md.c 2006-05-08 01:51:02.000000000 -0500
> +++ do_mounts_md.old 2006-05-08 02:07:35.000000000 -0500
not p1 applyable.
> @@ -222,7 +222,6 @@
> char *devname;
> mdu_disk_info_t dinfo;
> char name;
> + struct stat st;
use tabs for indentation.
> dev_minor = md_setup_args[ent].minor;
> partitioned = md_setup_args[ent].partitioned;
> @@ -231,8 +230,6 @@
> snprintf(name, sizeof name,
> "/dev/md%s%d", partitioned?"_d":"", dev_minor);
> + if (!stat(name,&st)) continue;
ditto + split it in 2 lines
> if (partitioned)
> dev = makedev(mdp_major(), dev_minor <<
you may want to read "the perfect patch" from akpm
More information about the klibc