Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Apr 26, 2024
  2. Nov 14, 2023
  3. Oct 18, 2023
  4. Aug 20, 2022
  5. Sep 19, 2021
  6. Jan 15, 2021
  7. Jan 14, 2021
    • Daniel Colascione's avatar
      fs: add LSM-supporting anon-inode interface · e7e832ce
      Daniel Colascione authored
      
      This change adds a new function, anon_inode_getfd_secure, that creates
      anonymous-node file with individual non-S_PRIVATE inode to which security
      modules can apply policy. Existing callers continue using the original
      singleton-inode kind of anonymous-inode file. We can transition anonymous
      inode users to the new kind of anonymous inode in individual patches for
      the sake of bisection and review.
      
      The new function accepts an optional context_inode parameter that callers
      can use to provide additional contextual information to security modules.
      For example, in case of userfaultfd, the created inode is a 'logical child'
      of the context_inode (userfaultfd inode of the parent process) in the sense
      that it provides the security context required during creation of the child
      process' userfaultfd inode.
      
      Signed-off-by: default avatarDaniel Colascione <dancol@google.com>
      [LG: Delete obsolete comments to alloc_anon_inode()]
      [LG: Add context_inode description in comments to anon_inode_getfd_secure()]
      [LG: Remove definition of anon_inode_getfile_secure() as there are no callers]
      [LG: Make __anon_inode_getfile() static]
      [LG: Use correct error cast in __anon_inode_getfile()]
      [LG: Fix error handling in __anon_inode_getfile()]
      Signed-off-by: default avatarLokesh Gidra <lokeshgidra@google.com>
      Reviewed-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      e7e832ce
  8. May 25, 2019
    • David Howells's avatar
      vfs: Convert anon_inodes to use the new mount API · 33cada40
      David Howells authored
      
      Convert the anon_inodes filesystem to the new internal mount API as the old
      one will be obsoleted and removed.  This allows greater flexibility in
      communication of mount parameters between userspace, the VFS and the
      filesystem.
      
      See Documentation/filesystems/mount_api.txt for more information.
      
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: linux-fsdevel@vger.kernel.org
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      33cada40
    • Al Viro's avatar
      mount_pseudo(): drop 'name' argument, switch to d_make_root() · 1f58bb18
      Al Viro authored
      
      Once upon a time we used to set ->d_name of e.g. pipefs root
      so that d_path() on pipes would work.  These days it's
      completely pointless - dentries of pipes are not even connected
      to pipefs root.  However, mount_pseudo() had set the root
      dentry name (passed as the second argument) and callers
      kept inventing names to pass to it.  Including those that
      didn't *have* any non-root dentries to start with...
      
      All of that had been pointless for about 8 years now; it's
      time to get rid of that cargo-culting...
      
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      1f58bb18
  9. May 21, 2019
  10. Jul 12, 2018
  11. Dec 24, 2016
  12. Mar 27, 2014
  13. Mar 25, 2014
  14. Nov 09, 2013
  15. Jul 16, 2013
  16. Feb 26, 2013
  17. Feb 22, 2013
    • Anatol Pomozov's avatar
      fs: Preserve error code in get_empty_filp(), part 2 · 39b65252
      Anatol Pomozov authored
      
      Allocating a file structure in function get_empty_filp() might fail because
      of several reasons:
       - not enough memory for file structures
       - operation is not allowed
       - user is over its limit
      
      Currently the function returns NULL in all cases and we loose the exact
      reason of the error. All callers of get_empty_filp() assume that the function
      can fail with ENFILE only.
      
      Return error through pointer. Change all callers to preserve this error code.
      
      [AV: cleaned up a bit, carved the get_empty_filp() part out into a separate commit
      (things remaining here deal with alloc_file()), removed pipe(2) behaviour change]
      
      Signed-off-by: default avatarAnatol Pomozov <anatol.pomozov@gmail.com>
      Reviewed-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      39b65252
  18. Mar 20, 2012
  19. Jul 26, 2011
  20. Jul 24, 2011
    • Tim Chen's avatar
      VFS : mount lock scalability for internal mounts · 423e0ab0
      Tim Chen authored
      
      For a number of file systems that don't have a mount point (e.g. sockfs
      and pipefs), they are not marked as long term. Therefore in
      mntput_no_expire, all locks in vfs_mount lock are taken instead of just
      local cpu's lock to aggregate reference counts when we release
      reference to file objects.  In fact, only local lock need to have been
      taken to update ref counts as these file systems are in no danger of
      going away until we are ready to unregister them.
      
      The attached patch marks file systems using kern_mount without
      mount point as long term.  The contentions of vfs_mount lock
      is now eliminated.  Before un-registering such file system,
      kern_unmount should be called to remove the long term flag and
      make the mount point ready to be freed.
      
      Signed-off-by: default avatarTim Chen <tim.c.chen@linux.intel.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      423e0ab0
  21. Jan 16, 2011
    • Al Viro's avatar
      sanitize vfsmount refcounting changes · f03c6599
      Al Viro authored
      Instead of splitting refcount between (per-cpu) mnt_count
      and (SMP-only) mnt_longrefs, make all references contribute
      to mnt_count again and keep track of how many are longterm
      ones.
      
      Accounting rules for longterm count:
      	* 1 for each fs_struct.root.mnt
      	* 1 for each fs_struct.pwd.mnt
      	* 1 for having non-NULL ->mnt_ns
      	* decrement to 0 happens only under vfsmount lock exclusive
      
      That allows nice common case for mntput() - since we can't drop the
      final reference until after mnt_longterm has reached 0 due to the rules
      above, mntput() can grab vfsmount lock shared and check mnt_longterm.
      If it turns out to be non-zero (which is the common case), we know
      that this is not the final mntput() and can just blindly decrement
      percpu mnt_count.  Otherwise we grab vfsmount lock exclusive and
      do usual decrement-and-check of percpu mnt_count.
      
      For fs_struct.c we have mnt_make_longterm() and mnt_make_shortterm();
      namespace.c uses the latter in places where we don't already hold
      vfsm...
      f03c6599
  22. Jan 12, 2011
  23. Jan 07, 2011
    • Nicholas Piggin's avatar
      fs: scale mntget/mntput · b3e19d92
      Nicholas Piggin authored
      The problem that this patch aims to fix is vfsmount refcounting scalability.
      We need to take a reference on the vfsmount for every successful path lookup,
      which often go to the same mount point.
      
      The fundamental difficulty is that a "simple" reference count can never be made
      scalable, because any time a reference is dropped, we must check whether that
      was the last reference. To do that requires communication with all other CPUs
      that may have taken a reference count.
      
      We can make refcounts more scalable in a couple of ways, involving keeping
      distributed counters, and checking for the global-zero condition less
      frequently.
      
      - check the global sum once every interval (this will delay zero detection
        for some interval, so it's probably a showstopper for vfsmounts).
      
      - keep a local count and only taking the global sum when local reaches 0 (this
        is difficult for vfsmounts, because we can't hold preempt off for the life of
        a reference, so a counter would need to be per-thread or tied...
      b3e19d92
    • Nicholas Piggin's avatar
      fs: improve scalability of pseudo filesystems · 4b936885
      Nicholas Piggin authored
      
      Regardless of how much we possibly try to scale dcache, there is likely
      always going to be some fundamental contention when adding or removing children
      under the same parent. Pseudo filesystems do not seem need to have connected
      dentries because by definition they are disconnected.
      
      Signed-off-by: default avatarNick Piggin <npiggin@kernel.dk>
      4b936885
    • Nicholas Piggin's avatar
      fs: dcache reduce branches in lookup path · fb045adb
      Nicholas Piggin authored
      
      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: default avatarNick Piggin <npiggin@kernel.dk>
      fb045adb
  24. Dec 10, 2010
  25. Oct 29, 2010
  26. Oct 25, 2010
  27. May 27, 2010
  28. May 21, 2010
  29. Mar 30, 2010
    • Tejun Heo's avatar
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo authored
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        bloc...
      5a0e3ad6
  30. Mar 12, 2010
    • Eric Paris's avatar
      anon_inodes: mark the anon inode private · 3836a03d
      Eric Paris authored
      Inotify was switched to use anon_inode instead of its own private filesystem
      which only had one inode in commit c44dcc56
      
       "switch inotify_user to
      anon_inode"
      
      The problem with this is that now the inotify inode is not a distinct inode
      which can be managed by LSMs.  userspace tools which use inotify were allowed
      to use the inotify inode but may not have had permission to do read/write type
      operations on the anon_inode.  After looking at the anon_inode and its users
      it looks like the best solution is to just mark the anon_inode as S_PRIVATE
      so the security system will ignore it.
      
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      Acked-by: default avatarJames Morris <jmorris@namei.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3836a03d
  31. Dec 22, 2009