1. 11 1月, 2011 1 次提交
  2. 07 1月, 2011 1 次提交
  3. 10 8月, 2010 1 次提交
  4. 22 5月, 2010 3 次提交
    • E
      sysfs: Implement sysfs tagged directory support. · 3ff195b0
      Eric W. Biederman 提交于
      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: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NBenjamin Thery <benjamin.thery@bull.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      3ff195b0
    • S
      sysfs: Comment sysfs directory tagging logic · be867b19
      Serge E. Hallyn 提交于
      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: NSerge E. Hallyn <serue@us.ibm.com>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Tejun Heo <tj@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      be867b19
    • E
      sysfs: Basic support for multiple super blocks · 9e7fdd25
      Eric W. Biederman 提交于
      Add all of the necessary bioler plate to support
      multiple superblocks in sysfs.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Acked-by: NSerge Hallyn <serue@us.ibm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9e7fdd25
  5. 08 3月, 2010 6 次提交
  6. 05 1月, 2010 1 次提交
    • E
      sysfs: Add lockdep annotations for the sysfs active reference · 846f9974
      Eric W. Biederman 提交于
      Holding locks over device_del -> kobject_del -> sysfs_deactivate can
      cause deadlocks if those same locks are grabbed in sysfs show or store
      methods.
      
      The I model s_active count + completion as a sleeping read/write lock.
      I describe to lockdep sysfs_get_active as a read_trylock,
      sysfs_put_active as a read_unlock, and sysfs_deactivate as a
      write_lock and write_unlock pair.  This seems to capture the essence
      for purposes of finding deadlocks, and in my testing gives finds real
      issues and ignores non-issues.
      
      This brings us back to holding locks over kobject_del is a problem
      that ideally we should find a way of addressing, but at least lockdep
      can tell us about the problems instead of requiring developers to debug
      rare strange system deadlocks, that happen when sysfs files are removed
      while being written to.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      846f9974
  7. 12 12月, 2009 5 次提交
  8. 10 9月, 2009 1 次提交
    • D
      sysfs: Add labeling support for sysfs · ddd29ec6
      David P. Quigley 提交于
      This patch adds a setxattr handler to the file, directory, and symlink
      inode_operations structures for sysfs. The patch uses hooks introduced in the
      previous patch to handle the getting and setting of security information for
      the sysfs inodes. As was suggested by Eric Biederman the struct iattr in the
      sysfs_dirent structure has been replaced by a structure which contains the
      iattr, secdata and secdata length to allow the changes to persist in the event
      that the inode representing the sysfs_dirent is evicted. Because sysfs only
      stores this information when a change is made all the optional data is moved
      into one dynamically allocated field.
      
      This patch addresses an issue where SELinux was denying virtd access to the PCI
      configuration entries in sysfs. The lack of setxattr handlers for sysfs
      required that a single label be assigned to all entries in sysfs. Granting virtd
      access to every entry in sysfs is not an acceptable solution so fine grained
      labeling of sysfs is required such that individual entries can be labeled
      appropriately.
      
      [sds:  Fixed compile-time warnings, coding style, and setting of inode security init flags.]
      Signed-off-by: NDavid P. Quigley <dpquigl@tycho.nsa.gov>
      Signed-off-by: NStephen D. Smalley <sds@tycho.nsa.gov>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      ddd29ec6
  9. 25 3月, 2009 2 次提交
  10. 17 10月, 2008 1 次提交
    • N
      sysfs: Support sysfs_notify from atomic context with new sysfs_notify_dirent · f1282c84
      Neil Brown 提交于
      Support sysfs_notify from atomic context with new sysfs_notify_dirent
      
      sysfs_notify currently takes sysfs_mutex.
      This means that it cannot be called in atomic context.
      sysfs_mutex  is sometimes held over a malloc (sysfs_rename_dir)
      so it can block on low memory.
      
      In md I want to be able to notify on a sysfs attribute from
      atomic context, and I don't want to block on low memory because I
      could be in the writeout path for freeing memory.
      
      So:
       - export the "sysfs_dirent" structure along with sysfs_get, sysfs_put
         and sysfs_get_dirent so I can get the sysfs_dirent that I want to
         notify on and hold it in an md structure.
       - split sysfs_notify_dirent out of sysfs_notify so the sysfs_dirent
         can be notified on with no blocking (just a spinlock).
      Signed-off-by: NNeil Brown <neilb@suse.de>
      Acked-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      f1282c84
  11. 22 7月, 2008 1 次提交
  12. 23 4月, 2008 1 次提交
  13. 31 10月, 2007 1 次提交
  14. 17 10月, 2007 1 次提交
  15. 13 10月, 2007 14 次提交