13 Jun, 2011

1 commit

  • * new refcount in struct net, controlling actual freeing of the memory
    * new method in kobj_ns_type_operations (->drop_ns())
    * ->current_ns() semantics change - it's supposed to be followed by
    corresponding ->drop_ns(). For struct net in case of CONFIG_NET_NS it bumps
    the new refcount; net_drop_ns() decrements it and calls net_free() if the
    last reference has been dropped. Method renamed to ->grab_current_ns().
    * old net_free() callers call net_drop_ns() instead.
    * sysfs_exit_ns() is gone, along with a large part of callchain
    leading to it; now that the references stored in ->ns[...] stay valid we
    do not need to hunt them down and replace them with NULL. That fixes
    problems in sysfs_lookup() and sysfs_readdir(), along with getting rid
    of sb->s_instances abuse.

    Note that struct net *shutdown* logics has not changed - net_cleanup()
    is called exactly when it used to be called. The only thing postponed by
    having a sysfs instance refering to that struct net is actual freeing of
    memory occupied by struct net.

    Signed-off-by: Al Viro

    Al Viro
     

23 Oct, 2010

1 commit

  • One call chain getting to kset_find_obj is:
    link_mem_sections()
    find_mem_section()
    kset_find_obj()

    This is done during boot. The memory sections were added in a linearly
    increasing order and link_mem_sections tends to utilize them in that
    same linear order.

    Introduce a kset_find_obj_hinted which is passed the result of the
    previous kset_find_obj which it uses for a quick "is the next object
    our desired object" check before falling back to the old behavior.

    Signed-off-by: Robin Holt
    To: Robert P. J. Day
    Reviewed-by: KAMEZAWA Hiroyuki
    Signed-off-by: Greg Kroah-Hartman

    Robin Holt
     

22 May, 2010

3 commits

  • Add some in-line comments to explain the new infrastructure, which
    was introduced to support sysfs directory tagging with namespaces.
    I think an overall description someplace might be good too, but it
    didn't really seem to fit into Documentation/filesystems/sysfs.txt,
    which appears more geared toward users, rather than maintainers, of
    sysfs.

    (Tejun, please let me know if I can make anything clearer or failed
    altogether to comment something that should be commented.)

    Signed-off-by: Serge E. Hallyn
    Cc: Eric W. Biederman
    Cc: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    Serge E. Hallyn
     
  • The problem. When implementing a network namespace I need to be able
    to have multiple network devices with the same name. Currently this
    is a problem for /sys/class/net/*, /sys/devices/virtual/net/*, and
    potentially a few other directories of the form /sys/ ... /net/*.

    What this patch does is to add an additional tag field to the
    sysfs dirent structure. For directories that should show different
    contents depending on the context such as /sys/class/net/, and
    /sys/devices/virtual/net/ this tag field is used to specify the
    context in which those directories should be visible. Effectively
    this is the same as creating multiple distinct directories with
    the same name but internally to sysfs the result is nicer.

    I am calling the concept of a single directory that looks like multiple
    directories all at the same path in the filesystem tagged directories.

    For the networking namespace the set of directories whose contents I need
    to filter with tags can depend on the presence or absence of hotplug
    hardware or which modules are currently loaded. Which means I need
    a simple race free way to setup those directories as tagged.

    To achieve a reace free design all tagged directories are created
    and managed by sysfs itself.

    Users of this interface:
    - define a type in the sysfs_tag_type enumeration.
    - call sysfs_register_ns_types with the type and it's operations
    - sysfs_exit_ns when an individual tag is no longer valid

    - Implement mount_ns() which returns the ns of the calling process
    so we can attach it to a sysfs superblock.
    - Implement ktype.namespace() which returns the ns of a syfs kobject.

    Everything else is left up to sysfs and the driver layer.

    For the network namespace mount_ns and namespace() are essentially
    one line functions, and look to remain that.

    Tags are currently represented a const void * pointers as that is
    both generic, prevides enough information for equality comparisons,
    and is trivial to create for current users, as it is just the
    existing namespace pointer.

    The work needed in sysfs is more extensive. At each directory
    or symlink creating I need to check if the directory it is being
    created in is a tagged directory and if so generate the appropriate
    tag to place on the sysfs_dirent. Likewise at each symlink or
    directory removal I need to check if the sysfs directory it is
    being removed from is a tagged directory and if so figure out
    which tag goes along with the name I am deleting.

    Currently only directories which hold kobjects, and
    symlinks are supported. There is not enough information
    in the current file attribute interfaces to give us anything
    to discriminate on which makes it useless, and there are
    no potential users which makes it an uninteresting problem
    to solve.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: Benjamin Thery
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     
  • Move complete knowledge of namespaces into the kobject layer
    so we can use that information when reporting kobjects to
    userspace.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     

08 Mar, 2010

2 commits

  • Constify struct sysfs_ops.

    This is part of the ops structure constification
    effort started by Arjan van de Ven et al.

    Benefits of this constification:

    * prevents modification of data that is shared
    (referenced) by many other structure instances
    at runtime

    * detects/prevents accidental (but not intentional)
    modification attempts on archs that enforce
    read-only kernel data at runtime

    * potentially better optimized code as the compiler
    can assume that the const data cannot be changed

    * the compiler/linker move const data into .rodata
    and therefore exclude them from false sharing

    Signed-off-by: Emese Revfy
    Acked-by: David Teigland
    Acked-by: Matt Domsch
    Acked-by: Maciej Sosnowski
    Acked-by: Hans J. Koch
    Acked-by: Pekka Enberg
    Acked-by: Jens Axboe
    Acked-by: Stephen Hemminger
    Signed-off-by: Greg Kroah-Hartman

    Emese Revfy
     
  • Constify struct kset_uevent_ops.

    This is part of the ops structure constification
    effort started by Arjan van de Ven et al.

    Benefits of this constification:

    * prevents modification of data that is shared
    (referenced) by many other structure instances
    at runtime

    * detects/prevents accidental (but not intentional)
    modification attempts on archs that enforce
    read-only kernel data at runtime

    * potentially better optimized code as the compiler
    can assume that the const data cannot be changed

    * the compiler/linker move const data into .rodata
    and therefore exclude them from false sharing

    Signed-off-by: Emese Revfy
    Signed-off-by: Greg Kroah-Hartman

    Emese Revfy
     

16 Jun, 2009

1 commit


20 Apr, 2009

1 commit

  • notice one system /proc/iomem some entries missed the name for pci_devices

    it turns that dev->dev.kobj name is changed after device_add.

    for pci code: via acpi_pci_root_driver.ops.add (aka acpi_pci_root_add)
    ==> pci_acpi_scan_root is used to scan pci bus/device, and at the same
    time we read the resource for pci_dev in the pci_read_bases, we have
    res->name = pci_name(pci_dev); pci_name is calling dev_name.

    later via acpi_pci_root_driver.ops.start (aka acpi_pci_root_start) ==>
    pci_bus_add_device to add all pci_dev in kobj tree. pci_bus_add_device
    will call device_add.

    actually in device_add

    /* first, register with generic layer. */
    error = kobject_add(&dev->kobj, dev->kobj.parent, "%s", dev_name(dev));
    if (error)
    goto Error;

    will get one new name for that kobj, old name is freed.

    [Impact: fix corrupted names in /proc/iomem ]

    Signed-off-by: Yinghai Lu
    Signed-off-by: Linus Torvalds

    Kay Sievers
     

