1. 10 4月, 2012 1 次提交
  2. 09 3月, 2012 1 次提交
  3. 01 2月, 2012 1 次提交
  4. 25 1月, 2012 3 次提交
  5. 02 11月, 2011 1 次提交
    • E
      sysfs: Make sysfs_rename safe with sysfs_dirents in rbtrees. · f6d90b4f
      Eric W. Biederman 提交于
      In sysfs_rename we need to remove the optimization of not calling
      sysfs_unlink_sibling and sysfs_link_sibling if the renamed parent
      directory is not changing.  This optimization is no longer valid now
      that sysfs dirents are stored in an rbtree sorted by name.
      
      Move the assignment of s_ns before the call of sysfs_link_sibling.  With
      no sysfs_dirent fields changing after the call of sysfs_link_sibling
      this allows sysfs_link_sibling to take any of the directory entries into
      account when it builds the rbtrees, and s_ns looks like a prime canidate
      to be used in the rbtree in the future.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Cc: Jiri Slaby <jirislaby@gmail.com>
      Cc: Greg KH <gregkh@suse.de>
      Cc: David Miller <davem@davemloft.net>
      Cc: Mikulas Patocka <mpatocka@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f6d90b4f
  6. 25 10月, 2011 1 次提交
  7. 20 10月, 2011 2 次提交
  8. 27 9月, 2011 1 次提交
  9. 23 8月, 2011 4 次提交
  10. 07 1月, 2011 3 次提交
    • N
      fs: rcu-walk aware d_revalidate method · 34286d66
      Nick Piggin 提交于
      Require filesystems be aware of .d_revalidate being called in rcu-walk
      mode (nd->flags & LOOKUP_RCU). For now do a simple push down, returning
      -ECHILD from all implementations.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      34286d66
    • N
      fs: dcache reduce branches in lookup path · fb045adb
      Nick Piggin 提交于
      Reduce some branches and memory accesses in dcache lookup by adding dentry
      flags to indicate common d_ops are set, rather than having to check them.
      This saves a pointer memory access (dentry->d_op) in common path lookup
      situations, and saves another pointer load and branch in cases where we
      have d_op but not the particular operation.
      
      Patched with:
      
      git grep -E '[.>]([[:space:]])*d_op([[:space:]])*=' | xargs sed -e 's/\([^\t ]*\)->d_op = \(.*\);/d_set_d_op(\1, \2);/' -e 's/\([^\t ]*\)\.d_op = \(.*\);/d_set_d_op(\&\1, \2);/' -i
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      fb045adb
    • 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
  11. 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
  12. 08 3月, 2010 4 次提交
  13. 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
  14. 12 12月, 2009 7 次提交
  15. 05 11月, 2009 1 次提交
  16. 15 10月, 2009 1 次提交
  17. 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
  18. 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
  19. 28 3月, 2009 1 次提交
  20. 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