1. 25 7月, 2008 6 次提交
    • 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
  2. 01 5月, 2008 5 次提交
  3. 30 4月, 2008 1 次提交
  4. 29 4月, 2008 1 次提交
  5. 15 2月, 2008 2 次提交
  6. 09 2月, 2008 1 次提交
  7. 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
  8. 19 10月, 2007 1 次提交
  9. 17 10月, 2007 1 次提交
  10. 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
  11. 11 5月, 2007 1 次提交
  12. 09 5月, 2007 1 次提交
  13. 13 4月, 2007 1 次提交
  14. 21 2月, 2007 3 次提交
  15. 13 2月, 2007 2 次提交
  16. 14 12月, 2006 1 次提交
    • R
      [PATCH] getting rid of all casts of k[cmz]alloc() calls · 5cbded58
      Robert P. J. Day 提交于
      Run this:
      
      	#!/bin/sh
      	for f in $(grep -Erl "\([^\)]*\) *k[cmz]alloc" *) ; do
      	  echo "De-casting $f..."
      	  perl -pi -e "s/ ?= ?\([^\)]*\) *(k[cmz]alloc) *\(/ = \1\(/" $f
      	done
      
      And then go through and reinstate those cases where code is casting pointers
      to non-pointers.
      
      And then drop a few hunks which conflicted with outstanding work.
      
      Cc: Russell King <rmk@arm.linux.org.uk>, Ian Molton <spyro@f2s.com>
      Cc: Mikael Starvik <starvik@axis.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Roman Zippel <zippel@linux-m68k.org>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Kyle McMartin <kyle@mcmartin.ca>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Greg KH <greg@kroah.com>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      Cc: Paul Fulghum <paulkf@microgate.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: Karsten Keil <kkeil@suse.de>
      Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
      Cc: Jeff Garzik <jeff@garzik.org>
      Cc: James Bottomley <James.Bottomley@steeleye.com>
      Cc: Ian Kent <raven@themaw.net>
      Cc: Steven French <sfrench@us.ibm.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Neil Brown <neilb@cse.unsw.edu.au>
      Cc: Jaroslav Kysela <perex@suse.cz>
      Cc: Takashi Iwai <tiwai@suse.de>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      5cbded58
  17. 09 12月, 2006 1 次提交
  18. 08 12月, 2006 1 次提交
    • J
      [PATCH] autofs: fix error code path in autofs_fill_sb() · c949d4eb
      Jiri Kosina 提交于
      When kernel is compiled with old version of autofs (CONFIG_AUTOFS_FS), and
      new (observed at least with 5.x.x) automount deamon is started, kernel
      correctly reports incompatible version of kernel and userland daemon, but
      then screws things up instead of correct handling of the error:
      
       autofs: kernel does not match daemon version
       =====================================
       [ BUG: bad unlock balance detected! ]
       -------------------------------------
       automount/4199 is trying to release lock (&type->s_umount_key) at:
       [<c0163b9e>] get_sb_nodev+0x76/0xa4
       but there are no more locks to release!
      
       other info that might help us debug this:
       no locks held by automount/4199.
      
       stack backtrace:
        [<c0103b15>] dump_trace+0x68/0x1b2
        [<c0103c77>] show_trace_log_lvl+0x18/0x2c
        [<c01041db>] show_trace+0xf/0x11
        [<c010424d>] dump_stack+0x12/0x14
        [<c012e02c>] print_unlock_inbalance_bug+0xe7/0xf3
        [<c012fd4f>] lock_release+0x8d/0x164
        [<c012b452>] up_write+0x14/0x27
        [<c0163b9e>] get_sb_nodev+0x76/0xa4
        [<c0163689>] vfs_kern_mount+0x83/0xf6
        [<c016373e>] do_kern_mount+0x2d/0x3e
        [<c017513f>] do_mount+0x607/0x67a
        [<c0175224>] sys_mount+0x72/0xa4
        [<c0102b96>] sysenter_past_esp+0x5f/0x99
       DWARF2 unwinder stuck at sysenter_past_esp+0x5f/0x99
       Leftover inexact backtrace:
        =======================
      
      and then deadlock comes.
      
      The problem: autofs_fill_super() returns EINVAL to get_sb_nodev(), but
      before that, it calls kill_anon_super() to destroy the superblock which
      won't be needed.  This is however way too soon to call kill_anon_super(),
      because get_sb_nodev() has to perform its own cleanup of the superblock
      first (deactivate_super(), etc.).  The correct time to call
      kill_anon_super() is in the autofs_kill_sb() callback, which is called by
      deactivate_super() at proper time, when the superblock is ready to be
      killed.
      
      I can see the same faulty codepath also in autofs4.  This patch solves
      issues in both filesystems in a same way - it postpones the
      kill_anon_super() until the proper time is signalized by deactivate_super()
      calling the kill_sb() callback.
      
      [raven@themaw.net: update comment]
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      Acked-by: NIan Kent <raven@themaw.net>
      Cc: <stable@kernel.org>
      Signed-off-by: NIan Kent <raven@themaw.net>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      c949d4eb
  19. 15 11月, 2006 1 次提交
  20. 12 10月, 2006 1 次提交
  21. 01 10月, 2006 3 次提交
  22. 30 9月, 2006 2 次提交
  23. 27 9月, 2006 2 次提交
    • T
      [PATCH] inode-diet: Eliminate i_blksize from the inode structure · ba52de12
      Theodore Ts'o 提交于
      This eliminates the i_blksize field from struct inode.  Filesystems that want
      to provide a per-inode st_blksize can do so by providing their own getattr
      routine instead of using the generic_fillattr() function.
      
      Note that some filesystems were providing pretty much random (and incorrect)
      values for i_blksize.
      
      [bunk@stusta.de: cleanup]
      [akpm@osdl.org: generic_fillattr() fix]
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: NAdrian Bunk <bunk@stusta.de>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      ba52de12
    • I
      [PATCH] autofs4 needs to force fail return revalidate · bcdc5e01
      Ian Kent 提交于
      For a long time now I have had a problem with not being able to return a
      lookup failure on an existsing directory.  In autofs this corresponds to a
      mount failure on a autofs managed mount entry that is browsable (and so the
      mount point directory exists).
      
      While this problem has been present for a long time I've avoided resolving
      it because it was not very visible.  But now that autofs v5 has "mount and
      expire on demand" of nested multiple mounts, such as is found when mounting
      an export list from a server, solving the problem cannot be avoided any
      longer.
      
      I've tried very hard to find a way to do this entirely within the autofs4
      module but have not been able to find a satisfactory way to achieve it.
      
      So, I need to propose a change to the VFS.
      Signed-off-by: NIan Kent <raven@themaw.net>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      bcdc5e01