1. 11 8月, 2010 2 次提交
    • M
      vfs: __d_path: dont prepend the name of the root dentry · 98dc568b
      Miklos Szeredi 提交于
      In the old times pseudo-filesystems set the name of theroot dentry to
      some prefix like "pipe:" and the name of the child dentry to "[123]"
      and relied on a hack in __d_path() to replace the preceding slash with
      the root's name to get "pipe:[123]".
      
      Then the d_dname() dentry operation was introduced which solved the
      same problem without having to pre-fill the name in each dentry.
      
      Currently the following pseudo filesystems exist in the kernel:
      
      perfmon
      mtd
      anon_inode
      bdev
      pipe
      socket
      
      Of these only perfmon, anon_inode, pipe and socket create
      sub-dentries, all of which have now been switched to using d_dname().
      
      bdev and mtd only create inodes.
      
      This means that now the hack to overwrite the slash can be removed, so
      for unreachable paths (e.g. within a detached mount) the path string
      won't be polluted with garbage.  For these cases a subsequent patch
      will add a prefix, indicating that the path is unreachable.
      Signed-off-by: NMiklos Szeredi <mszeredi@suse.cz>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      98dc568b
    • M
      vfs: add helpers to get root and pwd · f7ad3c6b
      Miklos Szeredi 提交于
      Add three helpers that retrieve a refcounted copy of the root and cwd
      from the supplied fs_struct.
      
       get_fs_root()
       get_fs_pwd()
       get_fs_root_and_pwd()
      Signed-off-by: NMiklos Szeredi <mszeredi@suse.cz>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      f7ad3c6b
  2. 10 8月, 2010 2 次提交
  3. 19 7月, 2010 1 次提交
    • D
      mm: add context argument to shrinker callback · 7f8275d0
      Dave Chinner 提交于
      The current shrinker implementation requires the registered callback
      to have global state to work from. This makes it difficult to shrink
      caches that are not global (e.g. per-filesystem caches). Pass the shrinker
      structure to the callback so that users can embed the shrinker structure
      in the context the shrinker needs to operate on and get back to it in the
      callback via container_of().
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      7f8275d0
  4. 30 6月, 2010 1 次提交
    • N
      fs: fix superblock iteration race · 57439f87
      npiggin@suse.de 提交于
      list_for_each_entry_safe is not suitable to protect against concurrent
      modification of the list. 6754af64 introduced a race in sb walking.
      
      list_for_each_entry can use the trick of pinning the current entry in
      the list before we drop and retake the lock because it subsequently
      follows cur->next. However list_for_each_entry_safe saves n=cur->next
      for following before entering the loop body, so when the lock is
      dropped, n may be deleted.
      Signed-off-by: NNick Piggin <npiggin@suse.de>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: John Stultz <johnstul@us.ibm.com>
      Cc: Frank Mayhar <fmayhar@google.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      57439f87
  5. 22 5月, 2010 3 次提交
  6. 04 3月, 2010 3 次提交
  7. 17 12月, 2009 1 次提交
  8. 18 7月, 2009 1 次提交
    • F
      sched: Pull up the might_sleep() check into cond_resched() · 613afbf8
      Frederic Weisbecker 提交于
      might_sleep() is called late-ish in cond_resched(), after the
      need_resched()/preempt enabled/system running tests are
      checked.
      
      It's better to check the sleeps while atomic earlier and not
      depend on some environment datas that reduce the chances to
      detect a problem.
      
      Also define cond_resched_*() helpers as macros, so that the
      FILE/LINE reported in the sleeping while atomic warning
      displays the real origin and not sched.h
      
      Changes in v2:
      
       - Call __might_sleep() directly instead of might_sleep() which
         may call cond_resched()
      
       - Turn cond_resched() into a macro so that the file:line
         couple reported refers to the caller of cond_resched() and
         not __cond_resched() itself.
      
      Changes in v3:
      
       - Also propagate this __might_sleep() pull up to
         cond_resched_lock() and cond_resched_softirq()
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <1247725694-6082-6-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      613afbf8
  9. 12 6月, 2009 1 次提交
  10. 09 5月, 2009 1 次提交
  11. 21 4月, 2009 1 次提交
  12. 01 4月, 2009 2 次提交
  13. 28 3月, 2009 1 次提交
  14. 28 2月, 2009 1 次提交
  15. 14 1月, 2009 1 次提交
  16. 09 1月, 2009 1 次提交
  17. 01 1月, 2009 5 次提交
    • E
      filp_cachep can be static in fs/file_table.c · b6b3fdea
      Eric Dumazet 提交于
      Instead of creating the "filp" kmem_cache in vfs_caches_init(),
      we can do it a litle be later in files_init(), so that filp_cachep
      is static to fs/file_table.c
      Acked-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Signed-off-by: NEric Dumazet <dada1@cosmosbay.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      b6b3fdea
    • A
      expand some comments (d_path / seq_path) · 52afeefb
      Arjan van de Ven 提交于
      Explain that you really need to use the return value of d_path rather than
      the buffer you passed into it.
      
      Also fix the comment for seq_path(), the function arguments changed
      recently but the comment hadn't been updated in sync.
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      52afeefb
    • Z
      correct wrong function name of d_put in kernel document and source comment · be42c4c4
      Zhaolei 提交于
      no function named d_put(), it should be dput().
      
      Impact: fix document and comment, no functionality changed
      Signed-off-by: NZhao Lei <zhaolei@cn.fuijtsu.com>
      Signed-off-by: NRandy Dunlap <rdunlap@xenotime.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      be42c4c4
    • A
      fix switch_names() breakage in short-to-short case · dc711ca3
      Al Viro 提交于
      We want ->name.len to match the resulting name on *both*
      source and target
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      dc711ca3
    • N
      shrink struct dentry · c2452f32
      Nick Piggin 提交于
      struct dentry is one of the most critical structures in the kernel. So it's
      sad to see it going neglected.
      
      With CONFIG_PROFILING turned on (which is probably the common case at least
      for distros and kernel developers), sizeof(struct dcache) == 208 here
      (64-bit). This gives 19 objects per slab.
      
      I packed d_mounted into a hole, and took another 4 bytes off the inline
      name length to take the padding out from the end of the structure. This
      shinks it to 200 bytes. I could have gone the other way and increased the
      length to 40, but I'm aiming for a magic number, read on...
      
      I then got rid of the d_cookie pointer. This shrinks it to 192 bytes. Rant:
      why was this ever a good idea? The cookie system should increase its hash
      size or use a tree or something if lookups are a problem. Also the "fast
      dcookie lookups" in oprofile should be moved into the dcookie code -- how
      can oprofile possibly care about the dcookie_mutex? It gets dropped after
      get_dcookie() returns so it can't be providing any sort of protection.
      
      At 192 bytes, 21 objects fit into a 4K page, saving about 3MB on my system
      with ~140 000 entries allocated. 192 is also a multiple of 64, so we get
      nice cacheline alignment on 64 and 32 byte line systems -- any given dentry
      will now require 3 cachelines to touch all fields wheras previously it
      would require 4.
      
      I know the inline name size was chosen quite carefully, however with the
      reduction in cacheline footprint, it should actually be just about as fast
      to do a name lookup for a 36 character name as it was before the patch (and
      faster for other sizes). The memory footprint savings for names which are
      <= 32 or > 36 bytes long should more than make up for the memory cost for
      33-36 byte names.
      
      Performance is a feature...
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      c2452f32
  18. 23 10月, 2008 9 次提交
  19. 29 9月, 2008 1 次提交
    • L
      Fix NULL pointer dereference in proc_sys_compare · d0185c08
      Linus Torvalds 提交于
      The VFS interface for the 'd_compare()' is a bit special (read: 'odd'),
      because it really just essentially replaces a memcmp().  The filesystem
      is supposed to just compare the two names with whatever case-independent
      or other function.
      
      And when I say 'is supposed to', I obviously mean that 'procfs does odd
      things, and actually looks at the dentry that we don't even pass down,
      rather than just the name'.  Which results in problems, because we
      actually call d_compare before we have even verified that the dentry is
      still hashed at all.
      
      And that causes a problm since the inode that procfs looks at may have
      been free'd and the d_inode pointer is NULL.  procfs just assumes that
      all dentries are positive, since procfs itself never generates a
      negative one.  But memory pressure will still result in the dentry
      getting torn down, and as it is removed by RCU, it still remains visible
      on some lists - and to d_compare.
      
      If the filesystem just did a name comparison, we wouldn't care.  And we
      could just fix procfs to know about negative dentries too.  But rather
      than have the low-level filesystems know about internal VFS details,
      just move the check for a unhashed dentry up a bit, so that we will only
      call d_compare on dentries that are still active.
      
      The actual oops this caused didn't look like a NULL pointer dereference
      because procfs did a 'container_of(inode, struct proc_inode, vfs_inode)'
      to get at its internal proc_inode information from the inode pointer,
      and accessed a field below the inode. So the oops would look something
      like
      
      	BUG: unable to handle kernel paging request at fffffffffffffff0
      	IP: [<ffffffff802bc6c6>] proc_sys_compare+0x36/0x50
      
      and was seen on both x86-64 (Alexey Dobriyan and Hugh Dickins) and
      ppc64 (Hugh Dickins).
      Reported-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Acked-by: NHugh Dickins <hugh@veritas.com>
      Cc: Al Viro <viro@ZenIV.linux.org.uk>
      Reviewed-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      Signed-of-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d0185c08
  20. 25 8月, 2008 1 次提交
  21. 28 7月, 2008 1 次提交