linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fwd: blkid descends into /dev/.udev/... and stucks.
@ 2006-01-26 15:17 Hai Zaar
  2006-01-26 15:31 ` Kay Sievers
  2006-01-26 16:10 ` Hai Zaar
  0 siblings, 2 replies; 3+ messages in thread
From: Hai Zaar @ 2006-01-26 15:17 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 1195 bytes --]

Hi, guys!

Message below is directly related to hotplug, but I've encountered the
described problem while playing with 2.6.15 + new udev - and it took
me decent amount of hours to find the problem.

Take care...

---------- Forwarded message ----------
From: Hai Zaar <haizaar@gmail.com>
Date: Jan 26, 2006 5:09 PM
Subject: blkid descends into /dev/.udev/... and stucks.
To: tytso@thunk.org


Hi!

I've encountered blkid being stuck on the following scenario:
I use 2.6.15 with udev to manage device nodes.
Suppose I load storage module (say ata_piix + sd_mod), then after some
time (say A), /proc/paritions is updated. After a bit more time (say
A+B), udev will create corresponding device nodes. Now the problem:
If you run blkid between time A and time B, it will scan /dev
recursivly trying to find device node with appripriate major/minor to
match /proc/partitions entry. The problem is that there is
/dev/.udev/failed dir, that contains links to /sys, and from where one
may easily go to infinite loop - and that is what blkid does.

The attached patch just makes blkid to skip /dev/.udev* when doing the
search for device node.

--
Zaar




--
Zaar

[-- Attachment #2: e2fsprogs-1.38-blkid-skip.udev-1.patch --]
[-- Type: text/x-patch, Size: 1136 bytes --]

When blkid searchs for devices that match /proc/partitions entries, it should NOT decend
into /dev/.udev/ directory. That directory may contain various symbolic links that may
cause blkid to loop forever. 
Typical scenario: You load modules and /proc/partitions is populated, but udev have not
created devices yet. If you run blkid at this point, it will start more thoughout search
looking for devices that match /proc/partitions etries. During the search it will scan all
of the /dev directory, including /dev/.udev* = inifinite loop. 
That patch prevents descending into /dev/.udev*

Author:	Hai Zaar <haizaar@gmail.com>

--- e2fsprogs-1.38/lib/blkid/devno.c.orig	2006-01-25 14:53:29.000000000 +0200
+++ e2fsprogs-1.38/lib/blkid/devno.c	2006-01-25 14:54:27.000000000 +0200
@@ -113,7 +113,8 @@
 
 		if (dp->d_name[0] == '.' &&
 		    ((dp->d_name[1] == 0) ||
-		     ((dp->d_name[1] == '.') && (dp->d_name[2] == 0))))
+		     ((dp->d_name[1] == '.') && (dp->d_name[2] == 0)) ||
+			 (strncmp(dp->d_name+1, "udev", 4) == 0)   )) /* never descend to .udev* entries! */
 			continue;
 
 		sprintf(path, "%s/%s", dirname, dp->d_name);




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-01-26 16:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-26 15:17 Fwd: blkid descends into /dev/.udev/... and stucks Hai Zaar
2006-01-26 15:31 ` Kay Sievers
2006-01-26 16:10 ` Hai Zaar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).