netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
To: Matt Mackall <mpm-VDJrAJ4Gl5ZBDgjK7y7TUQ@public.gmane.org>
Cc: Adrian Bunk <bunk-HeJ8Db2Gnd6zQB+pC5nmwQ@public.gmane.org>,
	Theodore Tso <tytso-3s7WtUTddSA@public.gmane.org>,
	Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	yi.zhu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	jketreno-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
	linux-wireless
	<linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	akpm-3NddpPZAyC0@public.gmane.org
Subject: Re: [2.6.21 patch] unconditionally enable SYSFS_DEPRECATED
Date: Tue, 6 Mar 2007 12:05:37 -0800	[thread overview]
Message-ID: <20070306200536.GA5459@kroah.com> (raw)
In-Reply-To: <20070306061009.GR23311-1tnLUEbcrg3YtjvyW6yDsg@public.gmane.org>

On Tue, Mar 06, 2007 at 12:10:09AM -0600, Matt Mackall wrote:
> On Mon, Mar 05, 2007 at 08:03:50PM -0800, Greg KH wrote:
> > On Mon, Mar 05, 2007 at 09:39:47PM -0600, Matt Mackall wrote:
> > > On Mon, Mar 05, 2007 at 06:48:50PM -0800, Greg KH wrote:
> > > > If so, can you disable the option and strace it to see what program is
> > > > trying to access what?  That will put the
> > > > HAL/NetworkManager/libsysfs/distro script finger pointing to rest pretty
> > > > quickly :)
> > > 
> > > Ok, I've got straces of both good and bad (>5M each). Filtered out
> > > random pointer values and the like, diffed, and filtered for /sys/,
> > > and the result's still 1.5M. What should I be looking for?
> > 
> > Failures when trying to read from /sys/class/net/
> > 
> > Or opening the directory and iterating over the subdirs in there.  Or
> > something like that.
> > 
> > But the /sys/class/net/ stuff should hopefully help narrow it down.
> 
> Works:
> 
> 6857  open("/sys/class/net",
> O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 13
> 6857  fstat64(13, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
> 6857  fcntl64(13, F_SETFD, FD_CLOEXEC)  = 0
> 6857  getdents64(13, /* 5 entries */, 4096) = 120
> 6857  readlink("/sys/class/net/eth1", 0x80a2450, 256) = -1 EINVAL
> (Invalid argument)
> 6857  readlink("/sys/class/net/eth1/device",
> "../../../devices/pci0000:00/0000:00:1e.0/0000:02:02.0", 256) = 53
> 6857  readlink("/sys/class/net/lo", 0x80a2450, 256) = -1 EINVAL
> (Invalid argument)
> 6857  readlink("/sys/class/net/lo/device", 0x80a2450, 256) = -1 ENOENT
> (No such
> file or directory)
> 6857  readlink("/sys/class/net/eth0", 0x80a2450, 256) = -1 EINVAL
> (Invalid argument)
> 6857  readlink("/sys/class/net/eth0/device",
> "../../../devices/pci0000:00/0000:00:1e.0/0000:02:01.0", 256) = 53
> 6857  getdents64(13, /* 0 entries */, 4096) = 0
> 6857  close(13)                         = 0
> 
> Breaks:
> 
> 3620  open("/sys/class/net",
> O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = 13
> 3620  fstat64(13, {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
> 3620  fcntl64(13, F_SETFD, FD_CLOEXEC)  = 0
> 3620  getdents64(13, /* 5 entries */, 4096) = 120
> 3620  readlink("/sys/class/net/eth1",
> "../../devices/pci0000:00/0000:00:1e.0/00\00:02:02.0/eth1", 256) = 55
> 3620
> readlink("/sys/devices/pci0000:00/0000:00:1e.0/0000:02:02.0/eth1/device",
> 0x809e910, 256) = -1 ENOENT (No such file or directory)
> 3620  readlink("/sys/class/net/lo", "../../devices/virtual/net/lo",
> 256) = 28
> 3620  readlink("/sys/devices/virtual/net/lo/device", 0x809e960, 256) =
> -1 ENOEN\T (No such file or directory)
> 3620  readlink("/sys/class/net/eth0",
> "../../devices/pci0000:00/0000:00:1e.0/00\00:02:01.0/eth0", 256) = 55
> 3620
> readlink("/sys/devices/pci0000:00/0000:00:1e.0/0000:02:01.0/eth0/device",
> 0x809e960, 256) = -1 ENOENT (No such file or directory)
> 3620  getdents64(13, /* 0 entries */, 4096) = 0
> 3620  close(13)                         = 0

Can you try the patch below?  And enable CONFIG_SYSFS_DEPRECATED.  It
should cause HAL to see the network devices again, as the symlink is now
back (it shouldn't have gone away, that was my fault...)

I tried this with HAL 0.5.7, which is pretty old, and hal-device-manager
shows my network devices properly.

thanks for your patience,

greg k-h


---
 drivers/base/core.c |   21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

--- gregkh-2.6.orig/drivers/base/core.c
+++ gregkh-2.6/drivers/base/core.c
@@ -584,17 +584,17 @@ int device_add(struct device *dev)
 		if (dev->kobj.parent != &dev->class->subsys.kset.kobj)
 			sysfs_create_link(&dev->class->subsys.kset.kobj,
 					  &dev->kobj, dev->bus_id);
-#ifdef CONFIG_SYSFS_DEPRECATED
 		if (parent) {
 			sysfs_create_link(&dev->kobj, &dev->parent->kobj,
 							"device");
+#ifdef CONFIG_SYSFS_DEPRECATED
 			class_name = make_class_name(dev->class->name,
 							&dev->kobj);
 			if (class_name)
 				sysfs_create_link(&dev->parent->kobj,
 						  &dev->kobj, class_name);
-		}
 #endif
+		}
 	}
 
 	if ((error = device_add_attrs(dev)))
@@ -651,17 +651,17 @@ int device_add(struct device *dev)
 		if (dev->kobj.parent != &dev->class->subsys.kset.kobj)
 			sysfs_remove_link(&dev->class->subsys.kset.kobj,
 					  dev->bus_id);
-#ifdef CONFIG_SYSFS_DEPRECATED
 		if (parent) {
+#ifdef CONFIG_SYSFS_DEPRECATED
 			char *class_name = make_class_name(dev->class->name,
 							   &dev->kobj);
 			if (class_name)
 				sysfs_remove_link(&dev->parent->kobj,
 						  class_name);
 			kfree(class_name);
+#endif
 			sysfs_remove_link(&dev->kobj, "device");
 		}
-#endif
 
 		down(&dev->class->sem);
 		/* notify any interfaces that the device is now gone */
@@ -761,17 +761,17 @@ void device_del(struct device * dev)
 		if (dev->kobj.parent != &dev->class->subsys.kset.kobj)
 			sysfs_remove_link(&dev->class->subsys.kset.kobj,
 					  dev->bus_id);
-#ifdef CONFIG_SYSFS_DEPRECATED
 		if (parent) {
+#ifdef CONFIG_SYSFS_DEPRECATED
 			char *class_name = make_class_name(dev->class->name,
 							   &dev->kobj);
 			if (class_name)
 				sysfs_remove_link(&dev->parent->kobj,
 						  class_name);
 			kfree(class_name);
+#endif
 			sysfs_remove_link(&dev->kobj, "device");
 		}
-#endif
 
 		down(&dev->class->sem);
 		/* notify any interfaces that the device is now gone */
@@ -1064,8 +1064,8 @@ static int device_move_class_links(struc
 				   struct device *old_parent,
 				   struct device *new_parent)
 {
+	int error = 0;
 #ifdef CONFIG_SYSFS_DEPRECATED
-	int error;
 	char *class_name;
 
 	class_name = make_class_name(dev->class->name, &dev->kobj);
@@ -1093,7 +1093,12 @@ out:
 	kfree(class_name);
 	return error;
 #else
-	return 0;
+	if (old_parent)
+		sysfs_remove_link(&dev->kobj, "device");
+	if (new_parent)
+		error = sysfs_create_link(&dev->kobj, &new_parent->kobj,
+					  "device");
+	return error;
 #endif
 }
 

  parent reply	other threads:[~2007-03-06 20:05 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-04 22:08 Recent wireless breakage (ipw2200, iwconfig, NetworkManager) Matt Mackall
     [not found] ` <20070304220857.GH23311-1tnLUEbcrg3YtjvyW6yDsg@public.gmane.org>
2007-03-04 23:39   ` Johannes Berg
2007-03-05  0:25     ` Matt Mackall
     [not found]       ` <20070305002550.GI23311-1tnLUEbcrg3YtjvyW6yDsg@public.gmane.org>
2007-03-05  0:45         ` Andrew Morton
     [not found]           ` <20070304164525.349f9589.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2007-03-05  1:05             ` Adrian Bunk
2007-03-05  0:46         ` Ian McDonald
2007-03-05  1:17         ` Greg KH
     [not found]           ` <20070305011729.GB7681-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2007-03-05 11:20             ` Johannes Berg
2007-03-05 12:59           ` Theodore Tso
2007-03-05 18:58             ` Greg KH
2007-03-05 19:55               ` Matt Mackall
2007-03-05 22:39                 ` Greg KH
     [not found]                   ` <20070305223900.GA7676-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2007-03-06  3:07                     ` Matthew Garrett
2007-03-05 23:05               ` Jeffrey Hundstad
     [not found]               ` <20070305185813.GA31465-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2007-03-05 23:40                 ` [2.6.21 patch] unconditionally enable SYSFS_DEPRECATED Adrian Bunk
     [not found]                   ` <20070305234052.GR3441-HeJ8Db2Gnd6zQB+pC5nmwQ@public.gmane.org>
2007-03-06  0:07                     ` Greg KH
     [not found]                       ` <20070306000722.GA11436-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2007-03-06  0:35                         ` Adrian Bunk
     [not found]                           ` <20070306003541.GT3441-HeJ8Db2Gnd6zQB+pC5nmwQ@public.gmane.org>
2007-03-06  0:41                             ` Greg KH
2007-03-06  1:30                       ` Matt Mackall
     [not found]                         ` <20070306013020.GN23311-1tnLUEbcrg3YtjvyW6yDsg@public.gmane.org>
2007-03-06  1:56                           ` Greg KH
2007-03-06 13:20                             ` Johannes Berg
2007-03-06 15:55                             ` Dan Williams
2007-03-06  2:48                           ` Greg KH
     [not found]                             ` <20070306024850.GA24477-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2007-03-06  3:04                               ` Matt Mackall
2007-03-06  3:39                               ` Matt Mackall
     [not found]                                 ` <20070306033947.GQ23311-1tnLUEbcrg3YtjvyW6yDsg@public.gmane.org>
2007-03-06  4:03                                   ` Greg KH
     [not found]                                     ` <20070306040350.GA25783-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2007-03-06  6:10                                       ` Matt Mackall
2007-03-06 19:01                                         ` Greg KH
     [not found]                                         ` <20070306061009.GR23311-1tnLUEbcrg3YtjvyW6yDsg@public.gmane.org>
2007-03-06 20:05                                           ` Greg KH [this message]
2007-03-06  0:35             ` Recent wireless breakage (ipw2200, iwconfig, NetworkManager) Johannes Berg
2007-03-05  1:16 ` Greg KH
2007-03-05  6:42   ` Matt Mackall
2007-03-05  7:02     ` Greg KH
2007-03-05  7:13       ` Matt Mackall
2007-03-05 15:46         ` Tomasz Torcz
2007-03-05 21:14           ` Matt Mackall
2007-03-06  0:24             ` Bron Gondwana
2007-03-06  0:37               ` Greg KH
2007-03-06  0:56                 ` Theodore Tso
2007-03-06  1:08                   ` Andrew Morton
2007-03-06  1:17                     ` Greg KH
2007-03-06  1:38                       ` Andrew Morton
2007-03-06  1:10                   ` Greg KH
2007-03-05 21:58           ` Joel Becker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070306200536.GA5459@kroah.com \
    --to=greg-u8xffu+wg4eavxtiumwx3w@public.gmane.org \
    --cc=akpm-3NddpPZAyC0@public.gmane.org \
    --cc=bunk-HeJ8Db2Gnd6zQB+pC5nmwQ@public.gmane.org \
    --cc=jketreno-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mpm-VDJrAJ4Gl5ZBDgjK7y7TUQ@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=tytso-3s7WtUTddSA@public.gmane.org \
    --cc=yi.zhu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).