1. 07 1月, 2011 1 次提交
    • N
      fs: change d_delete semantics · fe15ce44
      Nick Piggin 提交于
      Change d_delete from a dentry deletion notification to a dentry caching
      advise, more like ->drop_inode. Require it to be constant and idempotent,
      and not take d_lock. This is how all existing filesystems use the callback
      anyway.
      
      This makes fine grained dentry locking of dput and dentry lru scanning
      much simpler.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      fe15ce44
  2. 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: Add support for tagged directories with untagged members. · af10ec77
      Eric W. Biederman 提交于
      I had hopped to avoid this but the bonding driver adds a file
      to /sys/class/net/  and the easiest way to handle that file is
      to make it untagged and to register it only once.
      
      So relax the rules on tagged directories, and make bonding work.
      Signed-off-by: NEric W. Biederman <ebiederm@aristanetworks.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      af10ec77
  3. 08 3月, 2010 4 次提交
  4. 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
  5. 12 12月, 2009 7 次提交
  6. 05 11月, 2009 1 次提交
  7. 15 10月, 2009 1 次提交
  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. 29 7月, 2009 1 次提交
    • P
      sysfs: fix hardlink count on device_move · 0f58b445
      Peter Oberparleiter 提交于
      Update directory hardlink count when moving kobjects to a new parent.
      Fixes the following problem which occurs when several devices are
      moved to the same parent and then unregistered:
      
      > ls -laF /sys/devices/css0/defunct/
      > total 0
      > drwxr-xr-x 4294967295 root root    0 2009-07-14 17:02 ./
      > drwxr-xr-x        114 root root    0 2009-07-14 17:02 ../
      > drwxr-xr-x          2 root root    0 2009-07-14 17:01 power/
      > -rw-r--r--          1 root root 4096 2009-07-14 17:01 uevent
      Signed-off-by: NPeter Oberparleiter <oberpar@linux.vnet.ibm.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0f58b445
  10. 28 3月, 2009 1 次提交
  11. 25 3月, 2009 2 次提交
    • E
      sysfs: don't block indefinitely for unmapped files. · e0edd3c6
      Eric W. Biederman 提交于
      Modify sysfs bin files so that we can remove the bin file while they are
      still mapped.  When the kobject is removed we unmap the bin file and
      arrange for future accesses to the mapping to receive SIGBUS.
      
      Implementing this prevents a nasty DOS when pci devices are hot plugged
      and unplugged.  Where if any of their resources were mmaped the kernel
      could not free up their pci resources or release their pci data
      structures.
      
      [akpm@linux-foundation.org: remove unused var]
      Signed-off-by: NEric W. Biederman <ebiederm@aristanetworks.com>
      Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
      Acked-by: NTejun Heo <tj@kernel.org>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e0edd3c6
    • A
      sysfs: sysfs_add_one WARNs with full path to duplicate filename · 425cb029
      Alex Chiang 提交于
      sysfs: sysfs_add_one WARNs with full path to duplicate filename
      
      As a debugging aid, it can be useful to know the full path to a
      duplicate file being created in sysfs.
      
      We now will display warnings such as:
      
      	sysfs: cannot create duplicate filename '/foo'
      
      when attempting to create multiple files named 'foo' in the sysfs
      root, or:
      
      	sysfs: cannot create duplicate filename '/bus/pci/slots/5/foo'
      
      when attempting to create multiple files named 'foo' under a
      given directory in sysfs.
      
      The path displayed is always a relative path to sysfs_root. The
      leading '/' in the path name refers to the sysfs_root mount
      point, and should not be confused with the "real" '/'.
      
      Thanks to Alex Williamson for essentially writing sysfs_pathname.
      
      Cc: Alex Williamson <alex.williamson@hp.com>
      Signed-off-by: NAlex Chiang <achiang@hp.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      425cb029
  12. 23 10月, 2008 1 次提交
  13. 17 10月, 2008 3 次提交
  14. 27 7月, 2008 1 次提交
  15. 22 7月, 2008 1 次提交
  16. 15 5月, 2008 1 次提交
  17. 20 4月, 2008 1 次提交
  18. 25 1月, 2008 1 次提交
  19. 17 1月, 2008 2 次提交
  20. 31 10月, 2007 1 次提交
  21. 17 10月, 2007 2 次提交
  22. 13 10月, 2007 3 次提交