Skip to contentSkip to conversation

remove nodes in a directory

DISCUSSION Jon Smirl 3 participants 15 messages Jan 9, 2004 – Jan 13, 2004

lore
Share & tools
lore

Jon Smirl

author
#0 lore raw

I just updated to the latest bk version of udev.

When I stopped udev to switch I noticed that it does not remove /dri/card0. I removed the rule that puts card0 in a subdir and it was removed ok. So it looks like udev stop is not applying rules for finding things in subdirs.

==Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
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 3 lines · Jon Smirl

When I stopped udev to switch I noticed that it does not remove /dri/card0. I removed the rule that puts card0 in a subdir and it was removed ok. So it looks like udev stop is not applying rules for finding things in subdirs.

Do you mean the init script with "stop"? I never tried it :)

udev is not evaluating any rule if you call it with the remove action, it asks its data base for the filename. I expect the problem somewhere else.

Could you provide the debug for the failing remove action?

thanks,
Kay

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Jon Smirl
Quoted 5 lines · Jon Smirl

I just updated to the latest bk version of udev.

When I stopped udev to switch I noticed that it does not remove /dri/card0. I removed the rule that puts card0 in a subdir and it was removed ok. So it looks like udev stop is not applying rules for finding things in subdirs.

Can you show me the rule, and the log when the device is removed?

It should work.

thanks,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#3 lore raw
In reply to Jon Smirl

The init scipts aren't the problem, same problem happens when I remove my kernel module.

On add I have a rule like this:
REPLACE, KERNEL="card*", NAME="dri/card%n" This causes the device node to be created in:
/udev/dri/card0
The remove event does not delete this device node. If I get rid of the rule it works fine.

Where do the add/remove of the device nodes in the udev directory occur? When this code is removing the device node it needs to transform the name through the rules first. It should also clean up an empty subdirs.

Quoted 10 lines · --- Kay Sievers
Quoted 1 line · Jon Smirl

When I stopped udev to switch I noticed that it does not remove /dri/card0.

I

Quoted 1 line

removed the rule that puts card0 in a subdir and it was removed ok. So it

looks

Quoted 1 line

like udev stop is not applying rules for finding things in subdirs.

Do you mean the init script with "stop"? I never tried it :)

Quoted 8 lines

udev is not evaluating any rule if you call it with the remove action, it asks its data base for the filename. I expect the problem somewhere else.

Could you provide the debug for the failing remove action?

thanks,
Kay

==Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#4 lore raw
In reply to Jon Smirl
Quoted 10 lines · Jon Smirl

On add I have a rule like this:
REPLACE, KERNEL="card*", NAME="dri/card%n" This causes the device node to be created in:
/udev/dri/card0
The remove event does not delete this device node. If I get rid of the rule it works fine.

Where do the add/remove of the device nodes in the udev directory occur? When this code is removing the device node it needs to transform the name through the rules first. It should also clean up an empty subdirs.

Yes, it does clean up empty subdirs.
And as I said the rule is never used at remove. udev asks its data base or falls back on the default name. That propably why removing the rule works for you. Maybe it's not possible for udev to put the name in its data base at creation time.

So we definitely need the debug for the create and remove event.

Kay

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#5 lore raw
In reply to Jon Smirl

i rebuilt with debug=true.
Where is the output going?
I have kernel debug messages going to /var/log/debug

Quoted 21 lines · --- Kay Sievers
Quoted 8 lines · Jon Smirl

On add I have a rule like this:
REPLACE, KERNEL="card*", NAME="dri/card%n" This causes the device node to be created in:
/udev/dri/card0
The remove event does not delete this device node. If I get rid of the rule it works fine.

Where do the add/remove of the device nodes in the udev directory occur?

When

Quoted 1 line

this code is removing the device node it needs to transform the name through

the

Quoted 1 line

rules first. It should also clean up an empty subdirs.

Yes, it does clean up empty subdirs.
And as I said the rule is never used at remove. udev asks its data base or falls back on the default name. That propably why removing the rule works for you. Maybe it's not possible for udev to put the name in its data base at creation time.

