Skip to contentSkip to conversation

file creation timing

DISCUSSION Dave Hansen 2 participants 2 messages Feb 2, 2005

lore
Share & tools
lore
#0 lore raw

For memory hotplug, I register each of my memory kobjects, followed by their individual files. I'm seeing races where the hotplug scripts get the event for the main register before all of the control files are there.

        ret = register_memory(mem, section, NULL);
	mem_create_simple_file(mem, phys_index);
	mem_create_simple_file(mem, state);
	mem_create_simple_file(mem, phys_device);

The script sees the /sys/.../memory directory before it sees the "state" file. Is there a handy way around this other than sleeping in the script? Can I somehow delay that registration event?

-- Dave

-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 5 lines · Dave Hansen

For memory hotplug, I register each of my memory kobjects, followed by their individual files. I'm seeing races where the hotplug scripts get the event for the main register before all of the control files are there.

Quoted 8 lines
        ret = register_memory(mem, section, NULL);
	mem_create_simple_file(mem, phys_index);
	mem_create_simple_file(mem, state);
	mem_create_simple_file(mem, phys_device);

The script sees the /sys/.../memory directory before it sees the "state" file. Is there a handy way around this other than sleeping in the script?

You may use udev to manage the hotplug events by setting /sbin/udevsend as the hotplug helper. It will wait until sysfs is populated.

Quoted 1 line

Can I somehow delay that registration event?

No, not today, not without doing crazy stuff.

Kay

-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel