04 Mar, 2010

1 commit


16 Dec, 2009

4 commits

  • We need to be able to cope with the directory mutex being held during
    ->d_revalidate() in some cases, but not all cases, and not necessarily by
    us. Because we need to release the mutex when we call back to the daemon
    to do perform a mount we must be sure that it is us who holds the mutex so
    we must redirect mount requests to ->lookup() if the mutex is held.

    Signed-off-by: Ian Kent
    Cc: Sage Weil
    Cc: Al Viro
    Cc: Andreas Dilger
    Cc: Christoph Hellwig
    Cc: Yehuda Saheh
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     
  • Eliminate the use of the d_lock spin lock by using the autofs super block
    info spin lock. This reduces the number of spin locks we use by one and
    makes the code for the following patch (to redirect ->d_revalidate() to
    ->lookup()) a little simpler.

    Signed-off-by: Ian Kent
    Cc: Sage Weil
    Cc: Al Viro
    Cc: Andreas Dilger
    Cc: Christoph Hellwig
    Cc: Yehuda Saheh
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     
  • Define some simple helper functions for adding and deleting entries on the
    expiring dentry list.

    Signed-off-by: Ian Kent
    Cc: Sage Weil
    Cc: Al Viro
    Cc: Andreas Dilger
    Cc: Christoph Hellwig
    Cc: Yehuda Saheh
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     
  • Define some simple helper functions for adding and deleting entries on the
    active (and unhashed) dentry list.

    Signed-off-by: Ian Kent
    Cc: Sage Weil
    Cc: Al Viro
    Cc: Andreas Dilger
    Cc: Christoph Hellwig
    Cc: Yehuda Saheh
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     

12 Jun, 2009

1 commit


01 Apr, 2009

1 commit

  • A significant portion of the autofs_dev_ioctl_expire() and
    autofs4_expire_multi() functions is duplicated code. This patch cleans that
    up.

    Signed-off-by: Ian Kent
    Signed-off-by: Jeff Moyer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     

07 Jan, 2009

1 commit

  • - 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: Ian Kent
    Signed-off-by: Jeff Moyer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     

17 Oct, 2008

3 commits

  • Add a miscellaneous device to the autofs4 module for routing ioctls. This
    provides the ability to obtain an ioctl file handle for an autofs mount
    point that is possibly covered by another mount.

    The actual problem with autofs is that it can't reconnect to existing
    mounts. Immediately one things of just adding the ability to remount
    autofs file systems would solve it, but alas, that can't work. This is
    because autofs direct mounts and the implementation of "on demand mount
    and expire" of nested mount trees have the file system mounted on top of
    the mount trigger dentry.

    To resolve this a miscellaneous device node for routing ioctl commands to
    these mount points has been implemented in the autofs4 kernel module and a
    library added to autofs. This provides the ability to open a file
    descriptor for these over mounted autofs mount points.

    Please refer to Documentation/filesystems/autofs4-mount-control.txt for a
    discussion of the problem, implementation alternatives considered and a
    description of the interface.

    [akpm@linux-foundation.org: coding-style fixes]
    [akpm@linux-foundation.org: build fix]
    Signed-off-by: Ian Kent
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     
  • Track the uid and gid of the last process to request a mount for on an
    autofs dentry.

    [akpm@linux-foundation.org: fix tpyo in comment]
    Signed-off-by: Ian Kent
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     
  • Usage of the AUTOFS_TYPE_* defines is a little confusing and appears
    inconsistent.

    Signed-off-by: Ian Kent
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     

25 Jul, 2008

7 commits

  • This patch re-orgnirzes the checking for and waiting on active expires and
    elininates redundant checks.

    Signed-off-by: Ian Kent
    Cc: Jeff Moyer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     
  • 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 / :/
    /om1 :/
    /om2 :/

    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: Ian Kent
    Cc: Jeff Moyer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     
  • 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: Ian Kent
    Reviewed-by: Jeff Moyer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     
  • 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: Ian Kent
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     
  • 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: Jeff Moyer
    Signed-off-by: Ian Kent
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Moyer
     
  • 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: Ian Kent
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     
  • 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: Ian Kent
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     

30 Apr, 2008

1 commit


20 Oct, 2007

