• Maneesh Soni's avatar
    [PATCH] fix kernel BUG at fs/sysfs/dir.c:20! · b168474c
    Maneesh Soni authored
    On Thu, Nov 04, 2004 at 12:52:38PM -0800, Greg KH wrote:
    > Hi,
    >
    > I get the following BUG in the sysfs code when I do:
    > 	- plug in a usb-serial device.
    > 	- open the port with 'cat /dev/ttyUSB0'
    > 	- unplug the device.
    > 	- stop the 'cat' process with control-C
    >
    > This used to work just fine before your big sysfs changes.
    
    There is a similar problem reported by s390 people where we see parent
    kobject (directory) going away before child kobject (sub-directory). It
    seems kobject code is able to handle this, but not the sysfs. What could
    be happening that in sysfs_remove_dir() of parent directory, we try to
    remove its contents. It works well with the regular files as it is the
    final removal for sysfs_dirent corresponding to the files. But in case
    of sub-directory we are doing an extra sysfs_put().  Once while removing
    parent and the other one being the one from when sysfs_remove_dir() is
    called for the child.
    
    The following patch worked for the s390 people, I hope same will work in
    this case also.
    
    
    o Do not remove sysfs_dirents corresponding to the sub-directory in
      sysfs_remove_dir(). They will be removed in the sysfs_remove_dir() call
      for the specific sub-directory.
    Signed-off-by: default avatarManeesh Soni <maneesh@in.ibm.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
    b168474c
dir.c 10.2 KB