On Fri, Aug 31, 2001 at 10:54:20PM +0400, Andrej Borsenkow wrote:
> 
> The actual question is, why it tries to mknod at all.

Indeed.  I guess I was being obtuse about that point.  :-)

> Consider lvm.c and 
> lvm-fs.c in -12 source tree:
> 
> lvm.c:
>  lvm_chr_ioctl()
>        case VG_CREATE:
>                /* create a VGDA, assume VG number is filled in */
>                return lvm_do_vg_create(-1, arg);
> lvm_do_vg_create():
>          /* create devfs and procfs entries */
>         lvm_fs_create_vg(vg_ptr);
> 
> and lvm-fs.c:
> lvm_fs_create():
>         vg_devfs_handle[vg_ptr->vg_number] =
>                 devfs_mk_dir(0, vg_ptr->vg_name, NULL);
>        ch_devfs_handle[vg_ptr->vg_number] = devfs_register(
>                 vg_devfs_handle[vg_ptr->vg_number] , "group",
>                 DEVFS_FL_DEFAULT, LVM_CHAR_MAJOR, vg_ptr->vg_number,
>                 S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP,
>                 &lvm_chr_fops, NULL);

Oh, I see it alright.

> i.e. creating group automatically creates /dev entries.

In the case of devfs, sure defvs_register() is the right thing to do,
but in the case of no devfs, mknod() would be, surely -- which seems to
be left up to the userspace tools rather than the kernel.  (See
conclusion below)

> I understand that vgscan tries to make sure all needed specials are 
> there.

That's what it would seem.

> But it is not needed in case of devfs, when all device entries 
> are created automatically.

Indeed.  It seems as though the userspace tools were built un-devfs
aware.  Maybe the userspace tools can't be built for both devfs and
non-devfs systems.  i.e. the choice between mknod()ing and not is a
compile time attribute and not a run-time one.

> vgscan should check for mounted devfs and refrain from creating /dev 
> entries.

Yup.

However, all of this still does not address my empty
/dev/<volume group> directory.  It is missing the actual device nodes
(group, and <lv>s).

This latter part might be due to my using the initrd however.  I am of
thought that the /dev/<volume group> nodes are created within the
following order of operations:

1.  mount initrd
2.  mount devfs
3   load lvm module (which creates devfs nodes)
3.  vgscan, vchange -a y
4.  mount real root (on lvm partition)
5.  mount devfs again (on real root)
6.  unmount initrd

I think the lvm nodes are created successfully in step 3 but get lost
when devfs is mounted a second time in step 5.

I am at a loss as to how to correct this however as I don't seem to be
able to create nodes on the devfs.  I guess it's time to get on over
to the lvm mailing list for some ideas.

Anyone here is welcome to make suggestions of course.  Also,
confirmation of what I suspect is happening in steps 1-6 above would
be appreciated as well as it is only a theory so far.

b.


-- 
Brian J. Murrell

Reply via email to