1. 24 Jul, 2008 40 commits
    • 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 pending checks · 26e81b31
      Ian Kent authored
      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: 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>
      26e81b31
    • Ian Kent's avatar
      autofs4: cleanup redundant readir code · ff9cd499
      Ian Kent authored
      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: 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>
      ff9cd499
    • Ian Kent's avatar
      autofs4: indirect dentry must almost always be positive · c72305b5
      Ian Kent authored
      We have been seeing mount requests comming to the automount daemon for
      keys of the form "<map key>/<non key directory>" which are lookups for
      invalid map keys.  But we can check for this in the kernel module and
      return a fail immediately, without having to send a request to the daemon.
      
      It is possible to recognise these requests are invalid based on whether
      the request dentry is negative and its relation to the autofs file system
      root.
      
      For example, given the indirect multi-mount map entry:
      
      idm1  \
          /mm1  <server>:/<path1>
          /mm2  <server>:/<path2>
      
      For a request to mount idm1, IS_ROOT((idm1)->d_parent) will be always be
      true and the dentry may be negative.  But directories idm1/mm1 and
      idm1/mm2 will always be created as part of the mount request for idm1.  So
      any mount request within idm1 itself must have a positive dentry otherwise
      the map key is invalid.
      
      In version 4 these multi-mount entries are all mounted and umounted as a
      single request and in version 5 the directories idm1/mm1 and idm1/mm2 are
      created and an autofs fs mounted on them to act as a mount trigger so the
      above is also true.
      
      This also holds true for the autofs version 4 pseudo direct mount feature.
       When this feature is used without the "--ghost" option automount(8) will
      create internal submounts as we go down the map key paths which are
      essentially normal indirect mounts for which the above holds.  If the
      "--ghost" option is given the directories for map keys are created at
      daemon startup so valid map entries correspond to postive dentries in the
      autofs fs.
      
      autofs version 5 direct mount maps are similar except that the IS_ROOT
      check is not needed.  This has been addressed in a previous patch tittled
      "autofs4 - detect invalid direct mount requests".
      
      For example, given the direct multi-mount map entry:
      
      /test/dm1  \
          /mm1  <server>:/<path1>
          /mm2  <server>:/<path2>
      
      An autofs fs is mounted on /test/dm1 as a trigger mount and when a mount
      is triggered for /test/dm1, the multi-mount offset directories
      /test/dm1/mm1 and /test/dm1/mm2 are created and an autofs fs is mounted on
      them to act as mount triggers.  So valid direct mount requests must always
      have a positive dentry if they correspond to a valid map entry.
      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>
      c72305b5
    • Ian Kent's avatar
      autofs4: detect invalid direct mount requests · eb3b1767
      Ian Kent authored
      autofs v5 direct and offset mounts within an autofs filesystem are
      triggered by existing autofs triger mounts so the mount point dentry must
      be positive.  If the mount point dentry is negative then the trigger
      doesn't exist so we can return fail immediately.
      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>
      eb3b1767
    • 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
    • Ian Kent's avatar
      autofs4: check kernel communication pipe is valid for write · e64be33c
      Ian Kent authored
      It is possible for an autofs mount to become catatonic (and for the daemon
      communication pipe to become NULL) after a wait has been initiallized but
      before the request has been sent to the daemon.  We need to check for this
      before sending the request packet.
      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>
      e64be33c
    • Ian Kent's avatar
      autofs4: add missing kfree · f4c7da02
      Ian Kent authored
      It see that the patch tittled "autofs4 - fix pending mount race" is
      missing a change that I had recently made.
      
      It's missing a kfree for the case mutex_lock_interruptible() fails
      to aquire the wait queue mutex.
      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>
      f4c7da02
    • Ian Kent's avatar
      autofs4: fix pending mount race · a1362fe9
      Ian Kent authored
      Close a race between a pending mount that is about to finish and a new
      lookup for the same directory.
      
      Process P1 triggers a mount of directory foo.  It sets
      DCACHE_AUTOFS_PENDING in the ->lookup routine, creates a waitq entry for
      'foo', and calls out to the daemon to perform the mount.  The autofs
      daemon will then create the directory 'foo', using a new dentry that will
      be hashed in the dcache.
      
      Before the mount completes, another process, P2, tries to walk into the
      'foo' directory.  The vfs path walking code finds an entry for 'foo' and
      calls the revalidate method.  Revalidate finds that the entry is not
      PENDING (because PENDING was never set on the dentry created by the
      mkdir), but it does find the directory is empty.  Revalidate calls
      try_to_fill_dentry, which sets the PENDING flag and then calls into the
      autofs4 wait code to trigger or wait for a mount of 'foo'.  The wait code
      finds the entry for 'foo' and goes to sleep waiting for the completion of
      the mount.
      
      Yet another process, P3, tries to walk into the 'foo' directory.  This
      process again finds a dentry in the dcache for 'foo', and calls into the
      autofs revalidate code.
      
      The revalidate code finds that the PENDING flag is set, and so calls
      try_to_fill_dentry.
      
      a) try_to_fill_dentry sets the PENDING flag redundantly for this
         dentry, then calls into the autofs4 wait code.
      
      b) the autofs4 wait code takes the waitq mutex and searches for an
         entry for 'foo'
      
      Between a and b, P1 is woken up because the mount completed.  P1 takes the
      wait queue mutex, clears the PENDING flag from the dentry, and removes the
      waitqueue entry for 'foo' from the list.
      
      When it releases the waitq mutex, P3 (eventually) acquires it.  At this
      time, it looks for an existing waitq for 'foo', finds none, and so creates
      a new one and calls out to the daemon to mount the 'foo' directory.
      
      Now, the reason that three processes are required to trigger this race is
      that, because the PENDING flag is not set on the dentry created by mkdir,
      the window for the race would be way to slim for it to ever occur.
      Basically, between the testing of d_mountpoint(dentry) and the taking of
      the waitq mutex, the mount would have to complete and the daemon would
      have to be woken up, and that in turn would have to wake up P1.  This is
      simply impossible.  Add the third process, though, and it becomes slightly
      more likely.
      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>
      a1362fe9
    • Ian Kent's avatar
      autofs4: fix waitq locking · 5a11d4d0
      Ian Kent authored
      The autofs4_catatonic_mode() function accesses the wait queue without any
      locking but can be called at any time.  This could lead to a possible
      double free of the name field of the wait and a double fput of the daemon
      communication pipe or an fput of a NULL file pointer.
      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>
      5a11d4d0
    • 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 lookup intent flags to trigger mounts · 6d5cb926
      Ian Kent authored
      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: default avatarIan Kent <raven@themaw.net>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      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>
      6d5cb926
    • Ian Kent's avatar
      autofs4: don't release directory mutex if called in oz_mode · c432c258
      Ian Kent authored
      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: 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>
      c432c258
    • Ian Kent's avatar
      autofs4: fix symlink name allocation · ef581a74
      Ian Kent authored
      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: 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>
      ef581a74
    • 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: revert - redo lookup in ttfd · caf7da3d
      Ian Kent authored
      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: 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>
      caf7da3d
    • 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
    • Michael Halcrow's avatar
      eCryptfs: Make all persistent file opens delayed · 391b52f9
      Michael Halcrow authored
      There is no good reason to immediately open the lower file, and that can
      cause problems with files that the user does not intend to immediately
      open, such as device nodes.
      
      This patch removes the persistent file open from the interpose step and
      pushes that to the locations where eCryptfs really does need the lower
      persistent file, such as just before reading or writing the metadata
      stored in the lower file header.
      
      Two functions are jumping to out_dput when they should just be jumping to
      out on error paths.  This patch also fixes these.
      Signed-off-by: default avatarMichael Halcrow <mhalcrow@us.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      391b52f9
    • Michael Halcrow's avatar
      eCryptfs: do not try to open device files on mknod · 72b55fff
      Michael Halcrow authored
      When creating device nodes, eCryptfs needs to delay actually opening the lower
      persistent file until an application tries to open.  Device handles may not be
      backed by anything when they first come into existence.
      
      [Valdis.Kletnieks@vt.edu: build fix]
      Signed-off-by: default avatarMichael Halcrow <mhalcrow@us.ibm.com>
      Cc: <Valdis.Kletnieks@vt.edu}
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      72b55fff
    • Harvey Harrison's avatar
      ecryptfs: inode.c mmap.c use unaligned byteorder helpers · 0a688ad7
      Harvey Harrison authored
      Fixe sparse warnings:
      fs/ecryptfs/inode.c:368:15: warning: cast to restricted __be64
      fs/ecryptfs/mmap.c:385:12: warning: incorrect type in assignment (different base types)
      fs/ecryptfs/mmap.c:385:12:    expected unsigned long long [unsigned] [assigned] [usertype] file_size
      fs/ecryptfs/mmap.c:385:12:    got restricted __be64 [usertype] <noident>
      fs/ecryptfs/mmap.c:428:12: warning: incorrect type in assignment (different base types)
      fs/ecryptfs/mmap.c:428:12:    expected unsigned long long [unsigned] [assigned] [usertype] file_size
      fs/ecryptfs/mmap.c:428:12:    got restricted __be64 [usertype] <noident>
      Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
      Cc: Michael Halcrow <mhalcrow@us.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0a688ad7
    • Harvey Harrison's avatar
      ecryptfs: crypto.c use unaligned byteorder helpers · 29335c6a
      Harvey Harrison authored
      Fixes the following sparse warnings:
      fs/ecryptfs/crypto.c:1036:8: warning: cast to restricted __be32
      fs/ecryptfs/crypto.c:1038:8: warning: cast to restricted __be32
      fs/ecryptfs/crypto.c:1077:10: warning: cast to restricted __be32
      fs/ecryptfs/crypto.c:1103:6: warning: incorrect type in assignment (different base types)
      fs/ecryptfs/crypto.c:1105:6: warning: incorrect type in assignment (different base types)
      fs/ecryptfs/crypto.c:1124:8: warning: incorrect type in assignment (different base types)
      fs/ecryptfs/crypto.c:1241:21: warning: incorrect type in assignment (different base types)
      fs/ecryptfs/crypto.c:1244:30: warning: incorrect type in assignment (different base types)
      fs/ecryptfs/crypto.c:1414:23: warning: cast to restricted __be32
      fs/ecryptfs/crypto.c:1417:32: warning: cast to restricted __be16
      Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
      Cc: Michael Halcrow <mhalcrow@us.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      29335c6a
    • Miklos Szeredi's avatar
      ecryptfs: string copy cleanup · 8f236809
      Miklos Szeredi authored
      Clean up overcomplicated string copy, which also gets rid of this
      bogus warning:
      
      fs/ecryptfs/main.c: In function 'ecryptfs_parse_options':
      include/asm/arch/string_32.h:75: warning: array subscript is above array bounds
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      Cc: Michael Halcrow <mhalcrow@us.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8f236809
    • Eric Sandeen's avatar
      ecryptfs: propagate key errors up at mount time · 982363c9
      Eric Sandeen authored
      Mounting with invalid key signatures should probably fail, if they were
      specifically requested but not available.
      
      Also fix case checks in process_request_key_err() for the right sign of
      the errnos, as spotted by Jan Tluka.
      Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
      Reviewed-by: default avatarJan Tluka <jtluka@redhat.com>
      Acked-by: default avatarMichael Halcrow <mhalcrow@us.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      982363c9
    • Tyler Hicks's avatar
      ecryptfs: discard ecryptfsd registration messages in miscdev · 6c4c17b0
      Tyler Hicks authored
      The userspace eCryptfs daemon sends HELO and QUIT messages to the kernel
      for per-user daemon (un)registration.  These messages are required when
      netlink is used as the transport, but (un)registration is handled by
      opening and closing the device file when miscdev is the transport.  These
      messages should be discarded in the miscdev transport so that a daemon
      isn't registered twice.
      Signed-off-by: default avatarTyler Hicks <tyhicks@linux.vnet.ibm.com>
      Cc: Michael Halcrow <mhalcrow@us.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6c4c17b0
    • Michael Halcrow's avatar
      eCryptfs: Privileged kthread for lower file opens · 746f1e55
      Michael Halcrow authored
      eCryptfs would really like to have read-write access to all files in the
      lower filesystem.  Right now, the persistent lower file may be opened
      read-only if the attempt to open it read-write fails.  One way to keep
      from having to do that is to have a privileged kthread that can open the
      lower persistent file on behalf of the user opening the eCryptfs file;
      this patch implements this functionality.
      
      This patch will properly allow a less-privileged user to open the eCryptfs
      file, followed by a more-privileged user opening the eCryptfs file, with
      the first user only being able to read and the second user being able to
      both read and write.  eCryptfs currently does this wrong; it will wind up
      calling vfs_write() on a file that was opened read-only.  This is fixed in
      this patch.
      Signed-off-by: default avatarMichael Halcrow <mhalcrow@us.ibm.com>
      Cc: Dave Kleikamp <shaggy@austin.ibm.com>
      Cc: Serge Hallyn <serue@us.ibm.com>
      Cc: Eric Sandeen <sandeen@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      746f1e55
    • Wang Chen's avatar
      I2O: handle sysfs_create_link() failures · 0293902a
      Wang Chen authored
      Compile warning:
      ignoring return value of `sysfs_create_link', declared with attribute warn_unused_result.
      
      If sysfs_create_link failed, take care of the return value and do some
      error handle after the failure.
      
      Since sysfs_remove_link() will check whether a link exists, when removing the
      link in error path, we don't need to care whether a link was created.
      Signed-off-by: default avatarWang Chen <wangchen@cn.fujitsu.com>
      Cc: Markus Lidel <Markus.Lidel@shadowconnect.com>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0293902a
    • Stefano Stabellini's avatar
      vt: do not update when the console is blanked · f700d6e5
      Stefano Stabellini authored
      vt.c DO_UPDATE macro checks if the console is visible but doesn't check if
      the console is blanked.
      
      In fact updating fbcon while the console is blanked is not only
      unnecessary but can even cause screen corruption.
      
      Therefore I am adding a simple check on console_blanked in DO_UPDATE.
      Signed-off-by: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
      Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
      Cc: "Antonino A. Daplas" <adaplas@pol.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f700d6e5
    • Jiri Slaby's avatar
      vt: hold console_sem across sysfs operations · e0426e6a
      Jiri Slaby authored
      Hold console sem while creating/destroying sysfs files.  Serialisation is
      so far done by BKL held in tty release_dev and chrdev_open, but no other
      locks are held in open path.
      Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Cc: Aristeu Rozanski <aris@ruivo.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e0426e6a
    • Jan Nikitenko's avatar
      spi: au1550_spi: improve pio transfer mode · bbe48ecc
      Jan Nikitenko authored
      Improve PIO transfer mode of au1550 spi controller by continuing of spi
      transfer, instead of aborting transfer when transmit underflow interrupt
      occurrs.
      
      Verified by oscilloscope that the spi clock pauses on trasmit underflow,
      so transfer continuation is perfectly valid even though au1550 datasheet
      says that on tx underflow zeroes will be transfered.
      
      Also make some error messages more specific.
      
      [akpm@linux-foundation.org: coding-style fixes]
      Signed-off-by: default avatarJan Nikitenko <jan.nikitenko@gmail.com>
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bbe48ecc
    • Manuel Lauss's avatar
      spi: au1550_spi: proper platform device · 3a93a159
      Manuel Lauss authored
      Remove the Au1550 resource table and instead extract MMIO/IRQ/DMA
      resources from platform resource information like any well-behaved
      platform driver.
      Signed-off-by: default avatarManuel Lauss <mano@roarinelk.homelinux.net>
      Signed-off-by: default avatarJan Nikitenko <jan.nikitenko@gmail.com>
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3a93a159
    • Alan Cox's avatar
      spidev: BKL removal · 4ef754b7
      Alan Cox authored
      Another step to removing ->ioctl and to removing the BKL
      
      [dbrownell@users.sourceforge.net: take final step; BKL not needed]
      Signed-off-by: default avatarAlan Cox <alan@redhat.com>
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4ef754b7
    • Grant Likely's avatar
      spi: make spi_board_info.modalias a char array · 102eb975
      Grant Likely authored
      Currently, 'modalias' in the spi_device structure is a 'const char *'.
      The spi_new_device() function fills in the modalias value from a passed in
      spi_board_info data block.  Since it is a pointer copy, the new spi_device
      remains dependent on the spi_board_info structure after the new spi_device
      is registered (no other fields in spi_device directly depend on the
      spi_board_info structure; all of the other data is copied).
      
      This causes a problem when dynamically propulating the list of attached
      SPI devices.  For example, in arch/powerpc, the list of SPI devices can be
      populated from data in the device tree.  With the current code, the device
      tree adapter must kmalloc() a new spi_board_info structure for each new
      SPI device it finds in the device tree, and there is no simple mechanism
      in place for keeping track of these allocations.
      
      This patch changes modalias from a 'const char *' to a fixed char array.
      By copying the modalias string instead of referencing it, the dependency
      on the spi_board_info structure is eliminated and an outside caller does
      not need to maintain a separate spi_board_info allocation for each device.
      
      If searched through the code to the best of my ability for any references
      to modalias which may be affected by this change and haven't found
      anything.  It has been tested with the lite5200b platform in arch/powerpc.
      
      [dbrownell@users.sourceforge.net: cope with linux-next changes: KOBJ_NAME_LEN obliterated, etc]
      Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      102eb975
    • Robert P. J. Day's avatar
      SPI Kconfig simplifications · 6291fe2a
      Robert P. J. Day authored
      Use "if SPI_MASTER" to remove numerous dependencies.
      
      [dbrownell@users.sourceforge.net: remove a couple now-needless EXPERIMENTAL dependencies too]
      Signed-off-by: default avatarRobert P. J. Day <rpjday@crashcourse.ca>
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6291fe2a
    • Roel Kluin's avatar
      xilinx_spi: test below 0 on unsigned irq in xilinx_spi_probe() · 166a375b
      Roel Kluin authored
      xilinx_spi->irq is unsigned, so the test fails
      Signed-off-by: default avatarRoel Kluin <12o3l@tiscali.nl>
      Cc: David Brownell <dbrownell@users.sourceforge.net>
      Cc: Andrei Konovalov <akonovalov@ru.mvista.com>
      Cc: Yuri Frolov <yfrolov@ru.mvista.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      166a375b
    • Chen Gong's avatar
      spi: spi_mpc83xx clockrate fixes · a61f5345
      Chen Gong authored
      This updates the SPI clock rate calculations for the spi_mpc83xx driver.
      Some boundary conditions were wrong, and in several cases divide-by-16
      wasn't always needed
      Signed-off-by: default avatarChen Gong <g.chen@freescale.com>
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a61f5345
    • Andre Haupt's avatar
    • Nye Liu's avatar
      cpm1: don't send break on TX_STOP, don't interrupt RX/TX when adjusting termios parameters · ae2d4c39
      Nye Liu authored
      Before setting STOP_TX, set _brkcr to 0 so the SMC does not send a break
      character.  The driver appears to properly re-initialize _brkcr when the
      SMC is restarted.
      
      Do not interrupt RX/TX when the termios is being adjusted; it results in
      corrupted characters appearing on the line.
      
      Cc: Vitaly Bordug <vbordug@ru.mvista.com>
      Cc: Scott Wood <scottwood@freescale.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Kumar Gala <galak@kernel.crashing.org>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ae2d4c39
    • Maciej W. Rozycki's avatar
      serial: DZ11: avoid a hang at console switch-over · e9a8f4d1
      Maciej W. Rozycki authored
      Changes to the generic console support code that happened a while ago
      introduced a scenario where the initial console is used in parallel with
      the final console during a brief period when switching between the two is
      in progress.  During that time a message about the switch-over is printed.
      
      With some combinations of chips, firmware and drivers, such as the DEC
      DZ11 clone used with the DECstation, a hang may happen because the
      firmware used for the initial console may not expect the state of the chip
      after it has been initialised by the driver.
      
      This is a workaround for the DZ11 which reuses the power-management
      callback to keep the transmitter of the line associated with the console
      enabled.  It reflects the consensus reached in a discussion a while ago.
      Signed-off-by: default avatarMaciej W. Rozycki <macro@linux-mips.org>
      Cc: Jiri Slaby <jirislaby@gmail.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e9a8f4d1
    • Maciej W. Rozycki's avatar
      serial: Z85C30: avoid a hang at console switch-over · 37713591
      Maciej W. Rozycki authored
      Changes to the generic console support code that happened a while ago
      introduced a scenario where the initial console is used in parallel with
      the final console during a brief period when switching between the two is
      in progress.  During that time a message about the switch-over is printed.
      
      With some combinations of chips, firmware and drivers, such as the Zilog
      Z85C30 SCC used with the DECstation, a hang may happen because the
      firmware used for the initial console may not expect the state of the chip
      after it has been initialised by the driver.  This is not a bug in the
      firmware, as some registers it would have to examine are write-only.
      
      This is a workaround for the Z85C30 which reuses the power-management
      callback to keep the transmitter of the line associated with the console
      enabled.  It reflects the consensus reached in a discussion a while ago.
      Signed-off-by: default avatarMaciej W. Rozycki <macro@linux-mips.org>
      Cc: Jiri Slaby <jirislaby@gmail.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      37713591