25 Mar, 2009

1 commit


17 Oct, 2008

2 commits

  • It finally dawned on me what the clean fix to sysfs_rename_dir
    calling kobject_set_name is. Move the work into kobject_rename
    where it belongs. The callers serialize us anyway so this is
    safe.

    Signed-off-by: Eric W. Biederman
    Acked-by: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     
  • When looking at kobject_rename I found two bugs with
    that exist when sysfs support is disabled in the kernel.

    kobject_rename does not change the name on the kobject when
    sysfs support is not compiled in.

    kobject_rename without locking attempts to check the
    validity of a rename operation, which the kobject layer
    simply does not have the infrastructure to do.

    This patch documents the previously unstated requirement of
    kobject_rename that is the responsibility of the caller to
    provide mutual exclusion and to be certain that the new_name
    for the kobject is valid.

    This patch modifies sysfs_rename_dir in !CONFIG_SYSFS case
    to call kobject_set_name to actually change the kobject_name.

    This patch removes the bogus and misleading check in kobject_rename
    that attempts to see if a rename is valid. The check is bogus
    because we do not have the proper locking. The check is misleading
    because it looks like we can and do perform checking at the kobject
    level that we don't.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     

22 Aug, 2008

1 commit


26 Jul, 2008

1 commit


22 Jul, 2008

1 commit


11 Jun, 2008

1 commit

  • Detect all physical PCI slots as described by ACPI, and create entries in
    /sys/bus/pci/slots/.

    Not all physical slots are hotpluggable, and the acpiphp module does not
    detect them. Now we know the physical PCI geography of our system, without
    caring about hotplug.

    [kaneshige.kenji@jp.fujitsu.com: export-kobject_rename-for-pci_hotplug_core]
    Signed-off-by: Kenji Kaneshige
    Acked-by: Greg KH
    [akpm@linux-foundation.org: build fix]
    [akpm@linux-foundation.org: fix build with CONFIG_DMI=n]
    Signed-off-by: Alex Chiang
    Cc: Greg KH
    Cc: Kristen Carlson Accardi
    Cc: Len Brown
    Acked-by: Len Brown
    Acked-by: Kenji Kaneshige
    Signed-off-by: Andrew Morton
    Signed-off-by: Andrew Morton
    Signed-off-by: Jesse Barnes

    Alex Chiang
     

01 May, 2008

1 commit


30 Apr, 2008

1 commit


20 Apr, 2008

2 commits


05 Mar, 2008

1 commit

  • kset_initialize was calling kobject_init_internal() which didn't
    initialize the kobject as well as kobject_init() was. So have
    kobject_init() call kobject_init_internal() and move the logic to
    initalize the kobject there.

    Cc: Kay Sievers
    Cc: Hannes Reinecke
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

03 Feb, 2008

1 commit


25 Jan, 2008

18 commits