1. 27 1月, 2010 8 次提交
  2. 21 1月, 2010 1 次提交
    • A
      compat_ioctl: Supress "unknown cmd" message on serial /dev/console · 3f001711
      Atsushi Nemoto 提交于
      After the commit fb07a5f8 ("compat_ioctl: remove all VT ioctl
      handling"), I got this error message on 64-bit mips kernel with 32-bit
      busybox userland:
      
      ioctl32(init:1): Unknown cmd fd(0) cmd(00005600){t:'V';sz:0} arg(7fd76480) on /dev/console
      
      The cmd 5600 is VT_OPENQRY.  The busybox's init issues this ioctl to
      know vt-console or serial-console.  If the console was serial console,
      VT ioctls are not handled by the serial driver.
      
      And by quick search, I found some programs using VT_GETMODE to check
      vt-console is available or not.
      Signed-off-by: NAtsushi Nemoto <anemo@mba.ocn.ne.jp>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      3f001711
  3. 20 1月, 2010 10 次提交
  4. 19 1月, 2010 1 次提交
  5. 18 1月, 2010 7 次提交
    • J
      Btrfs: fix possible panic on unmount · 11dfe35a
      Josef Bacik 提交于
      We can race with the unmount of an fs and the stopping of a kthread where we
      will free the block group before we're done using it.  The reason for this is
      because we do not hold a reference on the block group while its caching, since
      the allocator drops its reference once it exits or moves on to the next block
      group.  This patch fixes the problem by taking a reference to the block group
      before we start caching and dropping it when we're done to make sure all
      accesses to the block group are safe.  Thanks,
      Signed-off-by: NJosef Bacik <josef@redhat.com>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      11dfe35a
    • C
      Btrfs: deal with NULL acl sent to btrfs_set_acl · a9cc71a6
      Chris Mason 提交于
      It is legal for btrfs_set_acl to be sent a NULL acl.  This
      makes sure we don't dereference it.  A similar patch was sent by
      Johannes Hirte <johannes.hirte@fem.tu-ilmenau.de>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      a9cc71a6
    • J
      Btrfs: fix regression in orphan cleanup · 6c090a11
      Josef Bacik 提交于
      Currently orphan cleanup only ever gets triggered if we cross subvolumes during
      a lookup, which means that if we just mount a plain jane fs that has orphans in
      it, they will never get cleaned up.  This results in panic's like these
      
      http://www.kerneloops.org/oops.php?number=1109085
      
      where adding an orphan entry results in -EEXIST being returned and we panic.  In
      order to fix this, we check to see on lookup if our root has had the orphan
      cleanup done, and if not go ahead and do it.  This is easily reproduceable by
      running this testcase
      
      #include <sys/types.h>
      #include <sys/stat.h>
      #include <fcntl.h>
      #include <string.h>
      #include <unistd.h>
      #include <stdio.h>
      
      int main(int argc, char **argv)
      {
      	char data[4096];
      	char newdata[4096];
      	int fd1, fd2;
      
      	memset(data, 'a', 4096);
      	memset(newdata, 'b', 4096);
      
      	while (1) {
      		int i;
      
      		fd1 = creat("file1", 0666);
      		if (fd1 < 0)
      			break;
      
      		for (i = 0; i < 512; i++)
      			write(fd1, data, 4096);
      
      		fsync(fd1);
      		close(fd1);
      
      		fd2 = creat("file2", 0666);
      		if (fd2 < 0)
      			break;
      
      		ftruncate(fd2, 4096 * 512);
      
      		for (i = 0; i < 512; i++)
      			write(fd2, newdata, 4096);
      		close(fd2);
      
      		i = rename("file2", "file1");
      		unlink("file1");
      	}
      
      	return 0;
      }
      
      and then pulling the power on the box, and then trying to run that test again
      when the box comes back up.  I've tested this locally and it fixes the problem.
      Thanks to Tomas Carnecky for helping me track this down initially.
      Signed-off-by: NJosef Bacik <josef@redhat.com>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      6c090a11
    • Y
      Btrfs: Fix race in btrfs_mark_extent_written · 6c7d54ac
      Yan, Zheng 提交于
      Fix bug reported by Johannes Hirte. The reason of that bug
      is btrfs_del_items is called after btrfs_duplicate_item and
      btrfs_del_items triggers tree balance. The fix is check that
      case and call btrfs_search_slot when needed.
      Signed-off-by: NYan Zheng <zheng.yan@oracle.com>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      6c7d54ac
    • J
      Btrfs, fix memory leaks in error paths · 2423fdfb
      Jiri Slaby 提交于
      Stanse found 2 memory leaks in relocate_block_group and
      __btrfs_map_block. cluster and multi are not freed/assigned on all
      paths. Fix that.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: linux-btrfs@vger.kernel.org
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      2423fdfb
    • Y
      Btrfs: align offsets for btrfs_ordered_update_i_size · a038fab0
      Yan, Zheng 提交于
      Some callers of btrfs_ordered_update_i_size can now pass in
      a NULL for the ordered extent to update against.  This makes
      sure we properly align the offset they pass in when deciding
      how much to bump the on disk i_size.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      a038fab0
    • J
      btrfs: fix missing last-entry in readdir(3) · 406266ab
      Jan Engelhardt 提交于
      parent 49313cdac7b34c9f7ecbb1780cfc648b1c082cd7 (v2.6.32-1-g49313cd)
      commit ff48c08e1c05c67e8348ab6f8a24de8034e0e34d
      Author: Jan Engelhardt <jengelh@medozas.de>
      Date:   Wed Dec 9 22:57:36 2009 +0100
      
      Btrfs: fix missing last-entry in readdir(3)
      
      When one does a 32-bit readdir(3), the last entry of a directory is
      missing. This is however not due to passing a large value to filldir,
      but it seems to have to do with glibc doing telldir or something
      quirky. In any case, this patch fixes it in practice.
      Signed-off-by: NJan Engelhardt <jengelh@medozas.de>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      406266ab
  6. 17 1月, 2010 7 次提交
  7. 16 1月, 2010 6 次提交
    • E
      inotify: only warn once for inotify problems · 976ae32b
      Eric Paris 提交于
      inotify will WARN() if it finds that the idr and the fsnotify internals
      somehow got out of sync.  It was only supposed to do this once but due
      to this stupid bug it would warn every single time a problem was
      detected.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Cc: stable@kernel.org
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      976ae32b
    • E
      inotify: do not reuse watch descriptors · 9e572cc9
      Eric Paris 提交于
      Since commit 7e790dd5 ("inotify: fix
      error paths in inotify_update_watch") inotify changed the manor in which
      it gave watch descriptors back to userspace.  Previous to this commit
      inotify acted like the following:
      
        inotify_add_watch(X, Y, Z) = 1
        inotify_rm_watch(X, 1);
        inotify_add_watch(X, Y, Z) = 2
      
      but after this patch inotify would return watch descriptors like so:
      
        inotify_add_watch(X, Y, Z) = 1
        inotify_rm_watch(X, 1);
        inotify_add_watch(X, Y, Z) = 1
      
      which I saw as equivalent to opening an fd where
      
        open(file) = 1;
        close(1);
        open(file) = 1;
      
      seemed perfectly reasonable.  The issue is that quite a bit of userspace
      apparently relies on the behavior in which watch descriptors will not be
      quickly reused.  KDE relies on it, I know some selinux packages rely on
      it, and I have heard complaints from other random sources such as debian
      bug 558981.
      
      Although the man page implies what we do is ok, we broke userspace so
      this patch almost reverts us to the old behavior.  It is still slightly
      racey and I have patches that would fix that, but they are rather large
      and this will fix it for all real world cases.  The race is as follows:
      
       - task1 creates a watch and blocks in idr_new_watch() before it updates
         the hint.
       - task2 creates a watch and updates the hint.
       - task1 updates the hint with it's older wd
       - task removes the watch created by task2
       - task adds a new watch and will reuse the wd originally given to task2
      
      it requires moving some locking around the hint (last_wd) but this should
      solve it for the real world and be -stable safe.
      
      As a side effect this patch papers over a bug in the lib/idr code which
      is causing a large number WARN's to pop on people's system and many
      reports in kerneloops.org.  I'm working on the root cause of that idr
      bug seperately but this should make inotify immune to that issue.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Cc: stable@kernel.org
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      9e572cc9
    • D
      xfs: xfs_swap_extents needs to handle dynamic fork offsets · e09f9860
      Dave Chinner 提交于
      When swapping extents, we can corrupt inodes by swapping data forks
      that are in incompatible formats.  This is caused by the two indoes
      having different fork offsets due to the presence of an attribute
      fork on an attr2 filesystem.  xfs_fsr tries to be smart about
      setting the fork offset, but the trick it plays only works on attr1
      (old fixed format attribute fork) filesystems.
      
      Changing the way xfs_fsr sets up the attribute fork will prevent
      this situation from ever occurring, so in the kernel code we can get
      by with a preventative fix - check that the data fork in the
      defragmented inode is in a format valid for the inode it is being
      swapped into.  This will lead to files that will silently and
      potentially repeatedly fail defragmentation, so issue a warning to
      the log when this particular failure occurs to let us know that
      xfs_fsr needs updating/fixing.
      
      To help identify how to improve xfs_fsr to avoid this issue, add
      trace points for the inodes being swapped so that we can determine
      why the swap was rejected and to confirm that the code is making the
      right decisions and modifications when swapping forks.
      
      A further complication is even when the swap is allowed to proceed
      when the fork offset is different between the two inodes then value
      for the maximum number of extents the data fork can hold can be
      wrong. Make sure these are also set correctly after the swap occurs.
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAlex Elder <aelder@sgi.com>
      e09f9860
    • D
      xfs: fix missing error check in xfs_rtfree_range · 3daeb42c
      Dave Chinner 提交于
      When xfs_rtfind_forw() returns an error, the block is returned
      uninitialised.  xfs_rtfree_range() is not checking the error return,
      so could be using an uninitialised block number for modifying bitmap
      summary info.
      
      The problem was found by gcc when compiling the *userspace* libxfs
      code - it is an copy of the kernel code with the exact same bug.
      gcc gives an uninitialised variable warning on the userspace code
      but not on the kernel code. You gotta love the consistency (Mmmm,
      slightly chewy today!).
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Signed-off-by: NAlex Elder <aelder@sgi.com>
      3daeb42c
    • D
      xfs: fix stale inode flush avoidance · 4b6a4688
      Dave Chinner 提交于
      When reclaiming stale inodes, we need to guarantee that inodes are
      unpinned before returning with a "clean" status. If we don't we can
      reclaim inodes that are pinned, leading to use after free in the
      transaction subsystem as transactions complete.
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAlex Elder <aelder@sgi.com>
      4b6a4688
    • D
      xfs: Remove inode iolock held check during allocation · 126976c7
      Dave Chinner 提交于
      lockdep complains about a the lock not being initialised as we do an
      ASSERT based check that the lock is not held before we initialise it
      to catch inodes freed with the lock held.
      
      lockdep does this check for us in the lock initialisation code, so
      remove the ASSERT to stop the lockdep warning.
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAlex Elder <aelder@sgi.com>
      126976c7