Skip to contentSkip to conversation

WAIT_FOR_SYSFS ignores further conditions

PATCH Andrey Borzenkov 2 participants 4 messages Jan 29, 2006 – Feb 3, 2006

lore
Share & tools
lore
#0 lore raw

Is it intentional? It looks rather like copy'n'paste slip. Patch attached.

-andrey

Subject: [PATCH] WAIT_FOR_SYSFS was ignoring other conditions, notably SYSFS

From: Andrey Borzenkov <[email protected]>

---

 udev_rules.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)
udev_rules.c +5 -7
index f1bbfd8..dac6b43 100644
@@ -736,16 +736,14 @@ static int match_rule(struct udevice *ud
 		int match;
 
 		match = (wait_for_sysfs(udev, key_val(rule, &rule->wait_for_sysfs), 3) == 0);
-		if (match && (rule->wait_for_sysfs.operation != KEY_OP_NOMATCH)) {
+		if (match && (rule->wait_for_sysfs.operation == KEY_OP_MATCH))
 			dbg("WAIT_FOR_SYSFS is true (matching value)");
-			return 0;
-		}
-		if (!match && (rule->wait_for_sysfs.operation == KEY_OP_NOMATCH)) {
+		else if (!match && (rule->wait_for_sysfs.operation == KEY_OP_NOMATCH))
 			dbg("WAIT_FOR_SYSFS is true, (non matching value)");
-			return 0;
+		else {
+			dbg("WAIT_FOR_SYSFS is false");
+			goto nomatch;
 		}
-		dbg("WAIT_FOR_SYSFS is false");
-		return -1;
 	}
 
 	/* walk up the chain of parent devices and find a match */
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 2 lines · Andrey Borzenkov

Is it intentional? It looks rather like copy'n'paste slip. Patch attached.

This actually fixed a real bug here (every rule having WAIT_FOR_SYSFS was executed, not the one with mathing SYSFS value); so if there is something wrong with this patch I appreciate if someone explains what.

Regards

Andrey
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFD3kCsR6LMutpd94wRArBxAJ9ogrCvDa2UnJ59tQEKJmt6tbPdmACfWs0t dShZZrwqWacRdZHx1X1wBB8=u8N2
-----END PGP SIGNATURE-----

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
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 Andrey Borzenkov
Quoted 6 lines · Andrey Borzenkov
Quoted 1 line · Andrey Borzenkov

Is it intentional? It looks rather like copy'n'paste slip. Patch attached.

This actually fixed a real bug here (every rule having WAIT_FOR_SYSFS was executed, not the one with mathing SYSFS value); so if there is something wrong with this patch I appreciate if someone explains what.

Correct, it doesn't work the way you use it and it should be fixed. I'll go look into this later this week.

(WAIT_FOR_SYSFS is a hack, that should be used only in the first rules file udev finds and better not do any other function than ensuring that all the later rules can be sure that a file will be there or will not appear at all. Just don't use it in "real" rules, only in separate fixup rules at the beginning of the rule processing.)

Kay

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#3 lore raw
In reply to Andrey Borzenkov
Quoted 10 lines · Kay Sievers
Quoted 6 lines · Andrey Borzenkov
Quoted 1 line · Andrey Borzenkov

Is it intentional? It looks rather like copy'n'paste slip. Patch attached.

This actually fixed a real bug here (every rule having WAIT_FOR_SYSFS was executed, not the one with mathing SYSFS value); so if there is something wrong with this patch I appreciate if someone explains what.

Correct, it doesn't work the way you use it and it should be fixed. I'll go look into this later this week.

Works for me now. But WAIT_FOR_SYSFS should still only be placed in the first rules file, so that no other user of udev rules would see the same race.

I still hope to fix all the issues some day in the kernel. In the past we got several pages of rules built into udev, today there are only a very few rules left and udev itself does not wait for anything, so things look promising. :)

Thanks,
Kay

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel