1. 17 2月, 2007 1 次提交
  2. 13 2月, 2007 2 次提交
  3. 12 2月, 2007 1 次提交
  4. 08 2月, 2007 6 次提交
    • E
      sysfs: Shadow directory support · b592fcfe
      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/*. 
      
      What I want is a separate /sys/class/net directory in sysfs for each
      network namespace, and I want to name each of them /sys/class/net.
      
      I looked and the VFS actually allows that.  All that is needed is
      for /sys/class/net to implement a follow link method to redirect
      lookups to the real directory you want. 
      
      Implementing a follow link method that is sensitive to the current
      network namespace turns out to be 3 lines of code so it looks like a
      clean approach.  Modifying sysfs so it doesn't get in my was is a bit
      trickier. 
      
      I am calling the concept of multiple directories all at the same path
      in the filesystem shadow directories.  With the directory entry really
      at that location the shadow master. 
      
      The following patch modifies sysfs so it can handle a directory
      structure slightly different from the kobject tree so I can implement
      the shadow directories for handling /sys/class/net/.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Cc: Maneesh Soni <maneesh@in.ibm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      b592fcfe
    • O
      sysfs: error handling in sysfs, fill_read_buffer() · 82244b16
      Oliver Neukum 提交于
      if a driver returns an error in fill_read_buffer(), the buffer will be
      marked as filled. Subsequent reads will return eof. But there is
      no data because of an error, not because it has been read.
      Not marking the buffer filled is the obvious fix.
      Signed-off-by: NOliver Neukum <oliver@neukum.name>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      82244b16
    • M
      sysfs: kobject_put cleanup · f7506536
      Mariusz Kozlowski 提交于
      This patch removes redundant argument checks for kobject_put().
      Signed-off-by: NMariusz Kozlowski <m.kozlowski@tuxland.pl>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      f7506536
    • F
      sysfs: suppress lockdep warnings · d3fc373a
      Frederik Deweerdt 提交于
      Lockdep issues the following warning:
      [    9.064000] =============================================
      [    9.064000] [ INFO: possible recursive locking detected ]
      [    9.064000] 2.6.20-rc3-mm1 #3
      [    9.064000] ---------------------------------------------
      [    9.064000] init/1 is trying to acquire lock:
      [    9.064000]  (&sysfs_inode_imutex_key){--..}, at: [<c03e6afc>] mutex_lock+0x1c/0x1f
      [    9.064000]
      [    9.064000] but task is already holding lock:
      [    9.064000]  (&sysfs_inode_imutex_key){--..}, at: [<c03e6afc>] mutex_lock+0x1c/0x1f
      [    9.065000]
      [    9.065000] other info that might help us debug this:
      [    9.065000] 2 locks held by init/1:
      [    9.065000]  #0:  (tty_mutex){--..}, at: [<c03e6afc>] mutex_lock+0x1c/0x1f
      [    9.065000]  #1:  (&sysfs_inode_imutex_key){--..}, at: [<c03e6afc>] mutex_lock+0x1c/0x1f
      [    9.065000]
      [    9.065000] stack backtrace:
      [    9.065000]  [<c010390d>] show_trace_log_lvl+0x1a/0x30
      [    9.066000]  [<c0103935>] show_trace+0x12/0x14
      [    9.066000]  [<c0103a2f>] dump_stack+0x16/0x18
      [    9.066000]  [<c0138cb8>] print_deadlock_bug+0xb9/0xc3
      [    9.066000]  [<c0138d17>] check_deadlock+0x55/0x5a
      [    9.066000]  [<c013a953>] __lock_acquire+0x371/0xbf0
      [    9.066000]  [<c013b7a9>] lock_acquire+0x69/0x83
      [    9.066000]  [<c03e6b7e>] __mutex_lock_slowpath+0x75/0x2d1
      [    9.066000]  [<c03e6afc>] mutex_lock+0x1c/0x1f
      [    9.066000]  [<c01b249c>] sysfs_drop_dentry+0xb1/0x133
      [    9.066000]  [<c01b25d1>] sysfs_hash_and_remove+0xb3/0x142
      [    9.066000]  [<c01b30ed>] sysfs_remove_file+0xd/0x10
      [    9.067000]  [<c02849e0>] device_remove_file+0x23/0x2e
      [    9.067000]  [<c02850b2>] device_del+0x188/0x1e6
      [    9.067000]  [<c028511b>] device_unregister+0xb/0x15
      [    9.067000]  [<c0285318>] device_destroy+0x9c/0xa9
      [    9.067000]  [<c0261431>] vcs_remove_sysfs+0x1c/0x3b
      [    9.067000]  [<c0267a08>] con_close+0x5e/0x6b
      [    9.067000]  [<c02598f2>] release_dev+0x4c4/0x6e5
      [    9.067000]  [<c0259faa>] tty_release+0x12/0x1c
      [    9.067000]  [<c0174872>] __fput+0x177/0x1a0
      [    9.067000]  [<c01746f5>] fput+0x3b/0x41
      [    9.068000]  [<c0172ee1>] filp_close+0x36/0x65
      [    9.068000]  [<c0172f73>] sys_close+0x63/0xa4
      [    9.068000]  [<c0102a96>] sysenter_past_esp+0x5f/0x99
      [    9.068000]  =======================
      
      This is due to sysfs_hash_and_remove() holding dir->d_inode->i_mutex
      before calling sysfs_drop_dentry() which calls orphan_all_buffers()
      which in turn takes node->i_mutex.
      Signed-off-by: NFrederik Deweerdt <frederik.deweerdt@gmail.com>
      Cc: Oliver Neukum <oliver@neukum.org>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d3fc373a
    • O
      Driver core: fix race in sysfs between sysfs_remove_file() and read()/write() · 94bebf4d
      Oliver Neukum 提交于
      This patch prevents a race between IO and removing a file from sysfs.
      It introduces a list of sysfs_buffers associated with a file at the inode.
      Upon removal of a file the list is walked and the buffers marked orphaned.
      IO to orphaned buffers fails with -ENODEV. The driver can safely free
      associated data structures or be unloaded.
      Signed-off-by: NOliver Neukum <oliver@neukum.name>
      Acked-by: NManeesh Soni <maneesh@in.ibm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      94bebf4d
    • C
      driver core: Allow device_move(dev, NULL). · c744aeae
      Cornelia Huck 提交于
      If we allow NULL as the new parent in device_move(), we need to make sure
      that the device is placed into the same place as it would if it was
      newly registered:
      
      - Consider the device virtual tree. In order to be able to reuse code,
        setup_parent() has been tweaked a bit.
      - kobject_move() can fall back to the kset's kobject.
      - sysfs_move_dir() uses the sysfs root dir as fallback.
      Signed-off-by: NCornelia Huck <cornelia.huck@de.ibm.com>
      Cc: Marcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      c744aeae
  5. 09 12月, 2006 1 次提交
  6. 08 12月, 2006 1 次提交
  7. 02 12月, 2006 2 次提交
  8. 19 10月, 2006 2 次提交
    • H
      sysfs: update obsolete comment in sysfs_update_file · 97a50184
      Hidetoshi Seto 提交于
      And the obsolete comment should be updated (or totally removed).
      Signed-off-by: NHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      97a50184
    • H
      sysfs: remove duplicated dput in sysfs_update_file · e4234451
      Hidetoshi Seto 提交于
      Following function can drops d_count twice against one reference
      by lookup_one_len.
      
      <SOURCE>
      /**
       * sysfs_update_file - update the modified timestamp on an object attribute.
       * @kobj: object we're acting for.
       * @attr: attribute descriptor.
       */
      int sysfs_update_file(struct kobject * kobj, const struct attribute * attr)
      {
              struct dentry * dir = kobj->dentry;
              struct dentry * victim;
              int res = -ENOENT;
      
              mutex_lock(&dir->d_inode->i_mutex);
              victim = lookup_one_len(attr->name, dir, strlen(attr->name));
              if (!IS_ERR(victim)) {
                      /* make sure dentry is really there */
                      if (victim->d_inode &&
                          (victim->d_parent->d_inode == dir->d_inode)) {
                              victim->d_inode->i_mtime = CURRENT_TIME;
                              fsnotify_modify(victim);
      
                              /**
                               * Drop reference from initial sysfs_get_dentry().
                               */
                              dput(victim);
                              res = 0;
                      } else
                              d_drop(victim);
      
                      /**
                       * Drop the reference acquired from sysfs_get_dentry() above.
                       */
                      dput(victim);
              }
              mutex_unlock(&dir->d_inode->i_mutex);
      
              return res;
      }
      </SOURCE>
      
      PCI-hotplug (drivers/pci/hotplug/pci_hotplug_core.c) is only user of
      this function. I confirmed that dentry of /sys/bus/pci/slots/XXX/*
      have negative d_count value.
      
      This patch removes unnecessary dput().
      Signed-off-by: NHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
      Acked-by: NManeesh Soni <maneesh@in.ibm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e4234451
  9. 03 10月, 2006 1 次提交
  10. 01 10月, 2006 1 次提交
  11. 27 9月, 2006 1 次提交
  12. 26 9月, 2006 3 次提交
  13. 13 7月, 2006 1 次提交
  14. 29 6月, 2006 1 次提交
  15. 27 6月, 2006 1 次提交
  16. 23 6月, 2006 1 次提交
    • D
      [PATCH] VFS: Permit filesystem to override root dentry on mount · 454e2398
      David Howells 提交于
      Extend the get_sb() filesystem operation to take an extra argument that
      permits the VFS to pass in the target vfsmount that defines the mountpoint.
      
      The filesystem is then required to manually set the superblock and root dentry
      pointers.  For most filesystems, this should be done with simple_set_mnt()
      which will set the superblock pointer and then set the root dentry to the
      superblock's s_root (as per the old default behaviour).
      
      The get_sb() op now returns an integer as there's now no need to return the
      superblock pointer.
      
      This patch permits a superblock to be implicitly shared amongst several mount
      points, such as can be done with NFS to avoid potential inode aliasing.  In
      such a case, simple_set_mnt() would not be called, and instead the mnt_root
      and mnt_sb would be set directly.
      
      The patch also makes the following changes:
      
       (*) the get_sb_*() convenience functions in the core kernel now take a vfsmount
           pointer argument and return an integer, so most filesystems have to change
           very little.
      
       (*) If one of the convenience function is not used, then get_sb() should
           normally call simple_set_mnt() to instantiate the vfsmount. This will
           always return 0, and so can be tail-called from get_sb().
      
       (*) generic_shutdown_super() now calls shrink_dcache_sb() to clean up the
           dcache upon superblock destruction rather than shrink_dcache_anon().
      
           This is required because the superblock may now have multiple trees that
           aren't actually bound to s_root, but that still need to be cleaned up. The
           currently called functions assume that the whole tree is rooted at s_root,
           and that anonymous dentries are not the roots of trees which results in
           dentries being left unculled.
      
           However, with the way NFS superblock sharing are currently set to be
           implemented, these assumptions are violated: the root of the filesystem is
           simply a dummy dentry and inode (the real inode for '/' may well be
           inaccessible), and all the vfsmounts are rooted on anonymous[*] dentries
           with child trees.
      
           [*] Anonymous until discovered from another tree.
      
       (*) The documentation has been adjusted, including the additional bit of
           changing ext2_* into foo_* in the documentation.
      
      [akpm@osdl.org: convert ipath_fs, do other stuff]
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Acked-by: NAl Viro <viro@zeniv.linux.org.uk>
      Cc: Nathan Scott <nathans@sgi.com>
      Cc: Roland Dreier <rolandd@cisco.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      454e2398
  17. 15 4月, 2006 1 次提交
    • N
      [PATCH] sysfs: Allow sysfs attribute files to be pollable · 4508a7a7
      NeilBrown 提交于
      It works like this:
        Open the file
        Read all the contents.
        Call poll requesting POLLERR or POLLPRI (so select/exceptfds works)
        When poll returns,
           close the file and go to top of loop.
         or lseek to start of file and go back to the 'read'.
      
      Events are signaled by an object manager calling
         sysfs_notify(kobj, dir, attr);
      
      If the dir is non-NULL, it is used to find a subdirectory which
      contains the attribute (presumably created by sysfs_create_group).
      
      This has a cost of one int  per attribute, one wait_queuehead per kobject,
      one int per open file.
      
      The name "sysfs_notify" may be confused with the inotify
      functionality.  Maybe it would be nice to support inotify for sysfs
      attributes as well?
      
      This patch also uses sysfs_notify to allow /sys/block/md*/md/sync_action
      to be pollable
      Signed-off-by: NNeil Brown <neilb@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4508a7a7
  18. 03 4月, 2006 1 次提交
  19. 02 4月, 2006 1 次提交
  20. 01 4月, 2006 1 次提交
  21. 29 3月, 2006 1 次提交
  22. 21 3月, 2006 5 次提交
  23. 12 1月, 2006 1 次提交
  24. 10 1月, 2006 1 次提交
  25. 05 1月, 2006 1 次提交
  26. 27 8月, 2005 1 次提交
    • J
      [PATCH] Fix oops in sysfs_hash_and_remove_file() · 36676bcb
      James Bottomley 提交于
      The problem arises if an entity in sysfs is created and removed without
      ever having been made completely visible.  In SCSI this is triggered by
      removing a device while it's initialising.
      
      The problem appears to be that because it was never made visible in sysfs,
      the sysfs dentry has a null d_inode which oopses when a reference is made
      to it.  The solution is simply to check d_inode and assume the object was
      never made visible (and thus doesn't need deleting) if it's NULL.
      
      (akpm: possibly a stopgap for 2.6.13 scsi problems.  May not be the
      long-term fix)
      Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
      Cc: Greg KH <greg@kroah.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      36676bcb