1 commit

  • 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: Pavel Emelianov
    Acked-by: Serge E. Hallyn
    Cc: Kirill Korotaev
    Cc: "Eric W. Biederman"
    Cc: Cedric Le Goater
    Cc: Herbert Poetzl
    Cc: Sukadev Bhattiprolu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Pavel Emelianov
     

21 Feb, 2007

1 commit

  • 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: Ian Kent
    Acked-by: Jeff Moyer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     

13 Feb, 2007

1 commit

  • Many struct inode_operations in the kernel can be "const". Marking them const
    moves these to the .rodata section, which avoids false sharing with potential
    dirty data. In addition it'll catch accidental writes at compile time to
    these shared resources.

    Signed-off-by: Arjan van de Ven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arjan van de Ven
     

09 Dec, 2006

1 commit


12 Oct, 2006

1 commit

  • Make sure all dentries refs are released before calling kill_anon_super() so
    that the assumption that generic_shutdown_super() can completely destroy the
    dentry tree for there will be no external references holds true.

    What was being done in the put_super() superblock op, is now done in the
    kill_sb() filesystem op instead, prior to calling kill_anon_super().

    This makes the struct autofs_sb_info::root member variable redundant (since
    sb->s_root is still available), and so that is removed. The calls to
    shrink_dcache_sb() are also removed since they're also redundant as
    shrink_dcache_for_umount() will now be called after the cleanup routine.

    Signed-off-by: David Howells
    Acked-by: Ian Kent
    Cc: Trond Myklebust
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     

24 Sep, 2006

1 commit


16 May, 2006

1 commit

  • 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: Ian Kent
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     

29 Mar, 2006

2 commits


28 Mar, 2006

8 commits

  • Fix accidental underflow of the atomic counter.

    Signed-off-by: Ian Kent
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     
  • Signed-off-by: Ian Kent
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     
  • This patch define a new autofs packet for autofs v5 and updates the waitq.c
    functions to handle the additional packet type.

    Signed-off-by: Ian Kent
    Cc: Al Viro
    Cc: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     
  • This patch adds a follow_link inode method for the root of an autofs direct
    mount trigger. It also adds the corresponding mount options and updates the
    show_mount method.

    Signed-off-by: Ian Kent
    Cc: Al Viro
    Cc: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     
  • Rename the function simple_empty_nolock to __simple_empty in line with kernel
    naming conventions.

    Signed-off-by: Ian Kent
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     
  • Add show_options method to display autofs4 mount options in the proc
    filesystem.

    Signed-off-by: Ian Kent
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     
  • Fix the case where an expire returns busy on a tree mount when it is in fact
    not busy. This case was overlooked when the patch to prevent the expiring
    away of "scaffolding" directories for tree mounts was applied.

    The problem arises when a tree of mounts is a member of a map with other keys.
    The current logic will not expire the tree if any other mount in the map is
    busy. The solution is to maintain a "minimum" use count for each autofs
    dentry and compare this to the actual dentry usage count during expire.

    Signed-off-by: Ian Kent
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     
  • Addresse a problem where stale dentrys stop mounts from happening.

    When a mount point directory is pre-created and a non-existent entry within it
    is requested a dentry ends up being created within the mount point directory
    which stops future mounts. The problem is solved by ignoring negative,
    unhashed dentrys in the mount point d_subdirs list.

    Additionally the apparent cacheing of -ENOENT returns from requests is
    removed. The test on d_time is a tautology and d_time is not initialised and
    has an unexpected value. In short it doesn't do what it's meant to.

    The cacheing of failed requests to the daemon is important and will be
    followed up later.

    Signed-off-by: Ian Kent
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ian Kent
     

23 Mar, 2006

1 commit

  • Semaphore to mutex conversion.

    The conversion was generated via scripts, and the result was validated
    automatically via a script as well.

    Signed-off-by: Ingo Molnar
    Acked-by: Ian Kent
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ingo Molnar
     

09 Jan, 2006

1 commit

  • 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: Eric Dumazet
    Cc: Dipankar Sarma
    Cc: Maneesh Soni
    Cc: Miklos Szeredi
    Cc: "Paul E. McKenney"
    Cc: Ian Kent
    Cc: Paul Jackson
    Cc: Al Viro
    Cc: Christoph Hellwig
    Cc: Trond Myklebust
    Cc: Neil Brown
    Cc: James Morris
    Cc: Stephen Smalley
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Dumazet
     

28 Jul, 2005

1 commit


22 Jun, 2005

1 commit