1. 06 Jan, 2011 1 commit
  2. 03 Mar, 2010 1 commit
  3. 16 Dec, 2009 4 commits
  4. 11 Jun, 2009 1 commit
  5. 01 Apr, 2009 1 commit
  6. 06 Jan, 2009 1 commit
    • Ian Kent's avatar
      autofs4: make autofs type usage explicit · a92daf6b
      Ian Kent authored
      
      
      - the type assigned at mount when no type is given is changed
        from 0 to AUTOFS_TYPE_INDIRECT. This was done because 0 and
        AUTOFS_TYPE_INDIRECT were being treated implicitly as the same
        type.
      
      - previously, an offset mount had it's type set to
        AUTOFS_TYPE_DIRECT|AUTOFS_TYPE_OFFSET but the mount control
        re-implementation needs to be able distinguish all three types.
        So this was changed to make the type setting explicit.
      
      - a type AUTOFS_TYPE_ANY was added for use by the re-implementation
        when checking if a given path is a mountpoint. It's not really a
        type as we use this to ask if a given path is a mountpoint in the
        autofs_dev_ioctl_ismountpoint() function.
      
      - functions to set and test the autofs mount types have been added to
        improve readability and make the type usage explicit.
      
      - the mount type is used from user space for the mount control
        re-implementtion so, for consistency, all the definitions have
        been moved to the user space include file include/linux/auto_fs4.h.
      
      Signed-off-by: default avatarIan Kent <raven@themaw.net>
      Signed-off-by: default avatarJeff Moyer <jmoyer@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a92daf6b
  7. 16 Oct, 2008 3 commits
  8. 24 Jul, 2008 7 commits
    • Ian Kent's avatar
      autofs4: reorganize expire pending wait function calls · 06a35985
      Ian Kent authored
      
      
      This patch re-orgnirzes the checking for and waiting on active expires and
      elininates redundant checks.
      
      Signed-off-by: default avatarIan Kent <raven@themaw.net>
      Cc: Jeff Moyer <jmoyer@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      06a35985
    • Ian Kent's avatar
      autofs4: fix direct mount pending expire race · 6e60a9ab
      Ian Kent authored
      
      
      For direct and offset type mounts that are covered by another mount we
      cannot check the AUTOFS_INF_EXPIRING flag during a path walk which leads
      to lookups walking into an expiring mount while it is being expired.
      
      For example, for the direct multi-mount map entry with a couple of
      offsets:
      
      /race/mm1  /      <server1>:/<path1>
                 /om1   <server2>:/<path2>
                 /om2   <server1>:/<path3>
      
      an autofs trigger mount is mounted on /race/mm1 and when accessed it is
      over mounted and trigger mounts made for /race/mm1/om1 and /race/mm1/om2.
      So it isn't possible for path walks to see the expiring flag at all and
      they happily walk into the file system while it is expiring.
      
      When expiring these mounts follow_down() must stop at the autofs mount and
      all processes must block in the ->follow_link() method (except the daemon)
      until the expire is complete.  This is done by decrementing the d_mounted
      field of the autofs trigger mount root dentry until the expire is
      completed.  In ->follow_link() all processes wait on the expire and the
      mount following is completed for the daemon until the expire is complete.
      
      Signed-off-by: default avatarIan Kent <raven@themaw.net>
      Cc: Jeff Moyer <jmoyer@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6e60a9ab
    • Ian Kent's avatar
      autofs4: fix indirect mount pending expire race · 97e7449a
      Ian Kent authored
      
      
      The selection of a dentry for expiration and the setting of the
      AUTOFS_INF_EXPIRING flag isn't done atomically which can lead to lookups
      walking into an expiring mount.
      
      What happens is that an expire is initiated by the daemon and a dentry is
      selected for expire but, since there is no lock held between the selection
      and setting of the expiring flag, a process may find the flag clear and
      continue walking into the mount tree at the same time the daemon attempts
      the expire it.
      
      Signed-off-by: default avatarIan Kent <raven@themaw.net>
      Reviewed-by: default avatarJeff Moyer <jmoyer@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      97e7449a
    • Ian Kent's avatar
      autofs4: fix waitq memory leak · 296f7bf7
      Ian Kent authored
      
      
      If an autofs mount becomes catatonic before autofs4_wait_release() is
      called the wait queue counter will not be decremented down to zero and the
      entry will never be freed.  There are also races decrementing the wait
      counter in the wait release function.  To deal with this the counter needs
      to be updated while holding the wait queue mutex and waiters need to be
      woken up unconditionally when the wait is removed from the queue to ensure
      we eventually free the wait.
      
      Signed-off-by: default avatarIan Kent <raven@themaw.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      296f7bf7
    • Jeff Moyer's avatar
      autofs4: use struct qstr in waitq.c · 70b52a0a
      Jeff Moyer authored
      
      
      The autofs_wait_queue already contains all of the fields of the
      struct qstr, so change it into a qstr.
      
      This patch, from Jeff Moyer, has been modified a liitle by myself.
      
      Signed-off-by: default avatarJeff Moyer <jmoyer@redhat.com>
      Signed-off-by: default avatarIan Kent <raven@themaw.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      70b52a0a
    • Ian Kent's avatar
      autofs4: use look aside list for lookups · 25767378
      Ian Kent authored
      
      
      A while ago a patch to resolve a deadlock during directory creation was
      merged.  This delayed the hashing of lookup dentrys until the ->mkdir()
      (or ->symlink()) operation completed to ensure we always went through
      ->lookup() instead of also having processes go through ->revalidate() so
      our VFS locking remained consistent.
      
      Now we are seeing a couple of side affects of that change in situations
      with heavy mount activity.
      
      Two cases have been identified:
      
      1) When a mount request is triggered, due to the delayed hashing, the
         directory created by user space for the mount point doesn't have the
         DCACHE_AUTOFS_PENDING flag set.  In the case of an autofs multi-mount
         where a tree of mount point directories are created this can lead to
         the path walk continuing rather than the dentry being sent to the wait
         queue to wait for request completion.  This is because, if the pending
         flag isn't set, the criteria for deciding this is a mount in progress
         fails to hold, namely that the dentry is not a mount point and has no
         subdirectories.
      
      2) A mount request dentry is initially created negative and unhashed.
         It remains this way until the ->mkdir() callback completes.  Since it
         is unhashed a fresh dentry is used when the user space mount request
         creates the mount point directory.  This leaves the original dentry
         negative and unhashed.  But revalidate has no way to tell the VFS that
         the dentry has changed, other than to force another ->lookup() by
         returning false, which is at best wastefull and at worst not possible.
         This results in an -ENOENT return from the original path walk when in
         fact the mount succeeded.
      
      To resolve this we need to ensure that the same dentry is used in all
      calls to ->lookup() during the course of a mount request.  This patch
      achieves that by adding the initial dentry to a look aside list and
      removes it at ->mkdir() or ->symlink() completion (or when the dentry is
      released), since these are the only create operations autofs4 supports.
      
      Signed-off-by: default avatarIan Kent <raven@themaw.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      25767378
    • Ian Kent's avatar
      autofs4: don't make expiring dentry negative · 5f6f4f28
      Ian Kent authored
      
      
      Correct the error of making a positive dentry negative after it has been
      instantiated.
      
      The code that makes this error attempts to re-use the dentry from a
      concurrent expire and mount to resolve a race and the dentry used for the
      lookup must be negative for mounts to trigger in the required cases.  The
      fact is that the dentry doesn't need to be re-used because all that is
      needed is to preserve the flag that indicates an expire is still
      incomplete at the time of the mount request.
      
      This change uses the the dentry to check the flag and wait for the expire
      to complete then discards it instead of attempting to re-use it.
      
      Signed-off-by: default avatarIan Kent <raven@themaw.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5f6f4f28
  9. 30 Apr, 2008 1 commit
  10. 19 Oct, 2007 1 commit
    • Pavel Emelianov's avatar
      pid namespaces: round up the API · a47afb0f
      Pavel Emelianov authored
      
      
      The set of functions process_session, task_session, process_group and
      task_pgrp is confusing, as the names can be mixed with each other when looking
      at the code for a long time.
      
      The proposals are to
      * equip the functions that return the integer with _nr suffix to
        represent that fact,
      * and to make all functions work with task (not process) by making
        the common prefix of the same name.
      
      For monotony the routines signal_session() and set_signal_session() are
      replaced with task_session_nr() and set_task_session(), especially since they
      are only used with the explicit task->signal dereference.
      
      Signed-off-by: default avatarPavel Emelianov <xemul@openvz.org>
      Acked-by: default avatarSerge E. Hallyn <serue@us.ibm.com>
      Cc: Kirill Korotaev <dev@openvz.org>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Cedric Le Goater <clg@fr.ibm.com>
      Cc: Herbert Poetzl <herbert@13thfloor.at>
      Cc: Sukadev Bhattiprolu <sukadev@us.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a47afb0f
  11. 20 Feb, 2007 1 commit
    • Ian Kent's avatar
      [PATCH] autofs4: fix another race between mount and expire · f50b6f86
      Ian Kent authored
      
      
      Jeff Moyer has identified a race between mount and expire.
      
      What happens is that during an expire the situation can arise that a directory
      is removed and another lookup is done before the expire issues a completion
      status to the kernel module.  In this case, since the the lookup gets a new
      dentry, it doesn't know that there is an expire in progress and when it posts
      its mount request, matches the existing expire request and waits for its
      completion.  ENOENT is then returned to user space from lookup (as the dentry
      passed in is now unhashed) without having performed the mount request.
      
      The solution used here is to keep track of dentrys in this unhashed state and
      reuse them, if possible, in order to preserve the flags.  Additionally, this
      infrastructure will provide the framework for the reintroduction of caching of
      mount fails removed earlier in development.
      
      Signed-off-by: default avatarIan Kent <raven@themaw.net>
      Acked-by: default avatarJeff Moyer <jmoyer@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f50b6f86
  12. 12 Feb, 2007 1 commit
  13. 08 Dec, 2006 1 commit
  14. 11 Oct, 2006 1 commit
  15. 24 Sep, 2006 1 commit
  16. 15 May, 2006 1 commit
    • Ian Kent's avatar
      [PATCH] autofs4: NFY_NONE wait race fix · a5370553
      Ian Kent authored
      
      
      This patch fixes two problems.
      
      First, the comparison of entries in the waitq.c was incorrect.
      
      Second, the NFY_NONE check was incorrect. The test of whether the dentry
      is mounted if ineffective, for example, if an expire fails then we could
      wait forever on a non existant expire. The bug was identified by Jeff
      Moyer.
      
      The patch changes autofs4 to wait on expires only as this is all that's
      needed.  If there is no existing wait when autofs4_wait is call with a type
      of NFY_NONE it delays until either a wait appears or the the expire flag is
      cleared.
      
      Signed-off-by: default avatarIan Kent <raven@themaw.net>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      a5370553
  17. 28 Mar, 2006 2 commits
  18. 27 Mar, 2006 8 commits
  19. 23 Mar, 2006 1 commit
  20. 08 Jan, 2006 1 commit
    • Eric Dumazet's avatar
      [PATCH] shrink dentry struct · 5160ee6f
      Eric Dumazet authored
      
      
      Some long time ago, dentry struct was carefully tuned so that on 32 bits
      UP, sizeof(struct dentry) was exactly 128, ie a power of 2, and a multiple
      of memory cache lines.
      
      Then RCU was added and dentry struct enlarged by two pointers, with nice
      results for SMP, but not so good on UP, because breaking the above tuning
      (128 + 8 = 136 bytes)
      
      This patch reverts this unwanted side effect, by using an union (d_u),
      where d_rcu and d_child are placed so that these two fields can share their
      memory needs.
      
      At the time d_free() is called (and d_rcu is really used), d_child is known
      to be empty and not touched by the dentry freeing.
      
      Lockless lookups only access d_name, d_parent, d_lock, d_op, d_flags (so
      the previous content of d_child is not needed if said dentry was unhashed
      but still accessed by a CPU because of RCU constraints)
      
      As dentry cache easily contains millions of entries, a size reduction is
      worth the extra complexity of the ugly C union.
      
      Signed-off-by: default avatarEric Dumazet <dada1@cosmosbay.com>
      Cc: Dipankar Sarma <dipankar@in.ibm.com>
      Cc: Maneesh Soni <maneesh@in.ibm.com>
      Cc: Miklos Szeredi <miklos@szeredi.hu>
      Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
      Cc: Ian Kent <raven@themaw.net>
      Cc: Paul Jackson <pj@sgi.com>
      Cc: Al Viro <viro@ftp.linux.org.uk>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
      Cc: Neil Brown <neilb@cse.unsw.edu.au>
      Cc: James Morris <jmorris@namei.org>
      Cc: Stephen Smalley <sds@epoch.ncsc.mil>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      5160ee6f
  21. 27 Jul, 2005 1 commit