1. 04 3月, 2010 1 次提交
  2. 16 12月, 2009 10 次提交
  3. 12 6月, 2009 1 次提交
  4. 01 4月, 2009 1 次提交
    • I
      autofs4: fix lookup deadlock · 8f63aaa8
      Ian Kent 提交于
      A deadlock can occur when user space uses a signal (autofs version 4 uses
      SIGCHLD for this) to effect expire completion.
      
      The order of events is:
      
      Expire process completes, but before being able to send SIGCHLD to it's parent
      ...
      
      Another process walks onto a different mount point and drops the directory
      inode semaphore prior to sending the request to the daemon as it must ...
      
      A third process does an lstat on on the expired mount point causing it to wait
      on expire completion (unfortunately) holding the directory semaphore.
      
      The mount request then arrives at the daemon which does an lstat and,
      deadlock.
      
      For some time I was concerned about releasing the directory semaphore around
      the expire wait in autofs4_lookup as well as for the mount call back.  I
      finally realized that the last round of changes in this function made the
      expiring dentry and the lookup dentry separate and distinct so the check and
      possible wait can be done anywhere prior to the mount call back.  This patch
      moves the check to just before the mount call back and inside the directory
      inode mutex release.
      Signed-off-by: NIan Kent <raven@themaw.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8f63aaa8
  5. 28 3月, 2009 1 次提交
  6. 25 8月, 2008 1 次提交
  7. 25 7月, 2008 13 次提交
    • I
      autofs4: remove unused ioctls · aa55ddf3
      Ian Kent 提交于
      The ioctls AUTOFS_IOC_TOGGLEREGHOST and AUTOFS_IOC_ASKREGHOST were added
      several years ago but what they were intended for has never been
      implemented (as far as I'm aware noone uses them) so remove them.
      Signed-off-by: NIan Kent <raven@themaw.net>
      Reviewed-by: NJeff Moyer <jmoyer@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      aa55ddf3
    • I
      autofs4: reorganize expire pending wait function calls · 06a35985
      Ian Kent 提交于
      This patch re-orgnirzes the checking for and waiting on active expires and
      elininates redundant checks.
      Signed-off-by: NIan Kent <raven@themaw.net>
      Cc: Jeff Moyer <jmoyer@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      06a35985
    • I
      autofs4: fix direct mount pending expire race - correction · ec6e8c7d
      Ian Kent 提交于
      Appologies, somehow I seem to have sent an out dated version of this
      patch. Here is an additional patch that brings the patch up to date.
      Signed-off-by: NIan Kent <raven@themaw.net>
      Cc: Jeff Moyer <jmoyer@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ec6e8c7d
    • I
      autofs4: fix direct mount pending expire race · 6e60a9ab
      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  /      <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: NIan Kent <raven@themaw.net>
      Cc: Jeff Moyer <jmoyer@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6e60a9ab
    • I
      autofs4: fix indirect mount pending expire race · 97e7449a
      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: NIan Kent <raven@themaw.net>
      Reviewed-by: NJeff Moyer <jmoyer@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      97e7449a
    • I
      autofs4: fix pending checks · 26e81b31
      Ian Kent 提交于
      There are two cases for which a dentry that has a pending mount request
      does not wait for completion.  One is via autofs4_revalidate() and the
      other via autofs4_follow_link().
      
      In revalidate, after the mount point directory is created, but before the
      mount is done, the check in try_to_fill_dentry() can can fail to send the
      dentry to the wait queue since the dentry is positive and the lookup flags
      may contain only LOOKUP_FOLLOW.  Although we don't trigger a mount for the
      LOOKUP_FOLLOW flag, if ther's one pending we might as well wait and use
      the mounted dentry for the lookup.
      
      In autofs4_follow_link() the dentry is not checked to see if it is pending
      so it may fail to call try_to_fill_dentry() and not wait for mount
      completion.
      
      A dentry that is pending must always be sent to the wait queue.
      Signed-off-by: NIan Kent <raven@themaw.net>
      Reviewed-by: NJeff Moyer <jmoyer@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      26e81b31
    • I
      autofs4: cleanup redundant readir code · ff9cd499
      Ian Kent 提交于
      The mount triggering functionality of readdir and related functions is no
      longer used (and is quite broken as well).  The unused portions have been
      removed.
      Signed-off-by: NIan Kent <raven@themaw.net>
      Reviewed-by: NJeff Moyer <jmoyer@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ff9cd499
    • I
      autofs4: use lookup intent flags to trigger mounts · 6d5cb926
      Ian Kent 提交于
      When an open(2) call is made on an autofs mount point directory that
      already exists and the O_DIRECTORY flag is not used the needed mount
      callback to the daemon is not done. This leads to the path walk
      continuing resulting in a callback to the daemon with an incorrect
      key. open(2) is called without O_DIRECTORY by the "find" utility but
      this should be handled properly anyway.
      
      This happens because autofs needs to use the lookup flags to decide
      when to callback to the daemon to perform a mount to prevent mount
      storms. For example, an autofs indirect mount map that has the "browse"
      option will have the mount point directories are pre-created and the
      stat(2) call made by a color ls against each directory will cause all
      these directories to be mounted. It is unfortunate we need to resort
      to this but mount maps can be quite large. Additionally, if a user
      manually umounts an autofs indirect mount the directory isn't removed
      which also leads to this situation.
      
      To resolve this autofs needs to use the lookup intent flags to enable
      it to make this decision. This patch adds this check and triggers a
      call back if any of the lookup intent flags are set as all these calls
      warrant a mount attempt be requested.
      
      I know that external VFS code which uses the lookup flags is something
      that the VFS would like to eliminate but I have no choice as I can't
      see any other way to do this. A VFS dentry or inode operation callback
      which returns the lookup "type" (requires a definition) would be
      sufficient. But this change is needed now and I'm not aware of the form
      that coming VFS changes will take so I'm not willing to propose anything
      along these lines.
      
      If anyone can provide an alternate method I would be happy to use it.
      
      [akpm@linux-foundation.org: fix build for concurrent VFS changes]
      Signed-off-by: NIan Kent <raven@themaw.net>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Jeff Moyer <jmoyer@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6d5cb926
    • I
      autofs4: don't release directory mutex if called in oz_mode · c432c258
      Ian Kent 提交于
      Since we now delay hashing of dentrys until the ->mkdir() call, droping
      and re-taking the directory mutex within the ->lookup() function when we
      are being called by user space is not needed.  This can lead to a race
      when other processes are attempting to access the same directory during
      mount point directory creation.
      
      In this case we need to hang onto the mutex to ensure we don't get user
      processes trying to create a mount request for a newly created dentry
      after the mount point entry has already been created.  This ensures that
      when we need to check a dentry passed to autofs4_wait(), if it is hashed,
      it is always the mount point dentry and not a new dentry created by
      another lookup during directory creation.
      Signed-off-by: NIan Kent <raven@themaw.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c432c258
    • I
      autofs4: fix symlink name allocation · ef581a74
      Ian Kent 提交于
      The length of the symlink name has been moved but it needs to be set
      before allocating space for it in the dentry info struct.  This corrects a
      mistake in a recent patch.
      Signed-off-by: NIan Kent <raven@themaw.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ef581a74
    • I
      autofs4: use look aside list for lookups · 25767378
      Ian Kent 提交于
      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: NIan Kent <raven@themaw.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      25767378
    • I
      autofs4: revert - redo lookup in ttfd · caf7da3d
      Ian Kent 提交于
      This patch series enables the use of a single dentry for lookups prior to
      the dentry being hashed and so we no longer need to redo the lookup.  This
      patch reverts the patch of commit
      03379044.
      Signed-off-by: NIan Kent <raven@themaw.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      caf7da3d
    • I
      autofs4: don't make expiring dentry negative · 5f6f4f28
      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: NIan Kent <raven@themaw.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5f6f4f28
  8. 01 5月, 2008 3 次提交
    • J
      autofs: path_{get,put}() cleanups · 868eb7a8
      Jan Blunck 提交于
      Here are some more places where path_{get,put}() can be used instead of
      dput()/mntput() pair.  Besides that it fixes a bug in autofs4_mount_busy()
      where mntput() was called before dput().
      Signed-off-by: NJan Blunck <jblunck@suse.de>
      Cc: Ian Kent <raven@themaw.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      868eb7a8
    • J
      autofs4: fix incorrect return from root.c:try_to_fill_dentry() · 9d2de6ad
      Jeff Moyer 提交于
      Jeff Moyer has identified a case where the autofs4 function
      root.c:try_to_fill_dentry() can return -EBUSY when it should return 0.
      
      Jeff's description of the way this happens is:
      
      "automount starts an expire for directory d.  after the callout to the daemon,
      but before the rmdir, another process tries to walk into the same directory.
      It puts itself onto the waitq, pending the expiration.
      
      When the expire finishes, the second process is woken up.  In
      try_to_fill_dentry, it does this check:
      
                      status = d_invalidate(dentry);
                      if (status != -EBUSY)
                              return -EAGAIN;
      
      And status is EBUSY.  The dentry still has a non-zero d_inode, and the
      flags do not contain LOOKUP_CONTINUE or LOOKUP_DIRECTORY
      
      So, we fall through and return -EBUSY to the caller."
      Signed-off-by: NJeff Moyer <jmoyer@redhat.com>
      Signed-off-by: NIan Kent <raven@themaw.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      9d2de6ad
    • J
      autofs4: fix execution order race in mount request code · 03379044
      Jeff Moyer 提交于
      Jeff Moyer has identified a race in due to an execution order dependency
      in the autofs4 function root.c:try_to_fill_dentry().
      
      Jeff's description of this race is:
      
      "P1 does a lookup of /mount/submount/foo.  Since the VFS can't find an entry
      for "foo" under /mount/submount, it calls into the autofs4 kernel module to
      allocate a new dentry, D1.  The kernel creates a new waitq for this lookup and
      calls the daemon to perform the mount.
      
      The daemon performs a mkdir of the "foo" directory under /mount/submount,
      which ends up creating a *new* dentry, D2.
      
      Then, P2 does a lookup of /mount/submount/foo.  The VFS path walking logic
      finds a dentry in the dcache, D2, and calls the revalidate function with this.
       In the autofs4 revalidate code, we then trigger a mount, since the dentry is
      an empty directory that isn't a mountpoint, and so set DCACHE_AUTOFS_PENDING
      and call into the wait code to trigger the mount.
      
      The wait code finds our existing waitq entry (since it is keyed off of the
      directory name) and adds itself to the list of waiters.
      
      After the daemon finishes the mount, it calls back into the kernel to release
      the waiters.  When this happens, P1 is woken up and goes about clearing the
      DCACHE_AUTOFS_PENDING flag, but it does this in D1!  So, given that P1 in our
      case is a program that will immediately try to access a file under
      /mount/submount/foo, we end up finding the dentry D2 which still has the
      pending flag set, and we set out to wait for a mount *again*!
      
      So, one way to address this is to re-do the lookup at the end of
      try_to_fill_dentry, and to clear the pending flag on the hashed dentry.  This
      seems a sane approach to me."
      
      And Jeff's patch does this.
      Signed-off-by: NJeff Moyer <jmoyer@redhat.com>
      Signed-off-by-by: NIan Kent <raven@themaw.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      03379044
  9. 29 4月, 2008 1 次提交
  10. 15 2月, 2008 2 次提交
  11. 20 10月, 2007 1 次提交
    • P
      pid namespaces: round up the API · a47afb0f
      Pavel Emelianov 提交于
      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: NPavel Emelianov <xemul@openvz.org>
      Acked-by: NSerge 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: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a47afb0f
  12. 23 8月, 2007 1 次提交
    • I
      autofs4: deadlock during create · 1864f7bd
      Ian Kent 提交于
      Due to inconsistent locking in the VFS between calls to lookup and
      revalidate deadlock can occur in the automounter.
      
      The inconsistency is that the directory inode mutex is held for both lookup
      and revalidate calls when called via lookup_hash whereas it is held only
      for lookup during a path walk.  Consequently, if the mutex is held during a
      call to revalidate autofs4 can't release the mutex to callback the daemon
      as it can't know whether it owns the mutex.
      
      This situation happens when a process tries to create a directory within an
      automount and a second process also tries to create the same directory
      between the lookup and the mkdir.  Since the first process has dropped the
      mutex for the daemon callback, the second process takes it during
      revalidate leading to deadlock between the autofs daemon and the second
      process when the daemon tries to create the mount point directory.
      
      After spending quite a bit of time trying to resolve this on more than one
      occassion, using rather complex and ulgy approaches, it turns out that just
      delaying the hashing of the dentry until the create operation works fine.
      Signed-off-by: NIan Kent <raven@themaw.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      1864f7bd
  13. 11 5月, 2007 1 次提交
  14. 09 5月, 2007 1 次提交
  15. 13 4月, 2007 1 次提交
  16. 21 2月, 2007 1 次提交