[Cluster-devel] [PATCH] cman/qdiskd: fix bugzilla 362031

Fabio Massimo Di Nitto fabbione at ubuntu.com
Thu Nov 8 12:23:36 UTC 2007


Hi guys,

the patch in attachment does:

- create a find_partition wrapper for find_sysfs_partitions and
find_proc_partitions (for backward compatibility)

- move check_device from proc.c to disk.c as it is now used by sysfs too.

- create a common print_qh from proc.c in disk.c as it is shared.

- cleanup proc.c and make find_proc_partitions use print_qh.

- add a whole bunch of stuff in sysfs.c:
  - sysfs_nodes_init is used to create and clean /dev/.qdiskd namespace where we
    can work without interfering with other /dev management tools.
  - create_node takes care to properly mknod given a sysfs path to a block
    device.
  - find_sysfs_partitions that does the real scanning. This is the most tricky
    one as it needs to be recursive due to the very nature of sysfs layout.
  - NOTE: I left the original RH copyright for this file on purpose to avoid any
    kind of possible legal issues in case of relicensing or whatever. If this
    might be a problem, somebody can just commit the patch for me. I give out
    all permissions to use/reuse it and etc. I don't even care about having my
    name in the author to be honest :)

- main.c:
  - invoke sysfs_nodes_init. NOTE: in case we decide to backport, this should
    probably be non-fatal and the find_partition wrapper updated to use proc
    before sysfs.
  - memset device to make sure it's a 0 len string when passed around. It is
    useful in find_sysfs_partition to break the recursion loop once we find the
    device.

- mkqdisk.c
  - remove static version for release and use RELEASE_VERSION.
  - invoke sysfs_nodes_init. Same note as above applies here.

- update copyright dates here and there.

- update Makefile.

I tested the patch by using a shared block device like NBD that does not appear
in /proc/partitions and asking qdiskd to find it by label and everything seems
to work fine. mkqdisk -L and -f work. You might want to note that Device
names are now owned by our node manager and might not reflect user expectations.
If the patch goes in, we should properly update the documentation explaining
why device names don't match but everything will work as expected.

Please review :)

Thanks
Fabio
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sysfs.diff
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20071108/95de2838/attachment.ksh>


More information about the Cluster-devel mailing list