Quoted 3 lines

So we definitely need the debug for the create and remove event.

Kay

==Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#6 lore raw
In reply to Jon Smirl
Quoted 4 lines · Jon Smirl

i rebuilt with debug=true.
Where is the output going?
I have kernel debug messages going to /var/log/debug

It's uppercase "make DEBUG=true".
And it's userspace debug not kernel debug. You may look in /var/log/syslog or /var/log/messages.

You may also try to remove the database and test it:
"rm /udev/.udev.tdb"
After module load udev should have created a new one.

Kay

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#7 lore raw
In reply to Jon Smirl

[root@smirl drm]# udev dri
<7>main: version 012_bk
<7>get_dirs: sysfs_path='/sys'
<7>parse_config_file: reading '/etc/udev/udev.conf' as config file <7>main: called by hotplug
<7>udev_hotplug: looking at '/class/dri/card0' <7>namedev_init_rules: reading '/etc/udev/udev.rules' as rules file <7>namedev_init_permissions: reading '/etc/udev/udev.permissions' as permissions file
<7>sleep_for_dev: looking for '/sys/class/dri/card0/dev' <7>get_class_dev: looking at '/sys/class/dri/card0' <7>get_class_dev: class_dev->name='card0'
<7>get_major_minor: dev='226:0
'
<7>get_major_minor: found major"6, minor=0
<7>get_sysfs_device: filename = /sys/class/dri/card0 <7>get_sysfs_device: looking for '/sys/class/dri/card0/device' <7>sysfs_path_is_link: stat() failed

<7>sysfs_path_is_link: stat() failed

<7>sysfs_path_is_link: stat() failed

<7>sysfs_path_is_link: stat() failed

<7>sysfs_path_is_link: stat() failed

<7>namedev_name_device:
sysfs_device->path='/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0' <7>namedev_name_device: sysfs_device->bus_id='0000:01:00.0' <7>namedev_name_device: sysfs_device->bus='pci' <7>wait_for_device_to_initialize: looking for file 'vendor' on bus 'pci' <7>namedev_name_device: kernel_number='0'
<7>do_callout: dev->bus='scsi' sysfs_device->bus='pci'
<7>do_label: dev->bus='usb' sysfs_device->bus='pci'
<7>do_label: dev->bus='usb' sysfs_device->bus='pci'
<7>do_label: dev->bus='usb' sysfs_device->bus='pci'
<7>do_number: dev->bus='pci' sysfs_device->bus='pci'
<7>do_number: search '00:0b.0' in '/0000:01:00.0', path='/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0' <7>do_number: search '00:0b.0' in '/0000:00:01.0', path='/sys/devices/pci0000:00/0000:00:01.0'
<7>do_number: dev->bus='pci' sysfs_device->bus='pci'
<7>do_number: search '00:07.1' in '/0000:01:00.0', path='/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0' <7>do_number: search '00:07.1' in '/0000:00:01.0', path='/sys/devices/pci0000:00/0000:00:01.0'
<7>do_topology: dev->bus='usb' sysfs_device->bus='pci' <7>do_topology: dev->bus='usb' sysfs_device->bus='pci' <7>do_topology: dev->bus='usb' sysfs_device->bus='pci' <7>do_replace: compare name 'ttyUSB1' with 'card0'
<7>do_replace: compare name 'ttyUSB0' with 'card0'
<7>do_replace: compare name 'card*' with 'card0'
<7>do_replace: found name, 'card*' becomes 'dri/card%n' <7>apply_format: substitute kernel number '0' <7>namedev_name_device: name, 'dri/card0' is going to have owner='', group='', mode = 0600
<7>udev_add_device: udevdb_add_dev failed, but we are going to try to create the node anyway. But remove might not work properly for this device. <7>udev_add_device: name='dri/card0'
<7>create_node: mknod(/udev/dri/card0, 020600, 226, 0) <7>create_node: mknod(/udev/dri/card0, 020600, 226, 0) failed with error '17' <7>create_node: chmod(/udev/dri/card0, 020600)
[root@smirl drm]#

==Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#8 lore raw
In reply to Jon Smirl
Quoted 2 lines · Jon Smirl

<7>udev_add_device: udevdb_add_dev failed, but we are going to try to create the node anyway. But remove might not work properly for this device.

I think that's your problem :)

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#9 lore raw
In reply to Jon Smirl
Quoted 1 line · Jon Smirl

<7>create_node: mknod(/udev/dri/card0, 020600, 226, 0) failed with error '17'

What are you expecting? The file is already there. Please do:
rm -rf /udev/dri
rm /udev/.udev.tdb

before any further testing.

Where is the debug for the remove event?
You posted the add event while the node is already there :)

Kay

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#10 lore raw
In reply to Jon Smirl

Greg was the closest to the real problem, the real problem is that I am out of disk space on the tmpfs where I placed udev. I was not expecting a hidden database containing 120 entries to be 100Kb in size. Db must not be very dense. I bzipped it down to 2.5K.

Quoted 6 lines · --- Greg KH
Quoted 1 line · Jon Smirl

<7>udev_add_device: udevdb_add_dev failed, but we are going to try to create

the

Quoted 1 line

node anyway. But remove might not work properly for this device.

I think that's your problem :)

==Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#11 lore raw
In reply to Jon Smirl

It it possible to add a better error message for the out of disk space case?

Doesn't the 100Kb database file defeat the whole point of making udev small using klibc? It might be better to just make the db into a flat file, read it all into RAM, maniplulate it, and write it all back.

Quoted 5 lines · --- Jon Smirl

Greg was the closest to the real problem, the real problem is that I am out of disk space on the tmpfs where I placed udev. I was not expecting a hidden database containing 120 entries to be 100Kb in size. Db must not be very dense.
I bzipped it down to 2.5K.

==Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#12 lore raw
In reply to Jon Smirl
Quoted 4 lines · Jon Smirl

It it possible to add a better error message for the out of disk space case?

Doesn't the 100Kb database file defeat the whole point of making udev small using klibc?

No. 100Kb database being stored on disk is pretty tiny in the long run...

Quoted 2 lines

It might be better to just make the db into a flat file, read it all into RAM, maniplulate it, and write it all back.

But then we end up writing our own "mini db" code, right? tdb is pretty nice and tiny as it is.

But if it really bugs you, create a patch :)

thanks,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#13 lore raw
In reply to Jon Smirl
Quoted 8 lines · --- Greg KH
Quoted 4 lines · Jon Smirl

It it possible to add a better error message for the out of disk space case?

Doesn't the 100Kb database file defeat the whole point of making udev small using klibc?

No. 100Kb database being stored on disk is pretty tiny in the long run...

What about embedded systems where the 100Kb is going in ram or flash?

Does the db engine return an out of disk space error? I wasn't able to see any kind of error until I did a debug build and even debug the message was simply "database error".

Tinydb is a disk based database. Is anyone familar with an in-memory style database that might be smaller?

==Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#14 lore raw
In reply to Jon Smirl
Quoted 11 lines · Jon Smirl
Quoted 8 lines · --- Greg KH
Quoted 4 lines · Jon Smirl

It it possible to add a better error message for the out of disk space case?

Doesn't the 100Kb database file defeat the whole point of making udev small using klibc?

No. 100Kb database being stored on disk is pretty tiny in the long run...

What about embedded systems where the 100Kb is going in ram or flash?

I don't know. Do you have one? Is that excessive? Do the benefits of udev outweigh the extra disk space for the database for you?

Quoted 3 lines

Does the db engine return an out of disk space error? I wasn't able to see any kind of error until I did a debug build and even debug the message was simply "database error".

Hm, don't know, I'll look into that.

Quoted 2 lines

Tinydb is a disk based database. Is anyone familar with an in-memory style database that might be smaller?

Once we have udevd in place, tinydb can be switched over to run in-memory. It's just a simple 1 argument change in udev to do this :)

thanks,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel